Skip to content
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

bug(perf): Severe performance regression in Deno 1.32.2 repl start time #18615

Closed
vegerot opened this issue Apr 6, 2023 · 2 comments
Closed
Labels
duplicate a duplicate of another issue

Comments

@vegerot
Copy link
Contributor

vegerot commented Apr 6, 2023

image

In a recent version of Deno, the time taken to start the repl has increased tremendously in project with a large node_modules directory.

❯ sh -c "hyperfine --warmup=2 $(for deno in ~/.tea/deno.land/v*.*.* /usr/local; do printf "\"$deno/bin/deno repl --eval 'close()'\" ";done)"
Benchmark 1: /Users/m0c0j7y/.tea/deno.land/v1.26.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):     190.5 ms ±  36.7 ms    [User: 132.2 ms, System: 43.3 ms]
  Range (min … max):   168.2 ms … 325.3 ms    16 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 2: /Users/m0c0j7y/.tea/deno.land/v1.27.1/bin/deno repl --eval 'close()'
  Time (mean ± σ):     227.6 ms ±  60.0 ms    [User: 147.0 ms, System: 55.2 ms]
  Range (min … max):   173.6 ms … 375.0 ms    15 runs

Benchmark 3: /Users/m0c0j7y/.tea/deno.land/v1.28.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     197.2 ms ±  25.4 ms    [User: 137.6 ms, System: 46.9 ms]
  Range (min … max):   172.2 ms … 243.7 ms    14 runs

Benchmark 4: /Users/m0c0j7y/.tea/deno.land/v1.29.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):     194.1 ms ±  17.9 ms    [User: 138.3 ms, System: 45.2 ms]
  Range (min … max):   177.6 ms … 229.4 ms    14 runs

Benchmark 5: /Users/m0c0j7y/.tea/deno.land/v1.30.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     197.5 ms ±  14.5 ms    [User: 140.7 ms, System: 45.9 ms]
  Range (min … max):   184.1 ms … 227.1 ms    13 runs

Benchmark 6: /Users/m0c0j7y/.tea/deno.land/v1.31.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     203.0 ms ±  11.7 ms    [User: 142.7 ms, System: 48.9 ms]
  Range (min … max):   186.1 ms … 223.1 ms    13 runs

Benchmark 7: /usr/local/bin/deno repl --eval 'close()'
  Time (mean ± σ):      1.098 s ±  0.026 s    [User: 0.459 s, System: 0.186 s]
  Range (min … max):    1.055 s …  1.136 s    10 runs

Summary
  '/Users/m0c0j7y/.tea/deno.land/v1.26.2/bin/deno repl --eval 'close()'' ran
    1.02 ± 0.22 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.29.2/bin/deno repl --eval 'close()''
    1.03 ± 0.24 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.28.3/bin/deno repl --eval 'close()''
    1.04 ± 0.21 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.30.3/bin/deno repl --eval 'close()''
    1.07 ± 0.21 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.31.3/bin/deno repl --eval 'close()''
    1.19 ± 0.39 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.27.1/bin/deno repl --eval 'close()''
    5.76 ± 1.12 times faster than '/usr/local/bin/deno repl --eval 'close()''

❯ /usr/local/bin/deno --version
deno 1.32.2 (release, x86_64-apple-darwin)
v8 11.2.214.9
typescript 5.0.3

Running the same thing in a directory with no node_modules directory is actually a bit faster than previous releases (data very noisy)

image

❯ sh -c "hyperfine --warmup=2 $(for deno in ~/.tea/deno.land/v*.*.* /usr/local; do printf "\"$deno/bin/deno repl --eval 'close()'\" ";done)"
Benchmark 1: /Users/m0c0j7y/.tea/deno.land/v1.26.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):     228.3 ms ±  39.3 ms    [User: 152.1 ms, System: 59.2 ms]
  Range (min … max):   189.0 ms … 342.1 ms    14 runs

Benchmark 2: /Users/m0c0j7y/.tea/deno.land/v1.27.1/bin/deno repl --eval 'close()'
  Time (mean ± σ):     323.6 ms ± 124.2 ms    [User: 180.2 ms, System: 74.3 ms]
  Range (min … max):   222.3 ms … 631.2 ms    11 runs

Benchmark 3: /Users/m0c0j7y/.tea/deno.land/v1.28.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     249.2 ms ±  16.0 ms    [User: 166.6 ms, System: 64.4 ms]
  Range (min … max):   224.1 ms … 273.1 ms    11 runs

Benchmark 4: /Users/m0c0j7y/.tea/deno.land/v1.29.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):     239.7 ms ±  28.1 ms    [User: 162.5 ms, System: 59.1 ms]
  Range (min … max):   198.4 ms … 290.8 ms    11 runs

Benchmark 5: /Users/m0c0j7y/.tea/deno.land/v1.30.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     272.1 ms ±  22.0 ms    [User: 181.0 ms, System: 66.5 ms]
  Range (min … max):   230.7 ms … 300.4 ms    10 runs

Benchmark 6: /Users/m0c0j7y/.tea/deno.land/v1.31.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     265.2 ms ±  24.4 ms    [User: 171.9 ms, System: 73.2 ms]
  Range (min … max):   231.0 ms … 293.5 ms    11 runs

Benchmark 7: /usr/local/bin/deno repl --eval 'close()'
  Time (mean ± σ):     182.1 ms ±  14.1 ms    [User: 120.3 ms, System: 43.4 ms]
  Range (min … max):   162.6 ms … 216.8 ms    12 runs

Summary
  '/usr/local/bin/deno repl --eval 'close()'' ran
    1.25 ± 0.24 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.26.2/bin/deno repl --eval 'close()''
    1.32 ± 0.19 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.29.2/bin/deno repl --eval 'close()''
    1.37 ± 0.14 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.28.3/bin/deno repl --eval 'close()''
    1.46 ± 0.18 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.31.3/bin/deno repl --eval 'close()''
    1.49 ± 0.17 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.30.3/bin/deno repl --eval 'close()''
    1.78 ± 0.70 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.27.1/bin/deno repl --eval 'close()''

FYI I don't even use Deno for its node compatibility. I just prefer to use Deno as my default JS REPL, but when I use it in a directory with node_modules it's very 🐢

image

❯ hyperfine --warmup=1 "deno repl --eval 'close()'" "printf '.exit\n' | node -i"
Benchmark 1: deno repl --eval 'close()'
  Time (mean ± σ):      1.229 s ±  0.086 s    [User: 0.508 s, System: 0.208 s]
  Range (min … max):    1.147 s …  1.439 s    10 runs

Benchmark 2: printf '.exit\n' | node -i
  Time (mean ± σ):     153.0 ms ±  38.9 ms    [User: 79.3 ms, System: 25.5 ms]
  Range (min … max):    98.5 ms … 259.8 ms    20 runs

Summary
  'printf '.exit\n' | node -i' ran
    8.04 ± 2.12 times faster than 'deno repl --eval 'close()''
@vegerot
Copy link
Contributor Author

vegerot commented Apr 6, 2023

Looks like this regression is only in 1.32.2 and has been fixed in 1.32.3

image

❯ sh -c "hyperfine --warmup=2 $(for deno in ~/.tea/deno.land/v1.32.* ; do printf "\"$deno/bin/deno repl --eval 'close()'\" ";done)"
Benchmark 1: /Users/m0c0j7y/.tea/deno.land/v1.32.0/bin/deno repl --eval 'close()'
  Time (mean ± σ):     195.8 ms ±  16.3 ms    [User: 133.5 ms, System: 47.5 ms]
  Range (min … max):   184.0 ms … 230.8 ms    14 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 2: /Users/m0c0j7y/.tea/deno.land/v1.32.1/bin/deno repl --eval 'close()'
  Time (mean ± σ):     181.9 ms ±   9.2 ms    [User: 126.3 ms, System: 42.3 ms]
  Range (min … max):   152.3 ms … 191.0 ms    15 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 3: /Users/m0c0j7y/.tea/deno.land/v1.32.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):      1.226 s ±  0.046 s    [User: 0.532 s, System: 0.232 s]
  Range (min … max):    1.180 s …  1.331 s    10 runs

Benchmark 4: /Users/m0c0j7y/.tea/deno.land/v1.32.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     200.7 ms ±  37.6 ms    [User: 139.7 ms, System: 45.3 ms]
  Range (min … max):   146.1 ms … 298.6 ms    16 runs

Summary
  '/Users/m0c0j7y/.tea/deno.land/v1.32.1/bin/deno repl --eval 'close()'' ran
    1.08 ± 0.10 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.0/bin/deno repl --eval 'close()''
    1.10 ± 0.21 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.3/bin/deno repl --eval 'close()''
    6.74 ± 0.42 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.2/bin/deno repl --eval 'close()''cd /tmp

    /tmp ································································································································ 13:04:01  ─╮
❯ sh -c "hyperfine --warmup=2 $(for deno in ~/.tea/deno.land/v1.32.* ; do printf "\"$deno/bin/deno repl --eval 'close()'\" ";done)"                         ─╯
Benchmark 1: /Users/m0c0j7y/.tea/deno.land/v1.32.0/bin/deno repl --eval 'close()'
  Time (mean ± σ):     214.7 ms ±  27.6 ms    [User: 147.0 ms, System: 53.4 ms]
  Range (min … max):   167.4 ms … 266.2 ms    16 runs

Benchmark 2: /Users/m0c0j7y/.tea/deno.land/v1.32.1/bin/deno repl --eval 'close()'
  Time (mean ± σ):     198.4 ms ±  20.4 ms    [User: 138.5 ms, System: 48.0 ms]
  Range (min … max):   178.3 ms … 239.8 ms    13 runs

Benchmark 3: /Users/m0c0j7y/.tea/deno.land/v1.32.2/bin/deno repl --eval 'close()'
  Time (mean ± σ):     216.1 ms ±  39.8 ms    [User: 142.3 ms, System: 53.0 ms]
  Range (min … max):   176.0 ms … 292.9 ms    15 runs

Benchmark 4: /Users/m0c0j7y/.tea/deno.land/v1.32.3/bin/deno repl --eval 'close()'
  Time (mean ± σ):     191.5 ms ±  31.1 ms    [User: 137.1 ms, System: 43.8 ms]
  Range (min … max):   145.1 ms … 280.3 ms    16 runs

Summary
  '/Users/m0c0j7y/.tea/deno.land/v1.32.3/bin/deno repl --eval 'close()'' ran
    1.04 ± 0.20 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.1/bin/deno repl --eval 'close()''
    1.12 ± 0.23 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.0/bin/deno repl --eval 'close()''
    1.13 ± 0.28 times faster than '/Users/m0c0j7y/.tea/deno.land/v1.32.2/bin/deno repl --eval 'close()''

@dsherret
Copy link
Member

dsherret commented Apr 7, 2023

Duplicate of #18540 and #18538 (you can save time in the future by searching)

Sorry about this issue. Please upgrade to Deno 1.32.3

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
@dsherret dsherret added the duplicate a duplicate of another issue label Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants