-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Defer I/O for package requires until they're actually used #1436
Conversation
I just noticed it seems increase activation time. So this will need further investigation tomorrow. The good news is it might obviate the need for the deferral events because the actual use of objects won't happen until the events happen anyway, allowing for more natural registration. |
@@ -52,7 +52,8 @@ | |||
"text-buffer": "0.13.0", | |||
"theorist": "~0.14.0", | |||
"underscore-plus": "0.6.1", | |||
"vm-compatibility-layer": "0.1.0" | |||
"vm-compatibility-layer": "0.1.0", | |||
"deferred-require": "~0.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be cool maintaining the sorted order of dependencies for readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. I think I just used npm install --save
which tacks stuff on to the end. I'll re-order.
This is turning out to be too complicated for now I think. I may want to revisit it and try again later, but I'm worried it's taking too much time. |
This is an experiment that uses some harmony proxy magic to defer all require I/O until the moment the required modules are actually used. Harmony proxies have some instability when combined with so-called "irregular objects" such as arrays and Date objects, but 99% of the time the objects returned by
require
are not irregular. If it ends up being stable it may be worth it because it cuts our load time without bothering users much.