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

Make RUBY_MIME_TYPES_LAZY_LOAD the default #62

Closed
halostatue opened this issue Apr 6, 2014 · 5 comments
Closed

Make RUBY_MIME_TYPES_LAZY_LOAD the default #62

halostatue opened this issue Apr 6, 2014 · 5 comments
Labels
Milestone

Comments

@halostatue
Copy link
Member

Although loading the MIME type registry is fairly fast, do not force people to pay that cost up front. Implement ENV['RUBY_MIME_TYPES_LAZY_LOAD'] as the default behaviour and provide a new variable (ENV['RUBY_MIME_TYPES_IMMEDIATE_LOAD']) to fall back to the old behaviour.

@halostatue halostatue added this to the 3.0 milestone Apr 6, 2014
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 8, 2015
== 2.6.1 / 2015-05-25

* Bugs:
  * Make columnar store handle all supported extensions, not just the first.
  * Avoid circular require when using the columnar store.

== 2.6 / 2015-05-25

* New Feature:
  * Columnar data storage for the MIME::Types registry, contributed by Jeremy
    Evans (@jeremyevans). Reduces default memory use substantially (the mail
    gem drops from 19 Mib to about 3 Mib). Resolves
    {#96}[mime-types/ruby-mime-types#96],
    {#94}[mime-types/ruby-mime-types#94],
    {#83}[mime-types/ruby-mime-types#83]. Partially
    addresses {#64}[mime-types/ruby-mime-types#64]
    and {#62}[mime-types/ruby-mime-types#62].
* Development:
  * Removed caching of deprecation messages in preparation for mime-types 3.0.
    Now, deprecated methods will always warn their deprecation instead of only
    warning once.
  * Added a logger for deprecation messages.
  * Renamed <tt>lib/mime.rb</tt> to <tt>lib/mime/deprecations.rb</tt> to not
    conflict with the {mime}[https://rubygems.org/gems/mime] gem on behalf of
    the maintainers of the {Praxis Framework}[http://praxis-framework.io/].
    Provided by Josep M. Blanquer (@blanquer),
    {#100}[mime-types/ruby-mime-types#100].
  * Added the columnar data conversion tool, also provided by Jeremy Evans.
* Documentation:
  * Improved documentation and ensured that all deprecated methods are marked
    as such in the documentation.
* Development:
  * Added more Ruby variants to Travis CI.
  * Silenced deprecation messages for internal tools. Noisy deprecations are
    noisy, but that's the point.

== 2.5 / 2015-04-25

* Bugs:
  * David Genord (@albus522) fixed a bug in loading MIME::types cache where a
    container loaded from cache did not have the expected +default_proc+,
    {#86}[mime-types/ruby-mime-types#86].
  * Richard Schneeman (@schneems) provided a patch that substantially reduces
    unnecessary allocations.
* Documentation:
  * Tibor Szolár (@flexik) fixed a typo in the README,
    {#82}[mime-types/ruby-mime-types#82]
  * Fixed {#80}[mime-types/ruby-mime-types#80],
    clarifying the relationship of MIME::Type#content_type and
    MIME::Type#simplified, with Ken Ip (@kenips).
* Development:
  * Juanito Fatas (@JuanitoFatas) enabled container mode on Travis CI,
    {#87}[mime-types/ruby-mime-types#87].
* Moved development to a mime-types organization under
  {mime-types/ruby-mime-types}[https://github.com/mime-types/ruby-mime-types].
@halostatue halostatue modified the milestones: Future, 3.0 Nov 21, 2015
@halostatue
Copy link
Member Author

This would be fairly useful, but there is not much of a definable benefit to this as a default. I will do further investigation on this, but I think that I am more likely to look at removing the lazy load functionality entirely for mime-types 4.x because of the columnar capabilities added in 2.6 and improved in 3.0.

@grosser
Copy link

grosser commented May 13, 2016

came here because I noticed 0.3s of my boot time going into mime-types :(

used this flag and ran 1 test each ... only showing 0.1s gain, but that might be because the files are hot/cached at this point, so not sure about the real gain but it is a step in the right direction ..

RUBY_MIME_TYPES_LAZY_LOAD=true
runs: 10
total: 53.86
average: 5.39
range: 5.27..5.82

without:
runs: 10
total: 54.48
average: 5.45
range: 5.35..5.54

@halostatue
Copy link
Member Author

You should also look at using require: 'mime/types/columnar' in your Gemfile since you appear to be stuck on 2.99.x, which will do a different form of lazy loading (columnar, so you get fast lookups for minimal data). The other advantage on this is that it will drop the memory of use MIME::Types by about 1/3. I am trying to get rest-client to loosen the MIME::Types version they require so that MIME::Types 3 can be used (it allows for independent updating of the data file), and the zendesk_api should probably do the same.

@grosser
Copy link

grosser commented May 13, 2016

that would be awesome :)

On Thu, May 12, 2016 at 10:19 PM, Austin Ziegler [email protected]
wrote:

You should also look at using require: 'mime/types/columnar' in your
Gemfile since you appear to be stuck on 2.99.x, which will do a
different form of lazy loading (columnar, so you get fast lookups for
minimal data). The other advantage on this is that it will drop the memory
of use MIME::Types by about 1/3. I am trying to get rest-client to loosen
the MIME::Types version they require so that MIME::Types 3 can be used (it
allows for independent updating of the data file), and the zendesk_api
should probably do the same.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#62 (comment)

@halostatue
Copy link
Member Author

As previously discussed: this is being deprecated. Some testing suggests that it has no effective impact compared to the columnar loading that is the default version in v3.

dividedmind added a commit to cyberark/cyberark-conjur-cli-docker-based that referenced this issue Sep 28, 2018
That feature has been deprecated by the upstream, cf. mime-types/ruby-mime-types#62
Setting it causes an ugly warning message to show up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants