32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
|
= ChunkyPNG benchmark suite
|
||
|
|
||
|
This small benchmark suite is intended to test the speed of PNG decoding
|
||
|
and encoding against different ruby interpreters. You can set the number
|
||
|
of runs by passing the N environment variable. You can execute them as
|
||
|
rake task or as standalone script.
|
||
|
|
||
|
rake benchmark:encoding
|
||
|
rake benchmark:decoding
|
||
|
|
||
|
rake benchmark N=10 # Run all of them, using n=10
|
||
|
|
||
|
Use rvm to simply run the tests against different interpreters. Of course,
|
||
|
make sure that the chunky_png is installed for all your interpreters.
|
||
|
|
||
|
rvm 1.8.7,1.9.1,rbx rake benchmark N=10
|
||
|
|
||
|
== Results
|
||
|
|
||
|
Some of my benchmark (N=50) result on my 2007 iMac can be found in this gist:
|
||
|
http://gist.github.com/495323
|
||
|
|
||
|
== Why is this relevant?
|
||
|
|
||
|
ChunkyPNG is a pure Ruby library to handle PNG files. Decoding a PNG requires
|
||
|
a lot of integer math and bitwise operations, and moderate use of the unpack
|
||
|
method to read binary data. Encoding is a good test for Array#pack, and
|
||
|
depending on the encoding options, also requires a lot of calculations.
|
||
|
Therefore, the library is a good benchmark candidate for these methods and
|
||
|
algorithms. It has been used to improve the Array#pack and String#unpack
|
||
|
methods in Rubinius.
|