rdp / os

The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities
MIT License
145 stars 33 forks source link

Speed up gem boot #76

Closed mperham closed 2 months ago

mperham commented 9 months ago

This gem only needs yaml for the OS.report method. Most users aren't using this method. Could you move the require "yaml" line inside the report method so the gem boots much faster?

https://github.com/rdp/os/blob/9ee80f9ec0f59ecc731ecdc7c2a8f88180e385f5/lib/os.rb#L3

mperham commented 9 months ago

As an example, derailed shows that 100% of the allocated memory from this gem is due directly to requiring YAML.

    os: 0.6875 MiB
      yaml: 0.6875 MiB
        psych: 0.6875 MiB
rdp commented 2 months ago

I want to fix this, PR welcome as well :)