-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Complete Description of Issue
When files containing classes that inherit from Roar::Decorator and use the include Roar::JSON::JSONAPI.resource declaration are dynamically reloaded, there is a performance degradation. As the number of reloads goes up, the performance degradation seems to increase as well.
Steps to reproduce
Simulate dynamic reloading by running the Kernel::load method multiple with the same file. Again, that file should contain a class that inherits from Roar::Decorator and uses the include Roar::JSON::JSONAPI.resource declaration, like so:
class DocumentSingleResourceObjectDecorator < Roar::Decorator
include Roar::JSON::JSONAPI.resource :articles
attributes do
property :title
end
end(In our case, we use trailblazer and roar-jsonapi within Rails, and the performance slowdown initially showed up in our development environment. We were able to reproduce the problem without Rails being involved, both in this repo and with a minimal benchmark test case in #29.)
Expected behavior
The time to reload the file with the class in it should exhibit constant-time performance characteristics.
Translation: It should just load quickly and move on.
Actual behavior
Every time the same file is reloaded, there appears to be a significant performance degradation.
Translation: It slows down significantly while loading, causing further use of the class to be delayed.
System configuration
Roar version: 1.1.0
Roar-JSONAPI version: 0.0.3