@@ -55,17 +55,31 @@ if [[ "$VERIFY_TIME_LINE_NUMBERS" != "true" ]]; then
5555 npm run compile
5656fi
5757
58+ NODE_VERSION=$( node -v | cut -d. -f1 | tr -d ' v' )
5859node -v
5960node --trace-warnings " $BENCHPATH " 10 $VERIFY_TIME_LINE_NUMBERS
6061
6162if [[ " $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"
6676else
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
6983 pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
7084 grep " busyLoop.*src/busybench.ts"
7185fi
0 commit comments