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

Handle exported functions in ExportDeclarations for CJS/AMD/UMD emit #58489

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jakebailey
Copy link
Member

Fixes #58473

Not 100% certain on this but the baselines look right. Feel free to make your own better fix for this, though; this was just my naive attempt.

@jakebailey jakebailey requested a review from rbuckton May 9, 2024 18:27
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 9, 2024
Comment on lines 50 to 53
exports.default = foo;
exports.bar = foo;
exports.default = foo;
exports.bar = foo;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplication doesn't feel too great. I probably missed something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this via a Set.

exports.a = a;
exports.b = b;
exports.c = c;
exports.d = d;
exports.e = e;
exports.f = f;
exports.g = g;
exports.h = hh;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of this working, in the test case:

/**
 * @param {{x: string}} a
 * @param {{y: typeof b}} b
 */
function hh(a, b) {
    return a.x && b.y();
}
export { hh as h };

@jakebailey
Copy link
Member Author

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 9, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,154 62,154 ~ ~ ~ p=1.000 n=6
Types 50,248 50,248 ~ ~ ~ p=1.000 n=6
Memory used 193,449k (± 0.93%) 192,794k (± 0.76%) ~ 192,144k 195,787k p=0.298 n=6
Parse Time 1.29s (± 0.98%) 1.29s (± 1.44%) ~ 1.26s 1.31s p=0.622 n=6
Bind Time 0.72s 0.72s ~ ~ ~ p=1.000 n=6
Check Time 9.52s (± 0.33%) 9.52s (± 0.45%) ~ 9.48s 9.58s p=0.936 n=6
Emit Time 2.65s (± 0.53%) 2.65s (± 0.21%) ~ 2.64s 2.65s p=0.498 n=6
Total Time 14.18s (± 0.19%) 14.18s (± 0.33%) ~ 14.13s 14.25s p=0.936 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,110 944,110 ~ ~ ~ p=1.000 n=6
Types 407,141 407,141 ~ ~ ~ p=1.000 n=6
Memory used 1,221,993k (± 0.00%) 1,222,062k (± 0.00%) +69k (+ 0.01%) 1,222,039k 1,222,098k p=0.020 n=6
Parse Time 6.77s (± 0.52%) 6.80s (± 0.49%) ~ 6.75s 6.84s p=0.296 n=6
Bind Time 1.87s (± 0.48%) 1.88s (± 0.65%) ~ 1.86s 1.89s p=0.445 n=6
Check Time 31.08s (± 0.23%) 31.12s (± 0.31%) ~ 30.98s 31.22s p=0.378 n=6
Emit Time 14.80s (± 0.49%) 14.78s (± 0.52%) ~ 14.68s 14.87s p=1.000 n=6
Total Time 54.52s (± 0.25%) 54.58s (± 0.25%) ~ 54.37s 54.78s p=0.470 n=6
mui-docs - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 1,961,290 1,961,290 ~ ~ ~ p=1.000 n=6
Types 696,905 696,905 ~ ~ ~ p=1.000 n=6
Memory used 1,778,084k (± 0.00%) 1,778,075k (± 0.00%) ~ 1,778,036k 1,778,101k p=0.575 n=6
Parse Time 6.78s (± 0.17%) 6.77s (± 0.30%) ~ 6.75s 6.80s p=0.744 n=6
Bind Time 2.31s (± 0.51%) 2.31s (± 1.08%) ~ 2.27s 2.33s p=0.864 n=6
Check Time 57.01s (± 0.35%) 57.13s (± 0.56%) ~ 56.71s 57.52s p=0.810 n=6
Emit Time 0.14s 0.14s ~ ~ ~ p=1.000 n=6
Total Time 66.24s (± 0.30%) 66.35s (± 0.51%) ~ 65.89s 66.73s p=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,220,317 1,220,267 -50 (- 0.00%) ~ ~ p=0.001 n=6
Types 258,942 258,936 -6 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,334,081k (± 0.03%) 2,334,121k (± 0.03%) ~ 2,333,442k 2,335,497k p=0.810 n=6
Parse Time 5.01s (± 0.48%) 5.01s (± 1.10%) ~ 4.95s 5.11s p=0.687 n=6
Bind Time 1.87s (± 0.73%) 1.87s (± 0.48%) ~ 1.86s 1.88s p=0.803 n=6
Check Time 33.51s (± 0.39%) 33.57s (± 0.26%) ~ 33.44s 33.71s p=0.575 n=6
Emit Time 2.64s (± 2.26%) 2.66s (± 1.42%) ~ 2.60s 2.71s p=0.873 n=6
Total Time 43.05s (± 0.32%) 43.11s (± 0.32%) ~ 42.86s 43.27s p=0.298 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,220,317 1,220,267 -50 (- 0.00%) ~ ~ p=0.001 n=6
Types 258,942 258,936 -6 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,410,712k (± 0.02%) 2,435,652k (± 2.49%) ~ 2,409,730k 2,559,612k p=0.575 n=6
Parse Time 7.79s (± 1.18%) 7.79s (± 1.34%) ~ 7.62s 7.93s p=0.936 n=6
Bind Time 2.51s (± 0.60%) 2.50s (± 1.10%) ~ 2.47s 2.55s p=0.686 n=6
Check Time 49.46s (± 0.27%) 49.50s (± 0.22%) ~ 49.38s 49.68s p=0.575 n=6
Emit Time 3.89s (± 3.70%) 3.89s (± 1.85%) ~ 3.82s 3.98s p=0.810 n=6
Total Time 63.63s (± 0.34%) 63.69s (± 0.43%) ~ 63.37s 64.11s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 256,476 256,426 -50 (- 0.02%) ~ ~ p=0.001 n=6
Types 104,239 104,233 -6 (- 0.01%) ~ ~ p=0.001 n=6
Memory used 425,383k (± 0.02%) 425,362k (± 0.03%) ~ 425,281k 425,568k p=0.423 n=6
Parse Time 3.35s (± 0.78%) 3.37s (± 0.67%) ~ 3.35s 3.40s p=0.279 n=6
Bind Time 1.30s (± 0.93%) 1.31s (± 0.64%) ~ 1.29s 1.31s p=1.000 n=6
Check Time 17.74s (± 0.34%) 17.69s (± 0.47%) ~ 17.58s 17.82s p=0.295 n=6
Emit Time 1.37s (± 2.15%) 1.37s (± 1.26%) ~ 1.35s 1.39s p=0.628 n=6
Total Time 23.76s (± 0.31%) 23.73s (± 0.46%) ~ 23.59s 23.90s p=0.689 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,575 224,575 ~ ~ ~ p=1.000 n=6
Types 93,785 93,785 ~ ~ ~ p=1.000 n=6
Memory used 369,818k (± 0.04%) 369,734k (± 0.02%) ~ 369,635k 369,855k p=0.378 n=6
Parse Time 2.85s (± 0.75%) 2.85s (± 0.87%) ~ 2.81s 2.88s p=1.000 n=6
Bind Time 1.59s (± 1.17%) 1.58s (± 0.77%) ~ 1.57s 1.60s p=0.933 n=6
Check Time 15.56s (± 0.21%) 15.57s (± 0.42%) ~ 15.51s 15.66s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 19.99s (± 0.22%) 20.01s (± 0.42%) ~ 19.91s 20.12s p=0.810 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,810,147 2,810,147 ~ ~ ~ p=1.000 n=6
Types 953,583 953,583 ~ ~ ~ p=1.000 n=6
Memory used 2,981,816k (± 0.01%) 2,981,795k (± 0.00%) ~ 2,981,644k 2,982,017k p=0.689 n=6
Parse Time 16.93s (± 0.28%) 16.95s (± 0.20%) ~ 16.91s 16.99s p=0.466 n=6
Bind Time 5.04s (± 2.20%) 5.02s (± 0.51%) ~ 4.98s 5.05s p=0.373 n=6
Check Time 91.37s (± 3.45%) 90.68s (± 3.59%) ~ 88.11s 94.89s p=0.810 n=6
Emit Time 26.63s (± 9.58%) 27.41s (± 8.72%) ~ 24.30s 29.26s p=0.423 n=6
Total Time 139.97s (± 0.43%) 140.06s (± 0.64%) ~ 138.99s 141.16s p=1.000 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 265,866 265,866 ~ ~ ~ p=1.000 n=6
Types 108,424 108,424 ~ ~ ~ p=1.000 n=6
Memory used 410,482k (± 0.01%) 410,465k (± 0.01%) ~ 410,419k 410,498k p=0.471 n=6
Parse Time 3.84s (± 1.25%) 3.84s (± 0.65%) ~ 3.80s 3.87s p=0.872 n=6
Bind Time 1.66s (± 0.89%) 1.66s (± 0.45%) ~ 1.65s 1.67s p=0.934 n=6
Check Time 16.90s (± 0.29%) 16.92s (± 0.43%) ~ 16.85s 17.01s p=0.747 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.40s (± 0.15%) 22.42s (± 0.32%) ~ 22.34s 22.53s p=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 524,576 524,576 ~ ~ ~ p=1.000 n=6
Types 178,847 178,847 ~ ~ ~ p=1.000 n=6
Memory used 462,578k (± 0.01%) 462,562k (± 0.02%) ~ 462,458k 462,736k p=0.378 n=6
Parse Time 3.89s (± 0.22%) 3.88s (± 0.35%) ~ 3.87s 3.90s p=0.804 n=6
Bind Time 1.44s (± 0.84%) 1.44s (± 0.76%) ~ 1.42s 1.45s p=0.677 n=6
Check Time 22.48s (± 0.90%) 22.42s (± 0.82%) ~ 22.22s 22.66s p=0.689 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.80s (± 0.71%) 27.75s (± 0.64%) ~ 27.55s 27.97s p=0.748 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.5.0 regression - Named exports of functions are not emitted for CommonJS
2 participants