This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
paperclip 4.2.1 memory/object use quite high #1882
Comments
This fix is in master: #1873. Would that fix your use case? Thanks for the detailed report! |
Hi @tute , from what I saw that commit is related only with mime/types and not the issue I referred above ;) Even so, I tried master and the problem persists.
|
Thank you all! This is super useful. I'm not doing code on paperclip for a few weeks, so delegating these performance improvements to @jyurek for now. |
Thank you! It looks like #1888 is soon to be merged, closing this issue in favor of that PR. 👍 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm using Rails 4.2.0 with Ruby 2.1.5 in an application that usees Paperclip 4.2.1.
We have been diagnosing memory allocation and consumption using derailed_benchmarks (v1.0.0).
One thing that we noticed is that the memory/object allocation is quite high for paperclip.
Bellow is the output of derailed benchmarks for object use.
We trace the source of the "problem" to paperclip's interpolation.rb, namely the "self.instance_methods(false).sort" of self.all method, and the gsub line inside the all.reverse.inject iteration in self.interpolate method.
We changed this method a bit (it works but it is not a real and clean patch) so the memory use is quite lower now. Even so, I guess that it could be even lower but for that the internal iteration would have to be rethinked.
After the change, we obtained these results, that are quite lower (aprox 1/10th) but, as I said, far from perfect.
We noticed that the methods "all" and "interpolate" are being called many many times, apparently whenever their associated activerecord models are loaded.
Guess that this part needs some kind of otimization maybe?
The text was updated successfully, but these errors were encountered: