Created
February 21, 2012 15:16
-
-
Save marekjelen/1876985 to your computer and use it in GitHub Desktop.
Pygments for Ruby (benchmark)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pygmentize' | |
require 'pygments.rb' | |
code = <<EOF | |
require 'sinatra' | |
get '/hi' do | |
"Hello World!" | |
end | |
EOF | |
start = Time.now | |
100.times do | |
Pygmentize.process(code, :ruby) | |
end | |
puts Time.now - start | |
start = Time.now | |
100.times do | |
Pygments.highlight(code, :lexer => 'ruby') | |
end | |
puts Time.now - start | |
__END__ | |
marek@homer ~ (ruby-1.9.3-p0) ∙ → ruby pyg.rb | |
21.000688 | |
0.609097 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment