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(semantics): avoid hashing when resolving references #248

Merged
merged 4 commits into from
Apr 3, 2023

Conversation

YangchenYe323
Copy link
Contributor

@YangchenYe323 YangchenYe323 commented Apr 2, 2023

Avoid additional hashing step when building the resolved reference table. Related to discussion in #225

@YangchenYe323
Copy link
Contributor Author

Benchmark Results

Linux

group                      main                                   pr
-----                      ----                                   --
parser/babylon.max.js      1.02    118.8±1.47ms    86.9 MB/sec    1.00    116.1±1.75ms    88.9 MB/sec
parser/d3.js               1.01     15.1±0.16ms    36.2 MB/sec    1.00     15.0±0.33ms    36.5 MB/sec
parser/lodash.js           1.06      4.4±0.09ms   117.4 MB/sec    1.00      4.1±0.15ms   125.0 MB/sec
parser/pdf.js              1.03      8.5±0.12ms    47.2 MB/sec    1.00      8.3±0.15ms    48.7 MB/sec
parser/typescript.js       1.03    122.4±1.13ms    78.6 MB/sec    1.00    119.4±1.67ms    80.6 MB/sec
semantic/babylon.max.js    1.11    267.1±4.43ms    38.7 MB/sec    1.00    241.4±3.73ms    42.8 MB/sec
semantic/d3.js             1.41     31.7±0.86ms    17.2 MB/sec    1.00     22.4±3.41ms    24.3 MB/sec
semantic/lodash.js         1.15      6.5±0.26ms    79.3 MB/sec    1.00      5.6±0.31ms    91.5 MB/sec
semantic/pdf.js            1.10     12.0±1.32ms    33.5 MB/sec    1.00     10.9±1.21ms    37.0 MB/sec
semantic/typescript.js     1.19    223.3±3.58ms    43.1 MB/sec    1.00    188.2±3.52ms    51.1 MB/sec

Windows

group                      main                                   pr
-----                      ----                                   --
parser/babylon.max.js      1.00    169.0±5.62ms    61.1 MB/sec    1.00    169.0±6.43ms    61.1 MB/sec
parser/d3.js               1.03     21.3±0.84ms    25.6 MB/sec    1.00     20.7±0.74ms    26.4 MB/sec
parser/lodash.js           1.00      5.7±0.37ms    89.8 MB/sec    1.00      5.7±0.32ms    89.7 MB/sec
parser/pdf.js              1.00     11.6±0.41ms    34.8 MB/sec    1.01     11.7±0.53ms    34.5 MB/sec
parser/typescript.js       1.00    170.5±6.16ms    56.4 MB/sec    1.01    171.9±5.21ms    56.0 MB/sec
semantic/babylon.max.js    1.17   392.0±12.83ms    26.3 MB/sec    1.00   334.9±12.61ms    30.8 MB/sec
semantic/d3.js             1.15     49.0±2.65ms    11.2 MB/sec    1.00     42.5±2.43ms    12.9 MB/sec
semantic/lodash.js         1.08      7.7±0.54ms    66.6 MB/sec    1.00      7.1±0.54ms    72.0 MB/sec
semantic/pdf.js            1.16     19.4±1.28ms    20.7 MB/sec    1.00     16.8±1.03ms    23.9 MB/sec
semantic/typescript.js     1.13   373.0±10.83ms    25.8 MB/sec    1.00   329.6±20.75ms    29.2 MB/sec

crates/oxc_linter/src/context.rs Outdated Show resolved Hide resolved
crates/oxc_semantic/src/scope/builder.rs Outdated Show resolved Hide resolved
crates/oxc_semantic/src/symbol/table.rs Show resolved Hide resolved
@Boshen
Copy link
Member

Boshen commented Apr 3, 2023

Amazing perf win! I think we should just ban hashmaps and use SoA (strucutre of arrays) from now on 😉

@Boshen Boshen merged commit 222dcb3 into oxc-project:main Apr 3, 2023
@Boshen
Copy link
Member

Boshen commented Apr 3, 2023

Thank you! Great perf gain!

p.s. I messaged you in private on discord about some stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants