Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Relatively slow performance #22

wycats opened this Issue · 1 comment

2 participants


I have written a JavaScript parser (wycats/parsejs) using kpeg, and get between 15k and 30k bytes per second when parsing JavaScript files. This seems slow and it would be nice to be figure out a way to improve performance.

There is a good sample file in the fixtures in the ParseJS at

Here's a simple benchmark:

require "benchmark"
require "parsejs"

parser ="sizzle.js")) do |x|"sizzle") { parser.parse }

Here is the output I get:

~/Code/parsejs ‹ruby-1.8.7›  ‹master*› $ rvm 1.8.7
~/Code/parsejs ‹ruby-1.8.7›  ‹master*› $ ruby -rubygems benchmark.rb
      user     system      total        real
sizzle  3.790000   0.060000   3.850000 (  3.840110)
~/Code/parsejs ‹ruby-1.8.7›  ‹master*› $ rvm 1.9.3
~/Code/parsejs ‹ruby-1.9.3›  ‹master*› $ ruby -rubygems benchmark.rb
       user     system      total        real
sizzle  1.380000   0.020000   1.400000 (  1.408474)

@wycats What kind of performance were you expecting?

@evanphx Are there some obvious spots we could check out for performance boosts in this lib that you can think of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.