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

perf issue: basic loop is 10 times slower than QJS and 100 times slower than Node #3449

Open
ahaoboy opened this issue Nov 3, 2023 · 0 comments
Labels
bug Something isn't working performance Performance related changes and issues

Comments

@ahaoboy
Copy link
Contributor

ahaoboy commented Nov 3, 2023

Describe the bug
Basic loop is very slow

To Reproduce

const n = 10_000;

for(let i=0;i<n;i++){
    for(let j=0;j<n;j++){
    }
}
 hyperfine --shell zsh -- "node ./a.js" "deno run ./a.js" "boa-windows-amd64  ./a.js"   "qjs ./a.js"
 Benchmark 1: node ./a.js
  Time (mean ± σ):      99.7 ms ±  11.1 ms    [User: 11.7 ms, System: 11.3 ms]
  Range (min … max):    79.0 ms … 115.5 ms    20 runs

Benchmark 2: deno run ./a.js
  Time (mean ± σ):      98.6 ms ±   9.9 ms    [User: 24.8 ms, System: 14.3 ms]
  Range (min … max):    79.8 ms … 112.1 ms    17 runs

Benchmark 3: boa-windows-amd64  ./a.js
  Time (mean ± σ):     72.532 s ±  2.410 s    [User: 47.223 s, System: 0.056 s]
  Range (min … max):   69.313 s … 75.440 s    10 runs

Benchmark 4: qjs ./a.js
  Time (mean ± σ):      1.601 s ±  0.016 s    [User: 1.033 s, System: 0.003 s]
  Range (min … max):    1.577 s …  1.629 s    10 runs

Summary
  deno run ./a.js ran
    1.01 ± 0.15 times faster than node ./a.js
   16.23 ± 1.64 times faster than qjs ./a.js
  735.58 ± 78.06 times faster than boa-windows-amd64  ./a.js

Expected behavior
Loop can run faster.

Build environment (please complete the following information):

  • OS: win11
  • Rustc version: rustc 1.75.0-nightly (75b064d26 2023-11-01)
@ahaoboy ahaoboy added the bug Something isn't working label Nov 3, 2023
@jedel1043 jedel1043 added performance performance Performance related changes and issues and removed performance labels Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Performance related changes and issues
Projects
None yet
Development

No branches or pull requests

2 participants