Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call require() once only #62

Merged
merged 2 commits into from
Nov 15, 2014
Merged

Call require() once only #62

merged 2 commits into from
Nov 15, 2014

Conversation

rvagg
Copy link
Contributor

@rvagg rvagg commented Nov 14, 2014

When profilling CPU usage, we're seeing a significant amount of waste that occurs because of the lazy require() calls that are then called repeatedly even after first load. There is still a non-trivial cost in looking up cached objects from the require cache, including calculating up and slicing up the full path to the file. When doing heavy XML building work, this can become a considerable burden.

These changes simply shift all of the require() calls to the top so they are done once. In XMLNode.coffee they are lazily done in the constructor of the class, only the first time (by checking for null), so they are still just done once.

@oozcitak oozcitak merged commit cf67183 into oozcitak:master Nov 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants