Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Relatively slow performance #22

Closed
wycats opened this Issue Jan 17, 2012 · 2 comments

Comments

Projects
None yet
3 participants

wycats commented Jan 17, 2012

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 https://github.com/wycats/parsejs/blob/master/spec/fixtures/sizzle.js

Here's a simple benchmark:

require "benchmark"
require "parsejs"

parser = ParseJS::Parser.new(File.read("sizzle.js"))

Benchmark.bm do |x|
  x.report("sizzle") { parser.parse }
end

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)

mrb commented Apr 23, 2012

@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?

Owner

evanphx commented Apr 7, 2016

It's still not as fast as it could be. PEGs aren't usually super fast, but it could be profiled.

@evanphx evanphx closed this Apr 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment