Start time performance regression when upgrading from 16.x to 18.x

Version

v18.12.1

Platform

Linux ddf105937af6 5.10.47-linuxkit #1 SMP PREEMPT Sat Jul 3 21:50:16 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Run the following script replacing node -p '7+8' with the node binary and any command you want to benchmark.

I chose 7+8 as a simple addition example but it reproduces with anything.

Run once with node 16.x and then run again with node 18.x binary.

#!/bin/bash

export TIMEFORMAT=%R;

SUM=0
TRIES=3

for i in $(seq $TRIES)
do
  STR=$( { time node -p '7+8' > /dev/null; } 2>&1 )
  TRIM=$(echo $STR | sed 's/^0\.0*//')
  echo "   $i - start time was $TRIM ms"
  MS=$((TRIM))
  SUM=`expr $SUM + $MS`
done

AVG=`expr $SUM / $TRIES`
echo "Done - average start time for node $(node --version) was $AVG ms"

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior?

Expected Node.js 18 to perform the same as Node.js 16

What do you see instead?

Node.js 16 was faster and Node.js 18 was slower

   1 - start time was 428 ms
   2 - start time was 387 ms
   3 - start time was 379 ms
Done - average start time for node v16.18.1 was 398 ms

18.x

   1 - start time was 440 ms
   2 - start time was 452 ms
   3 - start time was 425 ms
Done - average start time for node v18.12.1 was 439 ms

That's a decrease of 10%

Additional information

This regression affects macOS, Linux, etc