Skip to content

Instantly share code, notes, and snippets.

@aarongough
Created October 14, 2010 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarongough/626522 to your computer and use it in GitHub Desktop.
Save aarongough/626522 to your computer and use it in GitHub Desktop.
require 'benchmark'
require 'sexpistol'
require 'sxp'
example_sexp = <<-EOD
((display "This is a test string!")
(define test (lambda () (begin
(display (== 1 1))
(display (== true true))
(display (== false false))
(display (== nil nil))
(display (== 2.09 1.08))
(display (== 2e6 2e12))
))))
EOD
Benchmark.bmbm do |b|
b.report("Sexpistol") do
parser = Sexpistol.new
5000.times do
test = parser.parse_string(example_sexp)
end
end
b.report("SXP") do
5000.times do
test = SXP.read(example_sexp)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment