Skip to content

Instantly share code, notes, and snippets.

@alco
Created July 10, 2014 03:31
Show Gist options
  • Save alco/5c086a8d52dbd067f4d2 to your computer and use it in GitHub Desktop.
Save alco/5c086a8d52dbd067f4d2 to your computer and use it in GitHub Desktop.
BenchfellaBench.binary test 10: 10000000 0.13 µs/op
BenchfellaBench.binary test 100: 10000000 0.13 µs/op
BenchfellaBench.binary test: 10000000 0.13 µs/op
BenchfellaBench.binary test 1000: 10000000 0.13 µs/op
BenchfellaBench.range test: 100000 26.93 µs/op
BenchfellaBench.range test 10: 10000 293.43 µs/op
BenchfellaBench.range test 100: 500 3312.59 µs/op
BenchfellaBench.range test 1000: 50 32802.00 µs/op
@str "Some long string here. It should be much longer than this."
@str_10 String.duplicate("Some long string here. It should be much longer than this.", 10)
@str_100 String.duplicate("Some long string here. It should be much longer than this.", 100)
@str_1000 String.duplicate("Some long string here. It should be much longer than this.", 1000)
bench "range test" do
String.slice(@str, 10..-10)
end
bench "binary test" do
binary_part(@str, 10, -10)
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment