language icon indicating copy to clipboard operation
language copied to clipboard

Slow parse times

Open ide opened this issue 12 years ago • 4 comments

I haven't done any profiling so this is a rather generic issue, but the parser performance is rather slow. For example:

> function benchmark() {
... var jquery = require('fs').readFileSync('./jquery-1.7.1.js', 'utf-8');
... console.time('parse');
... parser.parse(jquery);
... console.timeEnd('parse');
... }
> benchmark()
parse: 12042ms

I'm surprised because the theoretical performance should be quite high so I'm guessing that high number of object allocations, especially for the deep expression productions (how many nodes does it take to represent a simple string literal?) is hurting performance.

ide avatar Feb 04 '12 23:02 ide

Are you on aim? I've done a lot research regarding this and it's easier to explain there.

Sent from my iPhone

On Feb 4, 2012, at 3:15 PM, James [email protected] wrote:

I haven't done any profiling so this is a rather generic issue, but the parser performance is rather slow. For example:

> function benchmark() {
... var jquery = require('fs').readFileSync('./jquery-1.7.1.js', 'utf-8');
... console.time('parse');
... parser.parse(jquery);
... console.timeEnd('parse');
... }
> benchmark()
parse: 12042ms

I'm surprised because the theoretical performance should be quite high so I'm guessing that high number of object allocations, especially for the deep expression productions (how many nodes does it take to represent a simple string literal?) is hurting performance.


Reply to this email directly or view it on GitHub: https://github.com/tolmasky/language/issues/18

tolmasky avatar Feb 05 '12 00:02 tolmasky

Sure, my SN is chocoflyer.

ide avatar Feb 05 '12 23:02 ide

I'm curious what the latest is here. I am interesting in faster parses. Even a little pointer in the right direction might help with optimization.

anodos avatar Sep 05 '12 13:09 anodos

I have tried Ruby PEG parser generator Parslet, and it takes around 10 seconds to parse a Fortran code with 2000+ lines. This is really slow. So what about this Language.js?

dongli avatar Jul 02 '13 03:07 dongli