Created
June 11, 2011 14:51
-
-
Save rubychan/1020620 to your computer and use it in GitHub Desktop.
Benchmarking String/Regexp/StringScanner multicore performance on Rubinius 2.0.0pre
This file contains hidden or 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
rbx -v | |
rubinius 2.0.0dev (1.8.7 03ecc4ad yyyy-mm-dd JI) [x86_64-apple-darwin10.7.4] | |
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 0m32.890s | |
user 0m32.896s | |
sys 0m0.098s | |
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 0m45.382s | |
user 0m51.918s | |
sys 0m30.008s | |
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 1m15.782s | |
user 1m24.672s | |
sys 0m52.085s | |
String#tr | |
time rbx -e 's = "." * 16_000_000; n = 1; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].tr(".", "-") }}.map(&:join)' | |
real 0m2.749s | |
user 0m2.738s | |
sys 0m0.053s | |
time rbx -e 's = "." * 16_000_000; n = 2; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].tr(".", "-") }}.map(&:join)' | |
real 0m1.815s | |
user 0m3.342s | |
sys 0m0.057s | |
time rbx -e 's = "." * 16_000_000; n = 4; c = s.size / n; (0...n).map { |i| Thread.new { s[c * i, c].tr(".", "-") }}.map(&:join)' | |
real 0m1.444s | |
user 0m4.855s | |
sys 0m0.062s | |
StringScanner#scan | |
time rbx -rstrscan -e 's = "." * 16_000_000; n = 1; c = s.size / n; (0...n).map { |i| Thread.new { sc = StringScanner.new(s[c * i, c]); sc.scan(/./) until sc.eos? }}.map(&:join)' | |
real 0m16.745s | |
user 0m16.750s | |
sys 0m0.052s | |
time rbx -rstrscan -e 's = "." * 16_000_000; n = 2; c = s.size / n; (0...n).map { |i| Thread.new { sc = StringScanner.new(s[c * i, c]); sc.scan(/./) until sc.eos? }}.map(&:join)' | |
real 0m47.403s | |
user 0m36.746s | |
sys 0m36.998s | |
time rbx -rstrscan -e 's = "." * 16_000_000; n = 4; c = s.size / n; (0...n).map { |i| Thread.new { sc = StringScanner.new(s[c * i, c]); sc.scan(/./) until sc.eos? }}.map(&:join)' | |
real 0m57.004s | |
user 0m35.476s | |
sys 0m42.150s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment