I’ve been profiling performance of our app and noticed that all the calls to Rails.env.production? (used extensively) are taking rather long.
After seeing its source, everything was clear:
First it does a
require, then it instantiates a new object on each call. After removing the require and memoizing the object, I’ve upped the performance of our application by 5 req/s.
Is there a reason for the current implementation?