Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.6 #101

Merged
merged 5 commits into from
May 25, 2015
Merged

Release 2.6 #101

merged 5 commits into from
May 25, 2015

Conversation

halostatue
Copy link
Member

Fixes #83 (Decrease Memory Usage).
Fixes #84 (Requiring mime/types accounts for 2% of all application RAM).
Based on and Fixes #96.

jeremyevans and others added 5 commits May 25, 2015 00:39
This changes the default data for mime-types from a JSON file to a set of text
files, with one line per mime type, and one file per mime type attribute. This
only loads the content_type and extensions for mime-types by default, reducing
default memory usage of mime-types from over 22MB to just over 2MB.
Additionally, it speeds up requiring from 0.38 seconds to about 0.10 seconds.

Even when loading all of the attributes for the mime types, the memory usage of
mime-types stays under 11MB, though load time increases to 0.52 seconds. I
think that is an acceptable trade off.

If the txt files are shipped instead of the json file, there is also a disk
space savings of 167KB (392KB instead of 560KB).

rake convert:yaml:txt has been added for converting the yaml files to the
necessary txt files. In order to get the conversion to work, I had to make
convert.rb turn on lazy loading for mime types.

This should be completely backwards compatible if a path is given containing
the types. The only current backwards compatibility difference is for the
"text/directory - DEPRECATED by RFC6350" mime type, which looks to me like an
invalid mime type anyway, and probably should be removed.

* Pool encoding strings. Use a single string for each encoding. This decreases
  the number of encoding strings stored by default from 1909 to 4, saving about
  700KB of memory by default on 64-bit MRI.

* While here, reduce object allocations while loading data from the mime type
  txt files.

* Clear cache file in lazy test. This was causing the test-order dependent bug
  on JRuby. The clear_cache_file code was taken from the cache test.
- For mime-types 2.6, columnar support is opt-in and will not be changed to
  default until mime-types 3.0. Restore JSON by default with
  mime/types/columnar for enabling it.

- Rename from .txt to .column; fix some of the type errors in conversion caused
  by previously undetected bad data.

- Keep the PATH protocol even though none of the Linux distributions are using
  it now.

- Fix up the conversion method and benchmarking.
- Extend documentation.
- Add a logger and logger configuration.
- Add more tests to Travis.
- Update MIME registry.
@halostatue halostatue self-assigned this May 25, 2015
halostatue added a commit that referenced this pull request May 25, 2015
Release 2.6

Fixes #83 (Decrease Memory Usage).
Fixes #84 (Requiring mime/types accounts for 2% of all application RAM).
Based on and Fixes #96.
@halostatue halostatue merged commit e427f1c into master May 25, 2015
@halostatue halostatue deleted the 2.6-work branch May 25, 2015 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MIME::Types#type_for doesn't find an extension added with MIME::Type#add_extensions Decrease memory usage
2 participants