@@ -55,17 +55,31 @@ if [[ "$VERIFY_TIME_LINE_NUMBERS" != "true" ]]; then
55
55
npm run compile
56
56
fi
57
57
58
+ NODE_VERSION=$( node -v | cut -d. -f1 | tr -d ' v' )
58
59
node -v
59
60
node --trace-warnings " $BENCHPATH " 10 $VERIFY_TIME_LINE_NUMBERS
60
61
61
62
if [[ " $VERIFY_TIME_LINE_NUMBERS " == " true" ]]; then
62
- pprof -lines -top -nodecount=2 time.pb.gz | tee $tty | \
63
- grep " busyLoop.*src/busybench.js:[2-3][08-9]"
64
- pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
65
- grep " busyLoop.*src/busybench.js"
63
+ output=$( pprof -lines -top -nodecount=2 time.pb.gz | tee $tty )
64
+
65
+ # Due to V8 changes in Node 21, the line numbers are different.
66
+ # It also emits "anonymous" and "idle" statuses in the output.
67
+ # E.G: 1877ms 74.93% 74.93% 1878ms 74.97% (anonymous) file:/tmp/tmp.xyz/busybench/src/busybench.js:34
68
+ if [ " $NODE_VERSION " -ge 21 ]; then
69
+ grep " anonymous.*busybench.js:3[0-9]" <<< " $output"
70
+ else
71
+ grep " busyLoop.*src/busybench.js:[23][0-9]" <<< " $output"
72
+ fi
73
+
74
+ heap_output=$( pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty )
75
+ grep " busyLoop.*src/busybench.js" <<< " $heap_output"
66
76
else
67
- pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty | \
68
- grep " busyLoop.*src/busybench.ts"
77
+ output=$( pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty )
78
+ if [ " $NODE_VERSION " -ge 21 ]; then
79
+ grep " anonymous.*busybench.ts" <<< " $output"
80
+ else
81
+ grep " busyLoop.*src/busybench.ts" <<< " $output"
82
+ fi
69
83
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
70
84
grep " busyLoop.*src/busybench.ts"
71
85
fi
0 commit comments