rubychan / coderay

Fast and easy syntax highlighting for selected languages, written in Ruby.
http://coderay.rubychan.de/
Other
847 stars 115 forks source link

Speed up HTML encoder for 1.2 #153

Open korny opened 11 years ago

korny commented 11 years ago

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