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

feat(ast): AstKind::debug_name() #665

Merged
merged 2 commits into from
Jul 31, 2023
Merged

Conversation

DonIsaac
Copy link
Contributor

Adds AstKind::debug_name(), which returns the name of an AstKind struct with a few minor details as applicable. I intentionally did not make AstKind implement Display, as this method returns minimal information. Additionally, this method only exists in debug builds. I've hidden it behind a #[cfg(debug_assertions)], so it won't affect release builds.

This code was extracted from #642, where it as created while debugging iteration over ancestor nodes. I figured it belonged in its own PR and may be useful to other devs.

@github-actions
Copy link
Contributor

Benchmark Results

Linux

group                            main                                   pr
-----                            ----                                   --
minifier/antd.js                 1.00    278.5±3.06ms    22.9 MB/sec    1.00    279.4±3.31ms    22.8 MB/sec
minifier/react.development.js    1.00      3.1±0.03ms    22.4 MB/sec    1.00      3.1±0.02ms    22.4 MB/sec
minifier/typescript.js           1.00    468.9±4.32ms    22.0 MB/sec    1.01    472.5±4.23ms    21.8 MB/sec
minifier/vue.js                  1.00     19.2±0.43ms    17.0 MB/sec    1.00     19.2±0.45ms    17.0 MB/sec
parser/antd.js                   1.00     88.7±0.78ms    71.9 MB/sec    1.01     89.5±1.30ms    71.3 MB/sec
parser/react.development.js      1.00  1007.3±12.32µs    68.3 MB/sec    1.00  1004.7±13.89µs    68.5 MB/sec
parser/typescript.js             1.01    153.5±1.56ms    67.2 MB/sec    1.00    151.8±1.24ms    68.0 MB/sec
parser/vue.js                    1.01      6.3±0.04ms    51.8 MB/sec    1.00      6.3±0.04ms    52.1 MB/sec
semantic/antd.js                 1.00     87.7±4.07ms    72.7 MB/sec    1.02     89.1±4.32ms    71.5 MB/sec
semantic/react.development.js    1.01  1023.7±28.95µs    67.2 MB/sec    1.00  1008.9±23.73µs    68.2 MB/sec
semantic/typescript.js           1.00    193.3±8.11ms    53.4 MB/sec    1.02    196.2±9.35ms    52.6 MB/sec
semantic/vue.js                  1.01      6.8±0.26ms    48.2 MB/sec    1.00      6.7±0.21ms    48.7 MB/sec

Windows

group                            main                                   pr
-----                            ----                                   --
minifier/antd.js                 1.06   351.8±12.88ms    18.1 MB/sec    1.00    330.8±8.23ms    19.3 MB/sec
minifier/react.development.js    1.00      3.3±0.05ms    20.8 MB/sec    1.00      3.3±0.04ms    20.8 MB/sec
minifier/typescript.js           1.01   526.9±14.90ms    19.6 MB/sec    1.00   521.3±13.44ms    19.8 MB/sec
minifier/vue.js                  1.00     19.9±0.58ms    16.4 MB/sec    1.00     19.8±0.36ms    16.5 MB/sec
parser/antd.js                   1.01     86.1±2.91ms    74.1 MB/sec    1.00     84.9±1.82ms    75.1 MB/sec
parser/react.development.js      1.00   941.3±16.72µs    73.1 MB/sec    1.00   940.4±16.43µs    73.2 MB/sec
parser/typescript.js             1.02    148.6±2.94ms    69.4 MB/sec    1.00    145.3±2.34ms    71.0 MB/sec
parser/vue.js                    1.00      5.8±0.07ms    56.4 MB/sec    1.02      5.9±0.08ms    55.6 MB/sec
semantic/antd.js                 1.02    103.5±6.22ms    61.6 MB/sec    1.00    101.4±5.94ms    62.9 MB/sec
semantic/react.development.js    1.00  1137.4±44.65µs    60.5 MB/sec    1.00  1140.6±32.03µs    60.3 MB/sec
semantic/typescript.js           1.02   220.8±15.54ms    46.7 MB/sec    1.00   216.0±17.95ms    47.8 MB/sec
semantic/vue.js                  1.04      7.5±0.28ms    43.2 MB/sec    1.00      7.3±0.18ms    44.8 MB/sec

@DonIsaac DonIsaac enabled auto-merge (squash) July 30, 2023 17:23
@DonIsaac DonIsaac merged commit 4754133 into main Jul 31, 2023
@DonIsaac DonIsaac deleted the don/feat/ast-kind-debug-name branch July 31, 2023 02:04
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.

2 participants