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

refactor: use rustc-hash #538

Merged
merged 1 commit into from
Oct 17, 2023
Merged

refactor: use rustc-hash #538

merged 1 commit into from
Oct 17, 2023

Conversation

Conaclos
Copy link
Member

Summary

Use FxHashSet and FxHasMap where possible.
This is a basic tip to ensure efficient computation of hashes.

Test Plan

Ci should pass. No perf regression should be noticed on benchmarks.

@Conaclos Conaclos temporarily deployed to Website deployment October 17, 2023 13:33 — with GitHub Actions Inactive
@github-actions github-actions bot added A-CLI Area: CLI A-Core Area: core A-Project Area: project A-Linter Area: linter A-Parser Area: parser A-Formatter Area: formatter A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages labels Oct 17, 2023
@Conaclos
Copy link
Member Author

!bench_analyzer

@Conaclos
Copy link
Member Author

!bench_formatter

@Conaclos
Copy link
Member Author

!bench_cli

@Conaclos
Copy link
Member Author

!bench_parser

@github-actions
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 49701 49701 0
Passed 48642 48642 0
Failed 1059 1059 0
Panics 0 0 0
Coverage 97.87% 97.87% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6322 6322 0
Passed 2036 2036 0
Failed 4286 4286 0
Panics 0 0 0
Coverage 32.20% 32.20% 0.00%

ts/babel

Test result main count This PR count Difference
Total 662 662 0
Passed 592 592 0
Failed 70 70 0
Panics 0 0 0
Coverage 89.43% 89.43% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 17646 17646 0
Passed 13454 13454 0
Failed 4190 4190 0
Panics 2 2 0
Coverage 76.24% 76.24% 0.00%

@github-actions
Copy link
Contributor

Analyzer Benchmark Results

group                     main                                   pr
-----                     ----                                   --
analyzer/css.js           1.00      4.6±0.05ms     2.6 MB/sec    1.00      4.6±0.02ms     2.6 MB/sec
analyzer/index.js         1.00      9.7±0.03ms     3.2 MB/sec    1.00      9.6±0.05ms     3.2 MB/sec
analyzer/lint.ts          1.00      7.0±0.01ms     5.9 MB/sec    1.00      7.0±0.03ms     5.9 MB/sec
analyzer/parser.ts        1.00     14.8±0.06ms     3.3 MB/sec    1.00     14.8±0.61ms     3.3 MB/sec
analyzer/router.ts        1.00      4.6±0.00ms     5.1 MB/sec    1.00      4.6±0.10ms     5.1 MB/sec
analyzer/statement.ts     1.01     13.7±0.02ms     2.6 MB/sec    1.00     13.6±0.05ms     2.6 MB/sec
analyzer/typescript.ts    1.01     22.0±0.30ms     2.5 MB/sec    1.00     21.8±0.21ms     2.5 MB/sec

@github-actions
Copy link
Contributor

Formatter Benchmark Results

group                                    main                                   pr
-----                                    ----                                   --
formatter/big5-added.json                1.00    497.9±0.84µs    33.9 MB/sec    1.00    499.1±0.68µs    33.9 MB/sec
formatter/canada.json                    1.03    224.7±2.11ms     9.6 MB/sec    1.00    218.7±1.98ms     9.8 MB/sec
formatter/checker.ts                     1.00    360.9±2.31ms     7.2 MB/sec    1.01    364.5±2.08ms     7.1 MB/sec
formatter/compiler.js                    1.01    202.8±1.32ms     5.2 MB/sec    1.00    201.4±0.99ms     5.2 MB/sec
formatter/d3.min.js                      1.01    159.0±1.58ms  1688.1 KB/sec    1.00    158.2±1.87ms  1696.9 KB/sec
formatter/db.json                        1.01     14.4±0.10ms    12.7 MB/sec    1.00     14.3±0.12ms    12.8 MB/sec
formatter/dojo.js                        1.00     11.0±0.02ms     6.2 MB/sec    1.00     11.1±0.05ms     6.2 MB/sec
formatter/eucjp.json                     1.00    837.5±1.37µs    46.8 MB/sec    1.02    851.4±1.34µs    46.0 MB/sec
formatter/ios.d.ts                       1.00    230.0±1.92ms     8.1 MB/sec    1.01    232.1±2.00ms     8.0 MB/sec
formatter/jquery.min.js                  1.00     45.1±0.27ms  1878.4 KB/sec    1.00     45.0±0.25ms  1879.5 KB/sec
formatter/math.js                        1.00    307.3±1.13ms     2.1 MB/sec    1.00    307.6±1.79ms     2.1 MB/sec
formatter/package-lock.json              1.01      6.1±0.02ms    22.7 MB/sec    1.00      6.0±0.12ms    22.9 MB/sec
formatter/parser.ts                      1.00      7.5±0.02ms     6.5 MB/sec    1.00      7.5±0.04ms     6.5 MB/sec
formatter/pixi.min.js                    1.01    172.5±3.96ms     2.5 MB/sec    1.00    170.7±1.41ms     2.6 MB/sec
formatter/react-dom.production.min.js    1.00     51.8±0.61ms     2.2 MB/sec    1.00     51.6±0.58ms     2.2 MB/sec
formatter/react.production.min.js        1.00      2.6±0.01ms     2.4 MB/sec    1.00      2.6±0.01ms     2.4 MB/sec
formatter/router.ts                      1.00      2.7±0.01ms     8.7 MB/sec    1.00      2.7±0.03ms     8.7 MB/sec
formatter/tex-chtml-full.js              1.01    398.7±1.87ms     2.3 MB/sec    1.00    393.7±1.90ms     2.3 MB/sec
formatter/three.min.js                   1.01    204.9±1.19ms     2.9 MB/sec    1.00    202.7±1.70ms     2.9 MB/sec
formatter/typescript.js                  1.00   1337.8±6.91ms     7.1 MB/sec    1.00   1333.7±7.19ms     7.1 MB/sec
formatter/vue.global.prod.js             1.00     68.5±0.69ms  1800.6 KB/sec    1.00     68.4±0.79ms  1804.3 KB/sec

@github-actions
Copy link
Contributor

Parser Benchmark Results

group                                          main                                   pr
-----                                          ----                                   --
parser/big5-added.json/cached                  1.00    188.9±2.74µs    89.4 MB/sec    1.08   204.6±22.23µs    82.6 MB/sec
parser/big5-added.json/uncached                1.00    223.6±0.80µs    75.6 MB/sec    1.05    235.4±7.60µs    71.8 MB/sec
parser/canada.json/cached                      1.00    125.3±3.78ms    17.1 MB/sec    1.02    128.0±3.30ms    16.8 MB/sec
parser/canada.json/uncached                    1.03    126.1±3.13ms    17.0 MB/sec    1.00    122.9±3.09ms    17.5 MB/sec
parser/checker.ts/cached                       1.00    147.6±2.04ms    17.6 MB/sec    1.01    149.6±2.34ms    17.4 MB/sec
parser/checker.ts/uncached                     1.00    150.9±1.66ms    17.2 MB/sec    1.02    153.2±2.53ms    17.0 MB/sec
parser/compiler.js/cached                      1.01     88.0±1.12ms    11.9 MB/sec    1.00     87.5±1.54ms    12.0 MB/sec
parser/compiler.js/uncached                    1.01     88.9±1.22ms    11.8 MB/sec    1.00     87.9±1.36ms    11.9 MB/sec
parser/d3.min.js/cached                        1.01     53.0±1.32ms     4.9 MB/sec    1.00     52.7±0.69ms     5.0 MB/sec
parser/d3.min.js/uncached                      1.00     52.2±0.92ms     5.0 MB/sec    1.01     52.5±1.30ms     5.0 MB/sec
parser/db.json/cached                          1.00      5.4±0.05ms    33.9 MB/sec    1.06      5.7±0.24ms    32.1 MB/sec
parser/db.json/uncached                        1.01      5.9±0.04ms    30.9 MB/sec    1.00      5.8±0.04ms    31.3 MB/sec
parser/dojo.js/cached                          1.00      3.8±0.03ms    17.8 MB/sec    1.01      3.9±0.02ms    17.7 MB/sec
parser/dojo.js/uncached                        1.00      4.3±0.03ms    15.9 MB/sec    1.01      4.4±0.06ms    15.8 MB/sec
parser/eucjp.json/cached                       1.01    315.7±3.17µs   124.0 MB/sec    1.00    311.1±6.14µs   125.9 MB/sec
parser/eucjp.json/uncached                     1.02    358.0±1.06µs   109.4 MB/sec    1.00    351.4±2.93µs   111.4 MB/sec
parser/ios.d.ts/cached                         1.00    130.3±1.54ms    14.3 MB/sec    1.03    133.9±2.15ms    13.9 MB/sec
parser/ios.d.ts/uncached                       1.00    137.3±6.63ms    13.6 MB/sec    1.04    143.0±7.21ms    13.0 MB/sec
parser/jquery.min.js/cached                    1.00     12.7±0.18ms     6.5 MB/sec    1.08     13.7±0.65ms     6.0 MB/sec
parser/jquery.min.js/uncached                  1.00     13.4±0.13ms     6.2 MB/sec    1.00     13.4±0.11ms     6.2 MB/sec
parser/math.js/cached                          1.04    106.6±2.27ms     6.1 MB/sec    1.00    102.7±1.66ms     6.3 MB/sec
parser/math.js/uncached                        1.01    105.3±1.80ms     6.2 MB/sec    1.00    104.3±1.94ms     6.2 MB/sec
parser/package-lock.json/cached                1.03      2.2±0.01ms    62.2 MB/sec    1.00      2.2±0.02ms    63.8 MB/sec
parser/package-lock.json/uncached              1.02      2.4±0.01ms    57.0 MB/sec    1.00      2.4±0.01ms    58.4 MB/sec
parser/parser.ts/cached                        1.00      2.8±0.04ms    17.3 MB/sec    1.01      2.8±0.01ms    17.1 MB/sec
parser/parser.ts/uncached                      1.00      3.1±0.01ms    15.6 MB/sec    1.01      3.2±0.01ms    15.4 MB/sec
parser/pixi.min.js/cached                      1.00     65.1±1.04ms     6.7 MB/sec    1.01     65.4±3.15ms     6.7 MB/sec
parser/pixi.min.js/uncached                    1.02     66.5±1.24ms     6.6 MB/sec    1.00     65.2±1.21ms     6.7 MB/sec
parser/react-dom.production.min.js/cached      1.00     17.6±0.43ms     6.5 MB/sec    1.00     17.7±0.41ms     6.5 MB/sec
parser/react-dom.production.min.js/uncached    1.00     18.5±0.52ms     6.2 MB/sec    1.00     18.5±0.22ms     6.2 MB/sec
parser/react.production.min.js/cached          1.01    829.2±7.48µs     7.4 MB/sec    1.00    824.3±6.07µs     7.5 MB/sec
parser/react.production.min.js/uncached        1.00   933.9±11.76µs     6.6 MB/sec    1.00   935.6±20.60µs     6.6 MB/sec
parser/router.ts/cached                        1.00   967.4±13.18µs    24.3 MB/sec    1.01    973.2±7.09µs    24.2 MB/sec
parser/router.ts/uncached                      1.00   1135.1±2.02µs    20.7 MB/sec    1.01   1150.0±1.52µs    20.4 MB/sec
parser/tex-chtml-full.js/cached                1.02    141.6±1.88ms     6.4 MB/sec    1.00    138.4±2.30ms     6.6 MB/sec
parser/tex-chtml-full.js/uncached              1.00    142.6±2.24ms     6.4 MB/sec    1.06    150.6±8.67ms     6.1 MB/sec
parser/three.min.js/cached                     1.05     73.1±1.33ms     8.0 MB/sec    1.00     69.7±1.48ms     8.4 MB/sec
parser/three.min.js/uncached                   1.04     74.3±1.24ms     7.9 MB/sec    1.00     71.7±0.85ms     8.2 MB/sec
parser/typescript.js/cached                    1.01   592.7±10.01ms    16.0 MB/sec    1.00   586.2±15.46ms    16.2 MB/sec
parser/typescript.js/uncached                  1.05    607.5±8.58ms    15.6 MB/sec    1.00    581.2±7.60ms    16.3 MB/sec
parser/vue.global.prod.js/cached               1.00     22.1±0.53ms     5.5 MB/sec    1.00     22.0±0.81ms     5.5 MB/sec
parser/vue.global.prod.js/uncached             1.01     22.9±0.29ms     5.3 MB/sec    1.00     22.8±1.16ms     5.3 MB/sec

@Conaclos Conaclos merged commit 6565043 into main Oct 17, 2023
16 checks passed
@Conaclos Conaclos deleted the conaclos/rustc-hash branch October 17, 2023 14:53
@Conaclos Conaclos added the A-Changelog Area: changelog label Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI A-Core Area: core A-Formatter Area: formatter A-Linter Area: linter A-LSP Area: language server protocol A-Parser Area: parser A-Project Area: project L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants