-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
module: don't require fs several times #7893
Conversation
As we are going to need fs in any case, just require it at the beginning of the file.
|
Does it have any implication on startup time? When starting repl? |
|
happy to confirm that it has :) as far as I can measure it with these micro benchmarks ... Before each test I rebooted the machine, and waited 30sec. Order from up to down - was running the upper ones first. Used https://github.com/robertkowalski/require-benchmark - I am happy if I get some help to get the benchmarks running with dtrace. Not sure about the first Hapi Webserver run, it is slower. But after a final reboot after all of the first tests ran I got a significally better result (maybe caching between the reboot?): ResultschangedHapi Webserverflat.jscurrent masterHapi Webserverflat.js |
|
Gosh, how I hate mixed results :) So what's your final opinion on it? |
|
For me the multiple requires distracted me while reading the code and that was my initial intend for removing them just with the assumption that it would not increase or decrease the performance. After I got some sleep I would like to make a second testrun for the benchmarks, for me it looks like the initial hapi test value was a freak value. Also because it was faster after the intitial first testset. |
|
This time I cold booted the machine before each test, and waited This time I disabled all startup programs and the indexing of the Some day I will buy a dedicated Linux machine for For me it looks like the new implementation is slighty faster, which makes sense to me changedHapi Webserverflat.jscurrent masterHapi Webserverflat.js |
|
Ok, let's land it! |
|
Landed in 46ccb20 |
As we are going to need fs in any case, just require it at the
beginning of the file.