This is a very simple, self-contained (well, except for benchmark-ips
) benchmark. Conceptually, it does the following:
- Create an array-of-arrays, each element being a 20-element array of integers
- Write it out to a file as JSON
- Write it out to a gzipped file as JSON
- Read them both back in as strings
- Compare how long it takes to JSON.parse the never-gzipped (plain) string vs the previously-gzipped string
Usage via slow_gzip_bench.rb -h