Skip to content

ModuleCache initializing takes a minute #53

@pxue

Description

@pxue

I'm having problem where every reload is taking about a minute. With the debug mode on I was able to trace through the code to dependencies_patch Line: 115

Apparently iterating over ObjectSpace and mapping _mod_name takes a really long time.

For example, if I open up rails console and run
ObjectSpace.each_object(Module){|mod| mod._mod_name }

take about 100 seconds. The count returned is 26000+.

I've monkey patched Line 231 of same file module_cache = nil so that it doesn't reload the cache on every file reload. This improved the reload time significantly to around 1s, but I'm not sure what side effects I've introduced (I'm a ruby nub).

Any insights or point me to the right direction? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions