-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Description
- Version: v8.2.1
- Platform: MacOS 10.12.6 and Debian 4.9.30
Node experiences a sudden and permanent drop in performance partway through executing the attached test. The test consists of running the same code eight times. After the first three times, the performance drops to one half (OS X) or one third (Debian) of its previous performance.
Memory usage remains at a constant 60 MB through the entire run. Forcing a GC between runs has no effect. When the same code is run in Chrome, there is no performance drop.
The test is purely algorithmic (computing Fibonacci sequences via a JavaScript interpreter). There is no disk access or network access. There are no dependencies beyond the included files. With the exception of using Sets and multi-line strings, all code is ES 5.1.
To recreate, unzip the attached file and execute node run.js. Expected output would be eight runs of approximately the same duration. Actual output is:
> node run.js
Run 0: 5075 ms
Run 1: 5174 ms
Run 2: 5156 ms
Run 3: 10888 ms
Run 4: 11022 ms
Run 5: 11244 ms
Run 6: 11196 ms
Run 7: 10742 ms
Also included is run.html which can be dropped into a browser. Chrome provides the following output which is consistent across all runs:
Run 0: 3902 ms
Run 1: 3923 ms
Run 2: 3982 ms
Run 3: 3923 ms
Run 4: 4189 ms
Run 5: 4135 ms
Run 6: 4105 ms
Run 7: 4094 ms
Speculation: Is V8 getting poisoned in some way that it can't optimize execution? Making insignificant changes in the code (like adding a busy loop that counts to 1000) can randomly move the performance cliff forwards or backwards.