You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gem eagerly loads all API endpoint wrappers, which bloats the memory footprint when the gem is loaded. For our particular use-case, we only need a handful of API endpoints.
Measurements
Boot-time memory measurements as of gem version 2.34.0 using bundle exec derailed_benchmarks bundle:mem in our Rails application. Seems you need to re-run the command several times as the measurement is not very precise/consistent between invocations.
Now, on the latest chargebee gem version (2.47.1), which compared to 2.34 has introduced several more API endpoint wrappers shows memory usage has increased:
I only used autoload as a POC - zeitwerk is likely a better solution longterm but requires more code changes whereas using autoload I only had to modify lib/chargebee.rb - this is assuming the specs validated the changes thoroughly enough.
My machine specs:
Ruby 3.3.6
Apple M1 max
The text was updated successfully, but these errors were encountered:
Problem
The gem eagerly loads all API endpoint wrappers, which bloats the memory footprint when the gem is loaded. For our particular use-case, we only need a handful of API endpoints.
Measurements
Boot-time memory measurements as of gem version 2.34.0 using
bundle exec derailed_benchmarks bundle:mem
in our Rails application. Seems you need to re-run the command several times as the measurement is not very precise/consistent between invocations.CUT_OFF=0.001 bundle exec derailed bundle:mem | grep chargebee
Now, on the latest chargebee gem version (2.47.1), which compared to 2.34 has introduced several more API endpoint wrappers shows memory usage has increased:
My refactoring of lib/chargebee.rb to use
autoload
(master...jamescook:chargebee-ruby:use-autoload). Here we can see memory usage drops sharply at boot time:I only used autoload as a POC - zeitwerk is likely a better solution longterm but requires more code changes whereas using autoload I only had to modify
lib/chargebee.rb
- this is assuming the specs validated the changes thoroughly enough.My machine specs:
The text was updated successfully, but these errors were encountered: