Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Defer I/O for package requires until they're actually used #1436

Closed
wants to merge 1 commit into from

Conversation

nathansobo
Copy link
Contributor

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.

screen shot 2014-01-16 at 9 51 09 pm

@nathansobo
Copy link
Contributor Author

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@nathansobo
Copy link
Contributor Author

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.

@nathansobo nathansobo closed this Jan 17, 2014
This was referenced Sep 15, 2021
This was referenced Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants