Skip to content

Instantly share code, notes, and snippets.

@rubychan
Created June 11, 2011 16:25
Show Gist options
  • Save rubychan/1020723 to your computer and use it in GitHub Desktop.
Save rubychan/1020723 to your computer and use it in GitHub Desktop.
Benchmarking Regexp multicore performance on Rubinius 2.0.0pre with removed onig_lock
rbx -v
rubinius 2.0.0dev (1.8.7 03ecc4ad yyyy-mm-dd JI) [x86_64-apple-darwin10.7.4]
with patch https://gist.github.com/1020720
String#gsub
time rbx -e 's = "." * 16_000_000; n = 1; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].gsub(".", "-") }}.map(&:join)'
real 0m33.407s
user 0m33.437s
sys 0m0.074s
time rbx -e 's = "." * 16_000_000; n = 2; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].gsub(".", "-") }}.map(&:join)'
real 0m23.163s
user 0m41.998s
sys 0m2.463s
time rbx -e 's = "." * 16_000_000; n = 3; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].gsub(".", "-") }}.map(&:join)'
real 0m23.963s
user 0m58.010s
sys 0m7.356s
time rbx -e 's = "." * 16_000_000; n = 4; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].gsub(".", "-") }}.map(&:join)'
real 0m51.476s
user 1m38.169s
sys 0m49.303s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment