-
Notifications
You must be signed in to change notification settings - Fork 29.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errors: improve error creation performance #46648
Commits on Mar 2, 2023
-
errors: improve hideInternalStackFrames performance
Directly concat the necessary information to a string instead of allocating intermediate arrays and iterating over the array more than once. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for ed1a664 - Browse repository at this point
Copy the full SHA ed1a664View commit details -
errors: reuse addNumericSeparator from internal inspect
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for d21f72b - Browse repository at this point
Copy the full SHA d21f72bView commit details -
lib: make sure internal assertions use internal/assert
The assert module should only be used by users, not by Node.js internally. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for b287852 - Browse repository at this point
Copy the full SHA b287852View commit details -
net: reuse existing aggregateTwoErrors functionality
Instead of providing a similar functionality, just reuse the other method. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for c4f3517 - Browse repository at this point
Copy the full SHA c4f3517View commit details -
errors: minor performance improvement
The arguments check is moved to the error class setup time instead of error instance creation time. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 0d72d40 - Browse repository at this point
Copy the full SHA 0d72d40View commit details -
errors: improve NodeError creation performance
This improves the performance by removing the extra stack trace collection step. Instead, just change the maximum stack trace limit to the current limit plus 25. The arbitrary 25 is used as arbitrary upper bound to prevent huge overhead in recursive methods. The limit should normally not be reached and should therefore suffice. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 2d8a4a3 - Browse repository at this point
Copy the full SHA 2d8a4a3View commit details -
errors: do not remove already collected stack frames in NodeErrors
Currently, already collected user stack frames are removed during stack frame serialization to adhere to the defined maximum stack frame limit. This limit is mainly there to prevent extra cpu overhead while gathering the stack frames. Removing stack frames after already collecting them won't improve the performance and only limit the debuggability for users later. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 69df124 - Browse repository at this point
Copy the full SHA 69df124View commit details -
errors: format more numbers with numeric separator
This simplifies the implementation of the OUT_OF_RANGE error by reusing the current inspect functionality. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 4ddd43f - Browse repository at this point
Copy the full SHA 4ddd43fView commit details -
errors: improve NodeError creation performance
The former implementation over allocated stack frames during error creation to substitute for internal frames that should be hidden to the user. This could have caused a significant performance overhead in deeply nested code. As side effect also simplify the setting of stackTraceLimits and improve the error related benchmarks. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 087b0bc - Browse repository at this point
Copy the full SHA 087b0bcView commit details -
lib: add new to construct errors
This makes sure all error instances use `new` to call the constructor. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 6ec603c - Browse repository at this point
Copy the full SHA 6ec603cView commit details -
errors: significantly improve NodeError creation performance
The improvement comes from the following changes: 1. Less properties are defined on the error instances, especially no Symbol. 2. The check if something is a NodeError or not is not needed anymore. 3. The setup of NodeError now makes sure that all heavy lifting is done up front instead of doing that during instance creation. To align with the WPT tests, the NodeErrors must have their constructor set to their base class. This was not the case for SystemErrors and is now aligned. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 08e1c89 - Browse repository at this point
Copy the full SHA 08e1c89View commit details -
test_runner: set the properties inside of the error method
This improves the error recreation performance due to limiting the stack trace that is generated and it makes sure NodeErrors only set properties inside of the actual error method. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for b3aa706 - Browse repository at this point
Copy the full SHA b3aa706View commit details -
errors,repl: align prepareStackTrace behavior
This fixes the issue that multiple prepareStackTrace functions existed that had to duplicate code in multiple spots. Instead, the diverging part is now replaced during runtime. This reduces the code overhead and makes sure there is no duplication. It also fixes the issue that `overrideStackTrace` usage would not adhere to the `hideStackFrame` calls. Frames are now removed before passing them to the override method. A second fix is for the repl: the stack frames passed to a user defined Error.prepareStackTrace() method are now in the correct order. As drive-by it also improves the performance for repl errors marginally. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 72f87e9 - Browse repository at this point
Copy the full SHA 72f87e9View commit details -
errors: remove unused ERR_INVALID_RETURN_PROPERTY error
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for ee8e40f - Browse repository at this point
Copy the full SHA ee8e40fView commit details -
errors: faster ERR_MODULE_NOT_FOUND error
The function calls are more expensive than using the error printf format style. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Configuration menu - View commit details
-
Copy full SHA for 40ab9c3 - Browse repository at this point
Copy the full SHA 40ab9c3View commit details