Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.19 KB

BENCHMARKS.rdoc

File metadata and controls

31 lines (22 loc) · 1.19 KB

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: 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.