discourse / mini_mime

minimal mime type library
MIT License
95 stars 34 forks source link

How about updating benchmark report? #18

Closed ohbarye closed 5 years ago

ohbarye commented 5 years ago

Hello maintainers. This is a kind of suggestion.

I was just curious about the performance report in README (seems it's written 2 years ago) would be still appropriate for the latest versions. So I tried running the benchmark script with the following versions.

Performance Test

Memory stats for requiring mime/types/columnar
Total allocated: 8686910 bytes (102917 objects)
Total retained:  3156016 bytes (33593 objects)

Memory stats for requiring mini_mime
Total allocated: 41064 bytes (362 objects)
Total retained:  7156 bytes (60 objects)
Warming up --------------------------------------
cached content_type lookup MiniMime
                        72.481k i/100ms
content_type lookup MIME::Types
                        13.284k i/100ms
Calculating -------------------------------------
cached content_type lookup MiniMime
                        914.838k (± 1.3%) i/s -      4.639M in   5.071456s
content_type lookup MIME::Types
                        140.215k (± 3.4%) i/s -    704.052k in   5.026273s
Warming up --------------------------------------
uncached content_type lookup MiniMime
                         1.329k i/100ms
content_type lookup MIME::Types
                        13.225k i/100ms
Calculating -------------------------------------
uncached content_type lookup MiniMime
                         13.338k (± 1.7%) i/s -     67.779k in   5.083373s
content_type lookup MIME::Types
                        139.626k (± 4.2%) i/s -    700.925k in   5.027074s

You wrote like below in the README,

As a general guideline, cached lookups are 2x faster than MIME::Types equivalent. Uncached lookups are 10x slower.

but now that cached lookups seems 6x faster, how about updating the report? I'm okay to update the README by myself with sending a pull request if you're fine.

SamSaffron commented 5 years ago

Sure, if you wish to update the benchmarks on the readme go for it, be sure to specify what type of machine it was run on.