Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Speed up HTML encoder for 1.2#153

Open
korny wants to merge 19 commits intomaster from
possible-speedups
Open

Speed up HTML encoder for 1.2 #153
korny wants to merge 19 commits intomaster from
possible-speedups

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

Reviewers

No reviews

Projects

None yet

Milestone

1.2

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /