Skip to content

Instantly share code, notes, and snippets.

@djwhitt
Created October 28, 2008 00:47
Show Gist options
  • Save djwhitt/20254 to your computer and use it in GitHub Desktop.
Save djwhitt/20254 to your computer and use it in GitHub Desktop.
Run 1:
Iterations: 1000000
Control: 1m loops accessing a local variable 100 times
0.847393 0.000000 0.847393 ( 0.847421)
0.840755 0.000000 0.840755 ( 0.840760)
Control 2: 1m loops accessing nil 100 times
0.495462 0.000000 0.495462 ( 0.495522)
0.495049 0.000000 0.495049 ( 0.495107)
Test fastmath: 250k loops accessing a fixnum var and calling + 1
0.358267 0.000000 0.358267 ( 0.358325)
0.393006 0.000000 0.393006 ( 0.393000)
Test prim math: 250k loops accessing a fixnum var and calling plus(1)
0.845310 0.000000 0.845310 ( 0.845329)
0.848788 0.000000 0.848788 ( 0.848837)
Test ruby method: 250k loops calling self's foo 100 times
2.096360 0.000000 2.096360 ( 2.096440)
2.203105 0.000000 2.203105 ( 2.203184)
Test ruby method: 250k loops calling self's foo 100 times (with 2 args)
2.339175 0.000000 2.339175 ( 2.339249)
2.383812 0.000000 2.383812 ( 2.383836)
Run 2:
Iterations: 1000000
Control: 1m loops accessing a local variable 100 times
0.844476 0.000000 0.844476 ( 0.844507)
0.855415 0.000000 0.855415 ( 0.850963)
Control 2: 1m loops accessing nil 100 times
0.493506 0.000000 0.493506 ( 0.493521)
0.495026 0.000000 0.495026 ( 0.495016)
Test fastmath: 250k loops accessing a fixnum var and calling + 1
0.358680 0.000000 0.358680 ( 0.358790)
0.360209 0.000000 0.360209 ( 0.360238)
Test prim math: 250k loops accessing a fixnum var and calling plus(1)
0.849852 0.000000 0.849852 ( 0.849939)
0.840111 0.000000 0.840111 ( 0.840122)
Test ruby method: 250k loops calling self's foo 100 times
2.168254 0.000000 2.168254 ( 2.168344)
2.130657 0.000000 2.130657 ( 2.130732)
Test ruby method: 250k loops calling self's foo 100 times (with 2 args)
2.326827 0.000000 2.326827 ( 2.326910)
2.397036 0.000000 2.397036 ( 2.397144)
=================
Run 1:
Iterations: 1000000
Control: 1m loops accessing a local variable 100 times
0.824054 0.000000 0.824054 ( 0.824012)
0.838948 0.000000 0.838948 ( 0.838945)
Control 2: 1m loops accessing nil 100 times
0.520200 0.000000 0.520200 ( 0.520210)
0.498794 0.000000 0.498794 ( 0.498769)
Test fastmath: 250k loops accessing a fixnum var and calling + 1
0.359891 0.000000 0.359891 ( 0.359900)
0.360113 0.000000 0.360113 ( 0.360108)
Test prim math: 250k loops accessing a fixnum var and calling plus(1)
0.830619 0.000000 0.830619 ( 0.830636)
0.890041 0.000000 0.890041 ( 0.890039)
Test ruby method: 250k loops calling self's foo 100 times
2.055977 0.000000 2.055977 ( 2.056009)
1.917242 0.000000 1.917242 ( 1.917245)
Test ruby method: 250k loops calling self's foo 100 times (with 2 args)
2.190398 0.000000 2.190398 ( 2.190405)
2.177537 0.000000 2.177537 ( 2.177547)
Run 2:
Iterations: 1000000
Control: 1m loops accessing a local variable 100 times
0.840021 0.000000 0.840021 ( 0.839996)
0.838350 0.000000 0.838350 ( 0.838343)
Control 2: 1m loops accessing nil 100 times
0.492788 0.000000 0.492788 ( 0.492794)
0.520179 0.000000 0.520179 ( 0.520164)
Test fastmath: 250k loops accessing a fixnum var and calling + 1
0.357589 0.000000 0.357589 ( 0.357589)
0.398949 0.000000 0.398949 ( 0.399003)
Test prim math: 250k loops accessing a fixnum var and calling plus(1)
0.821007 0.000000 0.821007 ( 0.821015)
0.818164 0.000000 0.818164 ( 0.818236)
Test ruby method: 250k loops calling self's foo 100 times
1.879010 0.000000 1.879010 ( 1.879084)
1.850814 0.000000 1.850814 ( 1.850801)
Test ruby method: 250k loops calling self's foo 100 times (with 2 args)
2.152778 0.000000 2.152778 ( 2.152789)
2.162824 0.000000 2.162824 ( 2.162840)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment