Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Every require is blocking and requiring the sys module over and over …
…and over again just makes no sense + it hurt performance.. Not to mention.. that it's already included.
- Loading branch information
c6b1765
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.
I'm curious what the perfect hit was on this since require returns the previously required and cached object internally.
c6b1765
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.
its pretty bad, loadModule() still has to stat around to resolve the module id I think
c6b1765
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.
eeww
c6b1765
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.
deceiving :D that is why in express's view engine i do:
c6b1765
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.
In practice I've always required at load time to skip the extra fn calls during execution but didn't know what the perf hit would actually look like.
c6b1765
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.
Well now that I think of it, it would actually be better to use console.log instead of sys.log for logging data. I remember a conversation with ry about the sys module that he is planning to phase out of Node.js. As console.log is already globally available through in Node.js it would probably be more wise to use that instead.. Any thought on that?