Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit ae29000

Browse files
committed
Massive reduction in bundled parser size.
Reduced the size of the parser from 416.89 kB to 86.7 kB (about 20% of the original size) by switching pegjs option --optimize from speed to size and modifying my fork of pegjs to allow rule descriptions to be looked up by rule index instead of by rule name as the optimize size mode required. Running time for the entire suite of specs is still around 1 second, so the tracer branch is now performing as fast as master and is also a fraction of the file size as well. Refs #16
1 parent 001165e commit ae29000

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module.exports = function(grunt) {
104104
options: {
105105
failOnError: true
106106
},
107-
command: './node_modules/.bin/pegjs --cache --optimize speed --trace -e parser src/grammar.pegjs .tmp/parser.js'
107+
command: './node_modules/.bin/pegjs --trace --cache --optimize size -e parser src/grammar.pegjs .tmp/parser.js'
108108
},
109109
test: {
110110
options: {

demo/js/sqlite-parser-demo.js

Lines changed: 10 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"prepublish": "grunt release"
3131
},
3232
"devDependencies": {
33-
"babel-core": "^6.7.0",
33+
"babel-core": "^6.7.2",
3434
"babel-plugin-add-module-exports": "^0.1.2",
3535
"babel-preset-es2015": "^6.6.0",
3636
"babelify": "^7.2.0",
@@ -39,7 +39,7 @@
3939
"codemirror": "^5.12.0",
4040
"grunt": "^0.4.5",
4141
"grunt-banner": "^0.6.0",
42-
"grunt-browserify": "^4.0.1",
42+
"grunt-browserify": "^5.0.0",
4343
"grunt-contrib-clean": "^1.0.0",
4444
"grunt-contrib-concat": "^1.0.0",
4545
"grunt-contrib-connect": "^1.0.0",

src/tracer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default (function () {
5454
bestNode = {indentation: -1}, deep = false, stmts = 0,
5555
namedEvents = this.events
5656
.filter(function (e) {
57-
return e.description !== null &&
57+
return e.description != null &&
5858
!that.whitespaceRule.test(e.rule);
5959
})
6060
.reverse();

0 commit comments

Comments
 (0)