Skip to content

Conversation

@korny
Copy link
Member

@korny korny commented Aug 31, 2013

  • create less objects during setup
  • cache most recent 100 escaped strings
  • don't extend output unless necessary
  • lazy CSS loading and parsing

Quick benchmarking yields a ~10% speedup for Ruby code:

2.3.0@coderay ~/ruby/coderay:master rake bench
/Users/murphy/.rvm/rubies/ruby-2.3.0/bin/ruby bench/bench.rb ruby html 3000
encoding 3000 kB of ruby code to html...
run 1:  1.69 s, 1774 kB/s
run 2:  1.67 s, 1794 kB/s
run 3:  1.68 s, 1786 kB/s
run 4:  1.66 s, 1805 kB/s
run 5:  1.69 s, 1775 kB/s

2.3.0@coderay ~/ruby/coderay:possible-speedups rake bench
/Users/murphy/.rvm/rubies/ruby-2.3.0/bin/ruby bench/bench.rb ruby html 3000
encoding 3000 kB of ruby code to html...
run 1:  1.49 s, 2010 kB/s
run 2:  1.49 s, 2011 kB/s
run 3:  1.49 s, 2014 kB/s
run 4:  1.50 s, 1994 kB/s
run 5:  1.49 s, 2017 kB/s

@ghost ghost assigned korny Aug 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants