| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Changes LGTM, although a regression test would be nice. This is a behavior change (semver-major) that gets us in line with what Chrome does. |
Sorry, something went wrong.
|
Agree with @cjihrig. A test is necessary. Otherwise LGTM though |
Sorry, something went wrong.
|
@cjihrig @evanlucas the only test I can imagine is one that checks internal _times map length (size) on timeEnd call (or checks the particular key was removed from the map). Does such checks of module's internal behaviour are suitable? |
Sorry, something went wrong.
|
yea I would say just call console.time a few times and then verify the size of this._times and then call console.timeEnd a few times and do another assert |
Sorry, something went wrong.
|
I have added a test which verifies that timeEnd() calls doesn't leave any new links in the map. |
Sorry, something went wrong.
|
Should probably use strictEqual() in the test. Other than that, LGTM if the CI is happy. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actually, please make this const too.
Sorry, something went wrong.
Sorry, something went wrong.
|
@cjihrig @evanlucas Can you explain why this is semver-major? |
Sorry, something went wrong.
|
Currently, you can reuse a timer, for example after each iteration of a loop. With this change you would have to create a new timer each time. |
Sorry, something went wrong.
|
@cjihrig do you mean the cases like this: console.time('label');
console.timeEnd('label');
console.timeEnd('label');
console.timeEnd('label'); |
Sorry, something went wrong.
|
Yes. I'd be willing to bet there are people out there relying on that behavior. |
Sorry, something went wrong.
|
To be honest I've never thought about such usecase. At least Blink's implementation of console.time() doesn't work this way: undefined is returned after first timeEnd() call. |
Sorry, something went wrong.
|
Sorry, something went wrong.
|
@Fishrock123 did we decide to move forward with this change? |
Sorry, something went wrong.
+1 for this change, a semver-major though. |
Sorry, something went wrong.
|
@narqo could you rebase this please. |
Sorry, something went wrong.
The instance of `Console` class doesn't remove links to arrays that come from hrtimer after `timeEnd` had been called.
|
🆙 |
Sorry, something went wrong.
|
LGTM We may also want to stop throwing on console.timeEnd calls with inexistant labels but that can be done in another PR. |
Sorry, something went wrong.
Currently, console timers that have been ended with timeEnd() are not removed. This has the potential to leak memory. This commit deletes ended timers from the containing Map. PR-URL: #3562 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Unintended functionality was removed from console.endTime by #3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: #6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Unintended functionality was removed from console.endTime by #3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: #6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Unintended functionality was removed from console.endTime by nodejs#3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: nodejs#6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
| Back | FazBrowse Home | New Git URL |
The instance of Console class doesn't remove links to arrays that come from hrtimer after timeEnd had been called.
As far as I understand, such links won't be collected by v8's gc.