Accessor Generator Benchmarks
Here is the output of the tests run by App::Benchmark::Accessors. I will update the page from time to time as new versions of the accessor generators are released. Object constructions, getters and setters are benchmarked separately. You can find the module versions at the bottom of the page.
Mon Feb 16 13:06:15 CET 2009
---------------------------------------------------------------------------
Constructors
---------------------------------------------------------------------------
# Benchmark:
# timing 200000 iterations of
# class_accessor, class_accessor_complex, class_accessor_constructor, class_accessor_fast, class_accessor_fast_xs, class_methodmaker, class_spiffy, class_xsaccessor, class_xsaccessor_array, mojo, moose, moose_immutable, mouse, mouse_immutable, object_tiny, object_tiny_xs, rose, spiffy
# ...
# class_accessor:
# 0.555518 wallclock secs ( 0.55 usr + 0.00 sys = 0.55 CPU) @ 363636.36/s (n=200000)
# class_accessor_complex:
# 0.828861 wallclock secs ( 0.82 usr + 0.00 sys = 0.82 CPU) @ 243902.44/s (n=200000)
# class_accessor_constructor:
# 1.98194 wallclock secs ( 1.95 usr + 0.01 sys = 1.96 CPU) @ 102040.82/s (n=200000)
# class_accessor_fast:
# 0.567316 wallclock secs ( 0.56 usr + -0.01 sys = 0.55 CPU) @ 363636.36/s (n=200000)
# class_accessor_fast_xs:
# 0.589232 wallclock secs ( 0.57 usr + 0.01 sys = 0.58 CPU) @ 344827.59/s (n=200000)
# class_methodmaker:
# 0.965418 wallclock secs ( 0.94 usr + 0.01 sys = 0.95 CPU) @ 210526.32/s (n=200000)
# class_spiffy:
# 0.384012 wallclock secs ( 0.37 usr + 0.00 sys = 0.37 CPU) @ 540540.54/s (n=200000)
# (warning: too few iterations for a reliable count)
# class_xsaccessor:
# 0.303101 wallclock secs ( 0.29 usr + 0.00 sys = 0.29 CPU) @ 689655.17/s (n=200000)
# (warning: too few iterations for a reliable count)
# class_xsaccessor_array:
# 0.413084 wallclock secs ( 0.40 usr + 0.00 sys = 0.40 CPU) @ 500000.00/s (n=200000)
# mojo:
# 0.409348 wallclock secs ( 0.40 usr + 0.00 sys = 0.40 CPU) @ 500000.00/s (n=200000)
# moose:
# 19.8137 wallclock secs (18.98 usr + 0.16 sys = 19.14 CPU) @ 10449.32/s (n=200000)
# moose_immutable:
# 1.17588 wallclock secs ( 1.05 usr + 0.01 sys = 1.06 CPU) @ 188679.25/s (n=200000)
# mouse:
# 9.63115 wallclock secs ( 9.31 usr + 0.08 sys = 9.39 CPU) @ 21299.25/s (n=200000)
# mouse_immutable:
# 0.979609 wallclock secs ( 0.96 usr + 0.00 sys = 0.96 CPU) @ 208333.33/s (n=200000)
# object_tiny:
# 0.289916 wallclock secs ( 0.27 usr + -0.01 sys = 0.26 CPU) @ 769230.77/s (n=200000)
# (warning: too few iterations for a reliable count)
# object_tiny_xs:
# 0.279443 wallclock secs ( 0.27 usr + 0.01 sys = 0.28 CPU) @ 714285.71/s (n=200000)
# (warning: too few iterations for a reliable count)
# rose:
# 0.46384 wallclock secs ( 0.45 usr + 0.00 sys = 0.45 CPU) @ 444444.44/s (n=200000)
# spiffy:
# 0.361456 wallclock secs ( 0.35 usr + 0.00 sys = 0.35 CPU) @ 571428.57/s (n=200000)
# (warning: too few iterations for a reliable count)
# Rate moose mouse class_accessor_constructor moose_immutable mouse_immutable class_methodmaker class_accessor_complex class_accessor_fast_xs class_accessor class_accessor_fast rose class_xsaccessor_array mojo class_spiffy spiffy class_xsaccessor object_tiny_xs object_tiny
# moose 10449/s -- -51% -90% -94% -95% -95% -96% -97% -97% -97% -98% -98% -98% -98% -98% -98% -99% -99%
# mouse 21299/s 104% -- -79% -89% -90% -90% -91% -94% -94% -94% -95% -96% -96% -96% -96% -97% -97% -97%
# class_accessor_constructor 102041/s 877% 379% -- -46% -51% -52% -58% -70% -72% -72% -77% -80% -80% -81% -82% -85% -86% -87%
# moose_immutable 188679/s 1706% 786% 85% -- -9% -10% -23% -45% -48% -48% -58% -62% -62% -65% -67% -73% -74% -75%
# mouse_immutable 208333/s 1894% 878% 104% 10% -- -1% -15% -40% -43% -43% -53% -58% -58% -61% -64% -70% -71% -73%
# class_methodmaker 210526/s 1915% 888% 106% 12% 1% -- -14% -39% -42% -42% -53% -58% -58% -61% -63% -69% -71% -73%
# class_accessor_complex 243902/s 2234% 1045% 139% 29% 17% 16% -- -29% -33% -33% -45% -51% -51% -55% -57% -65% -66% -68%
# class_accessor_fast_xs 344828/s 3200% 1519% 238% 83% 66% 64% 41% -- -5% -5% -22% -31% -31% -36% -40% -50% -52% -55%
# class_accessor 363636/s 3380% 1607% 256% 93% 75% 73% 49% 5% -- -0% -18% -27% -27% -33% -36% -47% -49% -53%
# class_accessor_fast 363636/s 3380% 1607% 256% 93% 75% 73% 49% 5% 0% -- -18% -27% -27% -33% -36% -47% -49% -53%
# rose 444444/s 4153% 1987% 336% 136% 113% 111% 82% 29% 22% 22% -- -11% -11% -18% -22% -36% -38% -42%
# class_xsaccessor_array 500000/s 4685% 2247% 390% 165% 140% 137% 105% 45% 37% 37% 12% -- 0% -8% -12% -27% -30% -35%
# mojo 500000/s 4685% 2247% 390% 165% 140% 137% 105% 45% 37% 37% 12% 0% -- -8% -12% -27% -30% -35%
# class_spiffy 540541/s 5073% 2438% 430% 186% 159% 157% 122% 57% 49% 49% 22% 8% 8% -- -5% -22% -24% -30%
# spiffy 571429/s 5369% 2583% 460% 203% 174% 171% 134% 66% 57% 57% 29% 14% 14% 6% -- -17% -20% -26%
# class_xsaccessor 689655/s 6500% 3138% 576% 266% 231% 228% 183% 100% 90% 90% 55% 38% 38% 28% 21% -- -3% -10%
# object_tiny_xs 714286/s 6736% 3254% 600% 279% 243% 239% 193% 107% 96% 96% 61% 43% 43% 32% 25% 4% -- -7%
# object_tiny 769231/s 7262% 3512% 654% 308% 269% 265% 215% 123% 112% 112% 73% 54% 54% 42% 35% 12% 8% --
1..1
ok 1 - benchmark
---------------------------------------------------------------------------
Getters
---------------------------------------------------------------------------
# Benchmark:
# timing 2000000 iterations of
# accessors, class_accessor, class_accessor_complex, class_accessor_constructor, class_accessor_fast, class_accessor_fast_xs, class_methodmaker, class_spiffy, class_xsaccessor, class_xsaccessor_array, mojo, moose, moose_immutable, mouse, mouse_immutable, object_tiny, object_tiny_xs, rose, rubyish_attribute, spiffy
# ...
# accessors:
# 1.23336 wallclock secs ( 1.13 usr + 0.02 sys = 1.15 CPU) @ 1739130.43/s (n=2000000)
# class_accessor:
# 3.10829 wallclock secs ( 3.05 usr + 0.02 sys = 3.07 CPU) @ 651465.80/s (n=2000000)
# class_accessor_complex:
# 1.54675 wallclock secs ( 1.49 usr + 0.02 sys = 1.51 CPU) @ 1324503.31/s (n=2000000)
# class_accessor_constructor:
# 1.59557 wallclock secs ( 1.56 usr + 0.02 sys = 1.58 CPU) @ 1265822.78/s (n=2000000)
# class_accessor_fast:
# 1.28702 wallclock secs ( 1.25 usr + 0.00 sys = 1.25 CPU) @ 1600000.00/s (n=2000000)
# class_accessor_fast_xs:
# 0.487298 wallclock secs ( 0.42 usr + 0.00 sys = 0.42 CPU) @ 4761904.76/s (n=2000000)
# class_methodmaker:
# 1.16605 wallclock secs ( 1.19 usr + 0.01 sys = 1.20 CPU) @ 1666666.67/s (n=2000000)
# class_spiffy:
# 1.5126 wallclock secs ( 1.43 usr + 0.02 sys = 1.45 CPU) @ 1379310.34/s (n=2000000)
# class_xsaccessor:
# 0.535195 wallclock secs ( 0.42 usr + 0.00 sys = 0.42 CPU) @ 4761904.76/s (n=2000000)
# class_xsaccessor_array:
# 0.3835 wallclock secs ( 0.38 usr + 0.00 sys = 0.38 CPU) @ 5263157.89/s (n=2000000)
# (warning: too few iterations for a reliable count)
# mojo:
# 1.2516 wallclock secs ( 1.23 usr + 0.01 sys = 1.24 CPU) @ 1612903.23/s (n=2000000)
# moose:
# 1.32011 wallclock secs ( 1.29 usr + 0.00 sys = 1.29 CPU) @ 1550387.60/s (n=2000000)
# moose_immutable:
# 1.28589 wallclock secs ( 1.25 usr + 0.02 sys = 1.27 CPU) @ 1574803.15/s (n=2000000)
# mouse:
# 1.40898 wallclock secs ( 1.27 usr + 0.02 sys = 1.29 CPU) @ 1550387.60/s (n=2000000)
# mouse_immutable:
# 1.26278 wallclock secs ( 1.23 usr + -0.01 sys = 1.22 CPU) @ 1639344.26/s (n=2000000)
# object_tiny:
# 1.0897 wallclock secs ( 0.97 usr + 0.01 sys = 0.98 CPU) @ 2040816.33/s (n=2000000)
# object_tiny_xs:
# 0.424792 wallclock secs ( 0.42 usr + 0.01 sys = 0.43 CPU) @ 4651162.79/s (n=2000000)
# rose:
# 0.414504 wallclock secs ( 0.41 usr + 0.00 sys = 0.41 CPU) @ 4878048.78/s (n=2000000)
# rubyish_attribute:
# 1.84554 wallclock secs ( 1.82 usr + 0.00 sys = 1.82 CPU) @ 1098901.10/s (n=2000000)
# spiffy:
# 1.4798 wallclock secs ( 1.47 usr + 0.01 sys = 1.48 CPU) @ 1351351.35/s (n=2000000)
# Rate class_accessor rubyish_attribute class_accessor_constructor class_accessor_complex spiffy class_spiffy mouse moose moose_immutable class_accessor_fast mojo mouse_immutable class_methodmaker accessors object_tiny object_tiny_xs class_xsaccessor class_accessor_fast_xs rose class_xsaccessor_array
# class_accessor 651466/s -- -41% -49% -51% -52% -53% -58% -58% -59% -59% -60% -60% -61% -63% -68% -86% -86% -86% -87% -88%
# rubyish_attribute 1098901/s 69% -- -13% -17% -19% -20% -29% -29% -30% -31% -32% -33% -34% -37% -46% -76% -77% -77% -77% -79%
# class_accessor_constructor 1265823/s 94% 15% -- -4% -6% -8% -18% -18% -20% -21% -22% -23% -24% -27% -38% -73% -73% -73% -74% -76%
# class_accessor_complex 1324503/s 103% 21% 5% -- -2% -4% -15% -15% -16% -17% -18% -19% -21% -24% -35% -72% -72% -72% -73% -75%
# spiffy 1351351/s 107% 23% 7% 2% -- -2% -13% -13% -14% -16% -16% -18% -19% -22% -34% -71% -72% -72% -72% -74%
# class_spiffy 1379310/s 112% 26% 9% 4% 2% -- -11% -11% -12% -14% -14% -16% -17% -21% -32% -70% -71% -71% -72% -74%
# mouse 1550388/s 138% 41% 22% 17% 15% 12% -- -0% -2% -3% -4% -5% -7% -11% -24% -67% -67% -67% -68% -71%
# moose 1550388/s 138% 41% 22% 17% 15% 12% 0% -- -2% -3% -4% -5% -7% -11% -24% -67% -67% -67% -68% -71%
# moose_immutable 1574803/s 142% 43% 24% 19% 17% 14% 2% 2% -- -2% -2% -4% -6% -9% -23% -66% -67% -67% -68% -70%
# class_accessor_fast 1600000/s 146% 46% 26% 21% 18% 16% 3% 3% 2% -- -1% -2% -4% -8% -22% -66% -66% -66% -67% -70%
# mojo 1612903/s 148% 47% 27% 22% 19% 17% 4% 4% 2% 1% -- -2% -3% -7% -21% -65% -66% -66% -67% -69%
# mouse_immutable 1639344/s 152% 49% 30% 24% 21% 19% 6% 6% 4% 2% 2% -- -2% -6% -20% -65% -66% -66% -66% -69%
# class_methodmaker 1666667/s 156% 52% 32% 26% 23% 21% 8% 7% 6% 4% 3% 2% -- -4% -18% -64% -65% -65% -66% -68%
# accessors 1739130/s 167% 58% 37% 31% 29% 26% 12% 12% 10% 9% 8% 6% 4% -- -15% -63% -63% -63% -64% -67%
# object_tiny 2040816/s 213% 86% 61% 54% 51% 48% 32% 32% 30% 28% 27% 24% 22% 17% -- -56% -57% -57% -58% -61%
# object_tiny_xs 4651163/s 614% 323% 267% 251% 244% 237% 200% 200% 195% 191% 188% 184% 179% 167% 128% -- -2% -2% -5% -12%
# class_xsaccessor 4761905/s 631% 333% 276% 260% 252% 245% 207% 207% 202% 198% 195% 190% 186% 174% 133% 2% -- -0% -2% -10%
# class_accessor_fast_xs 4761905/s 631% 333% 276% 260% 252% 245% 207% 207% 202% 198% 195% 190% 186% 174% 133% 2% 0% -- -2% -10%
# rose 4878049/s 649% 344% 285% 268% 261% 254% 215% 215% 210% 205% 202% 198% 193% 180% 139% 5% 2% 2% -- -7%
# class_xsaccessor_array 5263158/s 708% 379% 316% 297% 289% 282% 239% 239% 234% 229% 226% 221% 216% 203% 158% 13% 11% 11% 8% --
1..1
ok 1 - benchmark
---------------------------------------------------------------------------
Setters
---------------------------------------------------------------------------
# Benchmark:
# timing 2000000 iterations of
# accessors, class_accessor, class_accessor_complex, class_accessor_constructor, class_accessor_fast, class_accessor_fast_xs, class_methodmaker, class_spiffy, class_xsaccessor, class_xsaccessor_array, mojo, moose, moose_immutable, mouse, mouse_immutable, object_tiny_xs, rose, rubyish_attribute, spiffy
# ...
# accessors:
# 1.60089 wallclock secs ( 1.56 usr + 0.01 sys = 1.57 CPU) @ 1273885.35/s (n=2000000)
# class_accessor:
# 3.97293 wallclock secs ( 3.89 usr + 0.03 sys = 3.92 CPU) @ 510204.08/s (n=2000000)
# class_accessor_complex:
# 1.99346 wallclock secs ( 1.97 usr + 0.00 sys = 1.97 CPU) @ 1015228.43/s (n=2000000)
# class_accessor_constructor:
# 1.98776 wallclock secs ( 1.96 usr + 0.00 sys = 1.96 CPU) @ 1020408.16/s (n=2000000)
# class_accessor_fast:
# 1.7086 wallclock secs ( 1.69 usr + 0.01 sys = 1.70 CPU) @ 1176470.59/s (n=2000000)
# class_accessor_fast_xs:
# 0.654968 wallclock secs ( 0.64 usr + -0.01 sys = 0.63 CPU) @ 3174603.17/s (n=2000000)
# class_methodmaker:
# 1.72113 wallclock secs ( 1.69 usr + 0.02 sys = 1.71 CPU) @ 1169590.64/s (n=2000000)
# class_spiffy:
# 2.0741 wallclock secs ( 2.05 usr + 0.01 sys = 2.06 CPU) @ 970873.79/s (n=2000000)
# class_xsaccessor:
# 0.70426 wallclock secs ( 0.69 usr + 0.00 sys = 0.69 CPU) @ 2898550.72/s (n=2000000)
# class_xsaccessor_array:
# 0.663495 wallclock secs ( 0.65 usr + 0.01 sys = 0.66 CPU) @ 3030303.03/s (n=2000000)
# mojo:
# 1.67389 wallclock secs ( 1.48 usr + 0.00 sys = 1.48 CPU) @ 1351351.35/s (n=2000000)
# moose:
# 1.87166 wallclock secs ( 1.83 usr + 0.02 sys = 1.85 CPU) @ 1081081.08/s (n=2000000)
# moose_immutable:
# 1.86533 wallclock secs ( 1.83 usr + 0.00 sys = 1.83 CPU) @ 1092896.17/s (n=2000000)
# mouse:
# 1.50942 wallclock secs ( 1.47 usr + -0.01 sys = 1.46 CPU) @ 1369863.01/s (n=2000000)
# mouse_immutable:
# 1.38691 wallclock secs ( 1.37 usr + -0.01 sys = 1.36 CPU) @ 1470588.24/s (n=2000000)
# object_tiny_xs:
# 0.676744 wallclock secs ( 0.67 usr + -0.01 sys = 0.66 CPU) @ 3030303.03/s (n=2000000)
# rose:
# 0.656403 wallclock secs ( 0.65 usr + 0.01 sys = 0.66 CPU) @ 3030303.03/s (n=2000000)
# rubyish_attribute:
# 2.07147 wallclock secs ( 2.06 usr + 0.00 sys = 2.06 CPU) @ 970873.79/s (n=2000000)
# spiffy:
# 2.18075 wallclock secs ( 2.15 usr + 0.01 sys = 2.16 CPU) @ 925925.93/s (n=2000000)
# Rate class_accessor spiffy class_spiffy rubyish_attribute class_accessor_complex class_accessor_constructor moose moose_immutable class_methodmaker class_accessor_fast accessors mojo mouse mouse_immutable class_xsaccessor object_tiny_xs rose class_xsaccessor_array class_accessor_fast_xs
# class_accessor 510204/s -- -45% -47% -47% -50% -50% -53% -53% -56% -57% -60% -62% -63% -65% -82% -83% -83% -83% -84%
# spiffy 925926/s 81% -- -5% -5% -9% -9% -14% -15% -21% -21% -27% -31% -32% -37% -68% -69% -69% -69% -71%
# class_spiffy 970874/s 90% 5% -- -0% -4% -5% -10% -11% -17% -17% -24% -28% -29% -34% -67% -68% -68% -68% -69%
# rubyish_attribute 970874/s 90% 5% 0% -- -4% -5% -10% -11% -17% -17% -24% -28% -29% -34% -67% -68% -68% -68% -69%
# class_accessor_complex 1015228/s 99% 10% 5% 5% -- -1% -6% -7% -13% -14% -20% -25% -26% -31% -65% -66% -66% -66% -68%
# class_accessor_constructor 1020408/s 100% 10% 5% 5% 1% -- -6% -7% -13% -13% -20% -24% -26% -31% -65% -66% -66% -66% -68%
# moose 1081081/s 112% 17% 11% 11% 6% 6% -- -1% -8% -8% -15% -20% -21% -26% -63% -64% -64% -64% -66%
# moose_immutable 1092896/s 114% 18% 13% 13% 8% 7% 1% -- -7% -7% -14% -19% -20% -26% -62% -64% -64% -64% -66%
# class_methodmaker 1169591/s 129% 26% 20% 20% 15% 15% 8% 7% -- -1% -8% -13% -15% -20% -60% -61% -61% -61% -63%
# class_accessor_fast 1176471/s 131% 27% 21% 21% 16% 15% 9% 8% 1% -- -8% -13% -14% -20% -59% -61% -61% -61% -63%
# accessors 1273885/s 150% 38% 31% 31% 25% 25% 18% 17% 9% 8% -- -6% -7% -13% -56% -58% -58% -58% -60%
# mojo 1351351/s 165% 46% 39% 39% 33% 32% 25% 24% 16% 15% 6% -- -1% -8% -53% -55% -55% -55% -57%
# mouse 1369863/s 168% 48% 41% 41% 35% 34% 27% 25% 17% 16% 8% 1% -- -7% -53% -55% -55% -55% -57%
# mouse_immutable 1470588/s 188% 59% 51% 51% 45% 44% 36% 35% 26% 25% 15% 9% 7% -- -49% -51% -51% -51% -54%
# class_xsaccessor 2898551/s 468% 213% 199% 199% 186% 184% 168% 165% 148% 146% 128% 114% 112% 97% -- -4% -4% -4% -9%
# object_tiny_xs 3030303/s 494% 227% 212% 212% 198% 197% 180% 177% 159% 158% 138% 124% 121% 106% 5% -- -0% -0% -5%
# rose 3030303/s 494% 227% 212% 212% 198% 197% 180% 177% 159% 158% 138% 124% 121% 106% 5% 0% -- 0% -5%
# class_xsaccessor_array 3030303/s 494% 227% 212% 212% 198% 197% 180% 177% 159% 158% 138% 124% 121% 106% 5% 0% 0% -- -5%
# class_accessor_fast_xs 3174603/s 522% 243% 227% 227% 213% 211% 194% 190% 171% 170% 149% 135% 132% 116% 10% 5% 5% 5% --
1..1
ok 1 - benchmark
---------------------------------------------------------------------------
Versions
---------------------------------------------------------------------------
1..1
# Class::Accessor v0.31
# Class::Accessor::Complex v0.15
# Class::Accessor::Constructor v0.07
# Class::Accessor::Fast v0.31
# Class::Accessor::Fast::XS v0.02
# Class::MethodMaker v2.15
# Class::Spiffy v0.15
# Class::XSAccessor v0.14
# Class::XSAccessor::Array v0.14
# Mojo::Base v-1, set by base.pm
# Moose v0.7
# Mouse v0.16
# Object::Tiny v1.06
# Rose::Object v0.855
# Rubyish::Attribute v1.0
# Spiffy v0.30
# accessors v1.01
ok 1 - versions