Eliminate allocations on Model.respond_to? calls by tenderlove
14-Jan-2025 33
We're trying to make instantiating models cheaper (for example doing Post.new), and discovered in the course of profiling that respond_to? is responsible for some amount of initialization allocations.
This patch changes Model.respond_to? to not allocate anymore which should help initialization performance (as well as other queries).
Here is the benchmark we used:.
Eliminate allocations on Model.respond_to? calls by tenderlove #ruby #rubydeveloper #rubyonrails #Eliminate #allocations #Model.respond_to? #calls #tenderlove https://rubyonrails.ba/link/eliminate-allocations-on-model-respond_to-calls-by-tenderlove