avadev / AvaTax-Calc-REST-Ruby

Apache License 2.0
7 stars 12 forks source link

AvaTax Dependencies Use Too Much Memory #6

Open dannyyu92 opened 7 years ago

dannyyu92 commented 7 years ago

AvaTax depends on an outdated version of the RestClient gem, which depends on an outdated version of the Ruby mime-types gem. This version of mime-types uses ~11mb of memory on startup, which is a f*ck ton for a gem. It isn't possible to kill this dependency until AvaTax is updated to use a more up to date version of RestClient (latest is 2.0.1)

Using the derailed gem to analyze gem memory usage on app startup for a standard Rails app:

  delayed_job: 16.1055 MiB (Also required by: delayed/railtie, delayed_job_active_record)
    delayed/performable_mailer: 15.0273 MiB
      mail: 15.0156 MiB
        mime/types: 11.0117 MiB (Also required by: mime/types/columnar, /Users/danny/.rvm/gems/ruby-2.2.2/gems/rest-client-1.8.0/lib/restclient/request)
        mail/field: 1.4531 MiB
        mail/message: 0.7656 MiB
    delayed/worker: 0.5234 MiB

Newer versions of the mime-types gem do not use as much memory, as you can read here.

The current version of Avatax uses Restclient 1.7, which uses mime-types 2.0.

By upgrading to use Restclient 2.0.1, it will depend on mime-types 3.1, which will solve this memory bloat dependency issue.

dannyyu92 commented 7 years ago

Gonna send in a PR for this at some point