File: BENCHMARKING.rdoc [chunky_png-1.3.4 Documentation]

### Home Classes Methods

### Files

- BENCHMARKING.rdoc
- CHANGELOG.rdoc
- CONTRIBUTING.rdoc
- README.rdoc

### Class Index

Quicksearch

- ChunkyPNG
- ChunkyPNG::CRCMismatch
- ChunkyPNG::Canvas
- ChunkyPNG::Canvas::Adam7Interlacing
- ChunkyPNG::Canvas::DataUrlExporting
- ChunkyPNG::Canvas::DataUrlImporting
- ChunkyPNG::Canvas::Drawing
- ChunkyPNG::Canvas::Masking
- ChunkyPNG::Canvas::Operations
- ChunkyPNG::Canvas::PNGDecoding
- ChunkyPNG::Canvas::PNGEncoding
- ChunkyPNG::Canvas::Resampling
- ChunkyPNG::Canvas::StreamExporting
- ChunkyPNG::Canvas::StreamImporting
- ChunkyPNG::Chunk
- ChunkyPNG::Chunk::Base
- ChunkyPNG::Chunk::CompressedText
- ChunkyPNG::Chunk::End
- ChunkyPNG::Chunk::Generic
- ChunkyPNG::Chunk::Header
- ChunkyPNG::Chunk::ImageData
- ChunkyPNG::Chunk::InternationalText
- ChunkyPNG::Chunk::Palette
- ChunkyPNG::Chunk::Text
- ChunkyPNG::Chunk::Transparency
- ChunkyPNG::Color
- ChunkyPNG::Datastream
- ChunkyPNG::Dimension
- ChunkyPNG::Exception
- ChunkyPNG::ExpectationFailed
- ChunkyPNG::Image
- ChunkyPNG::NotSupported
- ChunkyPNG::OutOfBounds
- ChunkyPNG::Palette
- ChunkyPNG::Point
- ChunkyPNG::RMagick
- ChunkyPNG::SignatureMismatch
- ChunkyPNG::Vector
- Enumerable
- String

No matching classes.

# ChunkyPNG benchmark suite

I would like the performance of this library as good as possible, and I will gladly accept changes to this library that improves performance.

The library comes with a basic benchmark suite is intended to test the speed of PNG decoding and encoding against different ruby interpreters. Execute them using rake. You can set the number of runs by passing the N environment variable.

    bundle exec rake benchmark:encoding
    bundle exec rake benchmark:decoding

    bundle exec rake benchmark N=10      # Run all of them with 10 iterations

You can use rvm to run the benchmarks against different interpreters. Of course, make sure that the chunky_png is installed for all your interpreters.

    rvm 1.8.7,1.9.3,rbx bundle exec rake benchmark N=10

## Results

What is a speed improvement on one interpreter doesn't necessarily mean the performance will be better on other interpreters as well. Please make sure to benchamrk different RUby interpreters. When it comes to different Ruby interpreters, the priority is the performance on recent MRI versions.

Some very old benchmark result (using `N=50`) on my 2007 iMac can be found at gist.github.com/wvanbergen/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.

[Validate]

Generated with the Darkfish Rdoc Generator 2.