4 ms·
Well of course I now have to ask how long it takes in node after running the script a hundred times
by meetups323 5y ago
Well of course I now have to ask how long it takes in node after running the script a hundred times
- capableweb 5y agoDoes NodeJS do any on-the-fly optimization like the JVM does?
- meetups323 5y agoYes, if you dig around V8 performance profiles you'll see some massive "Optimizing Code" blocks that appear at the bottom of a frequently-hit routine once, then subsequent calls to that same routine will run faster. That being said, while I haven't investigated this super thoroughly, in my experience the delta is usually small.
- meetups323 5y agoTrying again with timers internal to the code (previously used `time node ray.js`), initial go is 190ms, then 170ms, 160ms, and after that hovers around 140-150ms for the remaining 97 runs. If I remove the FS operations it's instead 160ms initially, then drops to 130ms by the third go and hovers around there.
- kragen 5y agoThanks! Does this include the time to actually write the image data to the filesystem, or just append it to an internal buffer that will be eventually written?
- kragen 5y agoYes, V8 doing JIT optimization is why the modern web exists. Before V8 JS was slow so you only used it when you had to.