-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hi, I don't know if this is the right place to post it, but I'm trying to compare mini_mime vs marcel regarding looking up by extension, because I think both gems cover the same space. I was trying to compare the number of extensions registered, the performance and memory consumption of every gem.
mini_mime |
marcel |
|
|---|---|---|
| #extensions | File.open(MiniMime::Configuration.ext_db_path).readlines.count => 1196 |
Marcel::EXTENSIONS.count => 1243 |
Regarding memory handling, mini_mime has a hash cache of 200 rows and misses are binary-searched from a file while marcel loads all records in a hash in memory. Is not reading from a file less performant than loading everything in memory? Loading everything in memory consumes more memory obviously, but the gain in performance outweighs the memory consumption, in my opinion.
Also I noticed that both DBs in mini_mime contain similar data but is there any reason why are not both DBs merged removing duplicates? I saw that when merging both files the number of rows/extensions is 1210, but I'm not completely sure if it's due to an error removing duplicates:
irb(main)> File.readlines(MiniMime::Configuration.ext_db_path).each do |line|
irb(main)* s << line.strip
irb(main)> end
irb(main)> File.readlines(MiniMime::Configuration.content_type_db_path).each do |line|
irb(main)* s << line.strip
irb(main)> end
irb(main)> s.length
=> 1210