Commit bb1440dc authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Switch Esprima to report index-based ranges.

This will result in a lot less JSON being generated which in turn
cuts the JSON generating/parsing time considerably.

Also, the comments output of esprima only reports index-based ranges
anyway, so we're pretty much bound to use it.

Again, parsing all sencha touch src files:

JsParser:      3.5s
EsprimaParser: 4.0s

That's not much of a performance hit any more.
parent a21c9922
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ module JsDuck
    def parse(input)
      @v8['js'] = input

      json = @v8.eval("JSON.stringify(esprima.parse(js, {comment: true, loc: true}))")
      json = @v8.eval("JSON.stringify(esprima.parse(js, {comment: true, range: true}))")
      JSON.parse(json, :max_nesting => false)
    end