-
Notifications
You must be signed in to change notification settings - Fork 29
fix: update test.sh
for Node 21 and up output
#305
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
base: main
Are you sure you want to change the base?
Changes from all commits
987596f
88fccc3
1e6dc15
71ee5bd
bb9bcef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,17 +55,31 @@ if [[ "$VERIFY_TIME_LINE_NUMBERS" != "true" ]]; then | |
npm run compile | ||
fi | ||
|
||
NODE_VERSION=$(node -v | cut -d. -f1 | tr -d 'v') | ||
node -v | ||
node --trace-warnings "$BENCHPATH" 10 $VERIFY_TIME_LINE_NUMBERS | ||
|
||
if [[ "$VERIFY_TIME_LINE_NUMBERS" == "true" ]]; then | ||
pprof -lines -top -nodecount=2 time.pb.gz | tee $tty | \ | ||
grep "busyLoop.*src/busybench.js:[2-3][08-9]" | ||
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \ | ||
grep "busyLoop.*src/busybench.js" | ||
output=$(pprof -lines -top -nodecount=2 time.pb.gz | tee $tty) | ||
|
||
# Due to V8 changes in Node 21, the line numbers are different. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the PR. It's unfortunate that the function name is lost. Do you have any more info on this V8 change or if there is something we can do to workaround it? It's good to see the output is the same in older node versions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Last time I looked at this, I did some playing around and found some weird behavior. #284 somehow restores the function name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, hm. I am no v8 expert, but from some quick searches, this could be because v8's optimizer was changed/improved in version 11 (which node21 is using). Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll try to dig for a way to force this, it may even require some changes to how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I just proved this too, adding this native syntax yields function name in v21 (without the
You have to execute the benchmark with The output:
interesting that there is still one trace that is anonymous, though, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benminer that makes sense and kind of what I figured. Thank you for looking into this. It sounds good to merge this then, I'll let @rohitpruthi-google take it over. |
||
# It also emits "anonymous" and "idle" statuses in the output. | ||
# E.G: 1877ms 74.93% 74.93% 1878ms 74.97% (anonymous) file:/tmp/tmp.xyz/busybench/src/busybench.js:34 | ||
if [ "$NODE_VERSION" -ge 21 ]; then | ||
grep "anonymous.*busybench.js:3[0-9]" <<< "$output" | ||
else | ||
grep "busyLoop.*src/busybench.js:[23][0-9]" <<< "$output" | ||
fi | ||
|
||
heap_output=$(pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty) | ||
grep "busyLoop.*src/busybench.js" <<< "$heap_output" | ||
else | ||
pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty | \ | ||
grep "busyLoop.*src/busybench.ts" | ||
output=$(pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty) | ||
if [ "$NODE_VERSION" -ge 21 ]; then | ||
grep "anonymous.*busybench.js" <<< "$output" | ||
else | ||
grep "busyLoop.*src/busybench.ts" <<< "$output" | ||
fi | ||
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \ | ||
grep "busyLoop.*src/busybench.ts" | ||
fi | ||
|
Uh oh!
There was an error while loading. Please reload this page.