Skip to content

Isolated declarations errors #58201

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

Merged
merged 27 commits into from
Apr 19, 2024

Conversation

dragomirtitian
Copy link
Contributor

@dragomirtitian dragomirtitian commented Apr 15, 2024

Added command line flag for isolated declarations that will report errors on constructs that can't easily be inferred from local information.

Some examples (not an exhaustive list):

// ❌ Expressions must not use information outside the expression (we can't know what the call will return)
export const nBad = Math.random();
//                  ^^^^^^^^^^^^^
// Variable must have an explicit type annotation with --isolatedDeclarations.ts(9010)

export const nOk: number = Math.random();

export const lOk = 1;

// ❌ Expressions must not reference other variables
export const refConst = lOk;
//                      ^^^
// Variable must have an explicit type annotation with --isolatedDeclarations.

// ❌ Inferred return types are not supported
export function noReturn(a: number) { }
//              ^^^^^^^^
// Function must have an explicit return type annotation with --isolatedDeclarations.

export function explicitReturnOk(a: number): void { }

// ✔ Object literals are supported 
export const colors = {
    'blue': 0x0000FF,
    'red': 0xFF0000,
    'green': 0x00FF00,
} as const

// ✔ Mutable object literals are also supported
export const point = {
    x: 1,
    y: 1,
    dist(): number {
        return Math.sqrt(this.x * this.x + this.y * this.y);
    }
}

// ❌ Spread operators are not supported
export const newPoint = { ...point };
//                        ^^^^^^^^
// Objects that contain spread assignments can't be inferred with --isolatedDeclarations.

// ❌ Mutable arrays are not supported
export const values = [1, 2, 3]
//                    ^^^^^^^^^
// Only const arrays can be inferred with --isolatedDeclarations.ts(9017)

// ✔ Const arrays are supported
export const directions = ["UP", "DOWN", "LEFT", "RIGHT"] as const

// ✔ Function expressions are supported if all types are specified
export const component = (props: { name: string }): string => "";

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Apr 15, 2024
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@typescript-bot
Copy link
Collaborator

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.

export function createSyntacticTypeNodeBuilder(options: CompilerOptions) {
const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");

return {
Copy link
Member

Choose a reason for hiding this comment

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

These will probably benefit from caching their result - declaration emit is actually invoked twice right now, once for the diagnostics before emit, and once later for the actual emit (the perils of declaration emit being blocked on the presence of errors). Keeping a cache of nodes for which the result has already been computed should save some time, since it's basically guaranteed every node will have these called twice on them (and they only need to report the diagnostic the first time around).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have two questions with regard to this:

  1. The true/false result is less important, the errors are generated through calling reportInferenceFallback on the actual node that causes the issue. Should this be caching the nodes (as there could be multiple) that caused the fallback to inference?

  2. Currently we return true/false but the final end state is that this is integrated into the NodeBuilder in the checker and that it will actually generate new type nodes instead. I don't think caching the synthetic type nodes is something the current NodeBuilder does. Am I wrong about this?

Copy link
Member

Choose a reason for hiding this comment

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

The true/false result is less important, the errors are generated through calling reportInferenceFallback on the actual node that causes the issue. Should this be caching the nodes (as there could be multiple) that caused the fallback to inference?

You could, but probably don't need to. If you have a cached result, the diagnostics should have already been emitted, so you'll just issue duplicates that'll get deduped anyway.

I don't think caching the synthetic type nodes is something the current NodeBuilder does. Am I wrong about this?

Yes, actually. typeParameterToName has caching, since the same parameter often gets serialized many times, though you're right that there's no top-level cache.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

A couple of comments--I haven't had time to go find the JSDoc utilities I'm thinking of, though.

@@ -43,7 +43,7 @@ exitCode:: ExitStatus.Success


//// [/src/project/class1.d.ts]
declare const a = 1;
declare const a: MagicNumber;
Copy link
Member

Choose a reason for hiding this comment

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

How did this end up changing? I think it's probably a good change, but it does seem odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In shouldPrintWithInitializer I now test specifically if a type annotation already exists.

    function shouldPrintWithInitializer(node: Node): node is CanHaveLiteralInitializer & { initializer: Expression; } {
        return canHaveLiteralInitializer(node)
            && !node.type // <- New test 
            && !!node.initializer
            && resolver.isLiteralConstDeclaration(getParseTreeNode(node) as CanHaveLiteralInitializer); // TODO: Make safea
    }

Copy link
Member

Choose a reason for hiding this comment

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

Whatever made us ignore the type annotation here in the first place is odd. I can only get it to repro with the same global-type-alias-referencing-a-default-expr-type structure as is in this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did look into it a very long time ago. I was something about the freshness of the literal type. But if the type annotation is there then there is no reason to look further and it is more in line with what an external tool would need to do as well.

Copy link
Member

Choose a reason for hiding this comment

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

We're probably failing to widen (and strip literal freshness) from export default expr types. Or the typeof type operation of them does, at least. Unsure. It's probably a bug.

Copy link
Member

Choose a reason for hiding this comment

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

IIRC we still haven't solved the problem of freshness in general when it comes to isolatedDeclarations, either...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In what sense? ensureNoInitializer will emit an error if the initializer is not a primitive. It is true that if you add the annotation, the meaning will not be exactly the same though.

const Original = 1;
const Alias = Original; // adding :1 here will chnage the type of v
let v = Alias; // v is number if Alias is not annotated, or 1 if const Alias:1 

Playground Link

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to #55860 #55439 etc.

Also, Symbol freshness; I tried my hand at fixing that a bit ago and was not successful.

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Largely this seems OK, but there are two larger classes of things to move - a lot of the context.addDiagnostic calls being made in the transform don't seem to depend on any emit-related information - all that can should be moved forward into the checker, probably (generally, we prefer being able to emit diagnostics without emitting actual output wherever possible - removing the existing cases in declaration emit that issue errors late is a long-standing backlog item). isolatedModules works that way already, anyway. Additionally, a lot of the new declaration diagnostic selection logic should get moved to src\compiler\transformers\declarations\diagnostics.ts, since that's where all the other declaration emit diagnostic selection helpers already are. Lastly, there are some other small issues not related to those two larger themes. I've mostly avoided nits for expressionToTypeNode.ts, since I know it's where a lot of follow-up changes are occurring.

syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
}
context.flags |= NodeBuilderFlags.NoSyntacticPrinter;
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);

(the function referenced here should be renamed) and the containing function should be renamed to expressionOrTypeToTypeNode. As-is, this is still only being invoked at that withContext callsite (which should also be expressionOrTypeToTypeNode once this is renamed), so that NoSyntacticPrinter flag isn't even doing anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expressionOrTypeToTypeNodeHelper (after rename) may call typeToTypeNodeHelper which in turn will call serializeTypeForDeclaration and serializeReturnTypeForSignature and these would perform the check again. I can refactor those into serializeTypeForDeclarationHelper and serializeReturnTypeForSignatureHelper which do not perform the check and serializeTypeForDeclaration and serializeReturnTypeForSignature which would only be called from the top level. This would ensure the code does not check multiple times the same expression, and would remove the need for the NoSyntacticPrinter flag.

The flag will disappear in the next PRs. It's definitely not something that will remain. When the syntactic builder actually builds the types and falls back to the checked builder when it can't the problem of duplicate checks will go away.

Should I do the serializeTypeForDeclarationHelper and serializeReturnTypeForSignatureHelper refactor for now? Or ca we live with this until after the beta?

@dragomirtitian dragomirtitian force-pushed the isolated-declarations-errors branch from 349e65a to 0b83d8a Compare April 18, 2024 22:05
Co-authored-by: Sheetal Nandi <[email protected]>
@dragomirtitian dragomirtitian force-pushed the isolated-declarations-errors branch from f184551 to 5f3721c Compare April 19, 2024 18:18
@weswigham
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 19, 2024

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

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@weswigham Here are the results of running the user tests comparing main and refs/pull/58201/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @weswigham, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@weswigham
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
Angular - node (v18.15.0, x64)
Memory used 297,128k (± 0.00%) 297,250k (± 0.01%) +122k (+ 0.04%) 297,176k 297,284k p=0.005 n=6
Parse Time 2.68s (± 0.24%) 2.69s (± 0.60%) ~ 2.68s 2.72s p=0.340 n=6
Bind Time 0.81s (± 0.63%) 0.81s (± 0.50%) ~ 0.80s 0.81s p=0.114 n=6
Check Time 8.37s (± 0.29%) 8.38s (± 0.19%) ~ 8.37s 8.41s p=0.232 n=6
Emit Time 7.06s (± 0.42%) 7.10s (± 0.20%) +0.04s (+ 0.54%) 7.08s 7.12s p=0.035 n=6
Total Time 18.93s (± 0.21%) 18.98s (± 0.14%) +0.05s (+ 0.25%) 18.95s 19.02s p=0.043 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,020k (± 0.96%) 193,707k (± 1.04%) ~ 191,687k 195,669k p=0.298 n=6
Parse Time 2.03s (± 0.31%) 2.03s (± 0.31%) ~ 2.02s 2.04s p=1.000 n=6
Bind Time 1.07s (± 0.48%) 1.07s (± 0.70%) ~ 1.06s 1.08s p=0.241 n=6
Check Time 14.06s (± 0.41%) 14.03s (± 0.32%) ~ 13.96s 14.08s p=0.422 n=6
Emit Time 3.90s (± 0.64%) 3.94s (± 3.75%) ~ 3.85s 4.24s p=0.747 n=6
Total Time 21.05s (± 0.23%) 21.07s (± 0.55%) ~ 21.00s 21.30s p=0.872 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,752,869k (± 0.00%) 1,752,963k (± 0.00%) +94k (+ 0.01%) 1,752,906k 1,753,087k p=0.008 n=6
Parse Time 8.07s (± 0.86%) 8.07s (± 0.36%) ~ 8.04s 8.12s p=0.872 n=6
Bind Time 2.71s (± 0.77%) 2.72s (± 0.60%) ~ 2.70s 2.75s p=0.142 n=6
Check Time 66.68s (± 0.27%) 66.58s (± 0.34%) ~ 66.37s 66.94s p=0.378 n=6
Emit Time 0.16s (± 0.00%) 0.17s (± 6.44%) ~ 0.16s 0.18s p=0.071 n=6
Total Time 77.62s (± 0.17%) 77.53s (± 0.29%) ~ 77.31s 77.86s p=0.471 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,308,082k (± 0.04%) 2,315,484k (± 0.02%) +7,402k (+ 0.32%) 2,315,027k 2,316,533k p=0.005 n=6
Parse Time 7.42s (± 1.18%) 7.52s (± 0.65%) ~ 7.46s 7.60s p=0.230 n=6
Bind Time 2.73s (± 0.91%) 2.72s (± 0.84%) ~ 2.68s 2.74s p=0.747 n=6
Check Time 49.14s (± 0.71%) 49.27s (± 0.54%) ~ 48.78s 49.58s p=0.297 n=6
Emit Time 4.01s (± 3.15%) 3.92s (± 2.45%) ~ 3.76s 4.05s p=0.298 n=6
Total Time 63.32s (± 0.46%) 63.44s (± 0.44%) ~ 62.95s 63.76s p=0.378 n=6
self-build-src-public-api - node (v18.15.0, x64)
Memory used 2,382,778k (± 0.05%) 2,389,386k (± 0.04%) +6,608k (+ 0.28%) 2,388,481k 2,391,128k p=0.005 n=6
Parse Time 7.67s (± 0.81%) 7.66s (± 0.48%) ~ 7.62s 7.73s p=0.873 n=6
Bind Time 2.61s (± 5.10%) 2.75s (± 1.31%) ~ 2.71s 2.81s p=0.173 n=6
Check Time 49.47s (± 0.78%) 49.20s (± 0.34%) ~ 49.00s 49.44s p=0.378 n=6
Emit Time 3.94s (± 1.47%) 4.03s (± 3.53%) ~ 3.90s 4.31s p=0.149 n=6
Total Time 63.70s (± 0.59%) 63.66s (± 0.20%) ~ 63.50s 63.85s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Memory used 419,187k (± 0.01%) 421,189k (± 0.01%) +2,002k (+ 0.48%) 421,168k 421,224k p=0.005 n=6
Parse Time 3.37s (± 1.90%) 3.41s (± 0.68%) ~ 3.38s 3.45s p=0.107 n=6
Bind Time 1.32s (± 4.49%) 1.32s (± 0.88%) ~ 1.30s 1.33s p=0.411 n=6
Check Time 17.97s (± 0.52%) 18.10s (± 0.33%) +0.13s (+ 0.72%) 18.01s 18.17s p=0.037 n=6
Emit Time 1.36s (± 1.60%) 1.38s (± 1.67%) ~ 1.35s 1.41s p=0.106 n=6
Total Time 24.02s (± 0.50%) 24.21s (± 0.19%) +0.19s (+ 0.80%) 24.14s 24.26s p=0.013 n=6
ts-pre-modules - node (v18.15.0, x64)
Memory used 368,995k (± 0.01%) 369,052k (± 0.00%) +57k (+ 0.02%) 369,024k 369,066k p=0.045 n=6
Parse Time 2.94s (± 0.73%) 2.93s (± 0.70%) ~ 2.91s 2.97s p=0.808 n=6
Bind Time 1.58s (± 1.29%) 1.59s (± 0.89%) ~ 1.57s 1.61s p=0.366 n=6
Check Time 15.68s (± 0.35%) 15.67s (± 0.25%) ~ 15.63s 15.74s p=0.936 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.20s (± 0.38%) 20.20s (± 0.28%) ~ 20.16s 20.29s p=0.808 n=6
vscode - node (v18.15.0, x64)
Memory used 2,919,645k (± 0.00%) 2,919,873k (± 0.01%) ~ 2,919,629k 2,920,655k p=0.230 n=6
Parse Time 16.56s (± 0.41%) 16.50s (± 0.25%) ~ 16.45s 16.56s p=0.124 n=6
Bind Time 4.91s (± 0.46%) 4.92s (± 0.38%) ~ 4.89s 4.94s p=0.935 n=6
Check Time 87.63s (± 0.30%) 87.42s (± 0.43%) ~ 87.00s 87.97s p=0.378 n=6
Emit Time 26.61s (± 8.02%) 28.12s (± 1.37%) ~ 27.39s 28.46s p=0.066 n=6
Total Time 135.72s (± 1.54%) 136.95s (± 0.37%) ~ 136.46s 137.85s p=0.689 n=6
webpack - node (v18.15.0, x64)
Memory used 409,616k (± 0.02%) 409,683k (± 0.01%) ~ 409,636k 409,758k p=0.128 n=6
Parse Time 4.84s (± 1.10%) 4.82s (± 0.48%) ~ 4.78s 4.85s p=0.421 n=6
Bind Time 2.02s (± 0.81%) 2.03s (± 0.96%) ~ 2.01s 2.06s p=0.869 n=6
Check Time 21.08s (± 0.39%) 21.04s (± 0.37%) ~ 20.95s 21.18s p=0.419 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 27.95s (± 0.34%) 27.89s (± 0.29%) ~ 27.79s 28.03s p=0.377 n=6
xstate-main - node (v18.15.0, x64)
Memory used 459,086k (± 0.02%) 459,249k (± 0.01%) +164k (+ 0.04%) 459,176k 459,301k p=0.008 n=6
Parse Time 4.01s (± 0.75%) 4.00s (± 0.66%) ~ 3.96s 4.03s p=0.624 n=6
Bind Time 1.47s (± 1.19%) 1.48s (± 0.55%) ~ 1.47s 1.49s p=0.743 n=6
Check Time 22.23s (± 0.76%) 22.32s (± 0.71%) ~ 22.09s 22.53s p=0.378 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 27.71s (± 0.65%) 27.80s (± 0.64%) ~ 27.55s 28.04s p=0.471 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - 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

@typescript-bot
Copy link
Collaborator

@weswigham Here are the results of running the top 400 repos comparing main and refs/pull/58201/merge:

Everything looks good!

@jakebailey
Copy link
Member

I left some unused code behind, sorry :(

Shouldn't affect benchmarks, so

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 19, 2024

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

Command Status Results
perf test this ✅ Started

@jakebailey
Copy link
Member

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 19, 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
Angular - node (v18.15.0, x64)
Memory used 297,128k (± 0.00%) 297,245k (± 0.01%) +117k (+ 0.04%) 297,197k 297,293k p=0.005 n=6
Parse Time 2.70s (± 0.45%) 2.69s (± 0.43%) ~ 2.67s 2.70s p=0.438 n=6
Bind Time 0.81s (± 0.63%) 0.82s (± 0.67%) ~ 0.81s 0.82s p=0.640 n=6
Check Time 8.36s (± 0.40%) 8.36s (± 0.43%) ~ 8.30s 8.40s p=1.000 n=6
Emit Time 7.06s (± 0.54%) 7.10s (± 0.30%) ~ 7.06s 7.12s p=0.075 n=6
Total Time 18.93s (± 0.21%) 18.96s (± 0.26%) ~ 18.86s 18.99s p=0.145 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 192,567k (± 0.74%) 192,541k (± 0.74%) ~ 191,915k 195,446k p=0.810 n=6
Parse Time 1.33s (± 1.60%) 1.34s (± 0.90%) ~ 1.33s 1.36s p=0.359 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.57s (± 0.18%) 9.56s (± 0.35%) ~ 9.53s 9.62s p=0.517 n=6
Emit Time 2.62s (± 0.61%) 2.63s (± 0.71%) ~ 2.61s 2.66s p=0.279 n=6
Total Time 14.24s (± 0.28%) 14.26s (± 0.21%) ~ 14.23s 14.30s p=0.422 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,752,879k (± 0.00%) 1,752,988k (± 0.00%) +109k (+ 0.01%) 1,752,947k 1,753,055k p=0.037 n=6
Parse Time 9.93s (± 0.51%) 9.96s (± 0.75%) ~ 9.88s 10.09s p=0.574 n=6
Bind Time 3.33s (± 1.18%) 3.36s (± 1.05%) ~ 3.33s 3.42s p=0.375 n=6
Check Time 82.09s (± 0.25%) 81.95s (± 0.44%) ~ 81.32s 82.35s p=0.471 n=6
Emit Time 0.20s (± 4.01%) 0.20s (± 5.07%) ~ 0.19s 0.22s p=1.000 n=6
Total Time 95.55s (± 0.21%) 95.48s (± 0.32%) ~ 95.02s 95.89s p=0.810 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,308,755k (± 0.01%) 2,315,077k (± 0.05%) +6,322k (+ 0.27%) 2,313,659k 2,316,545k p=0.005 n=6
Parse Time 7.40s (± 1.32%) 7.47s (± 1.03%) ~ 7.38s 7.56s p=0.336 n=6
Bind Time 2.75s (± 1.07%) 2.72s (± 0.46%) -0.03s (- 1.21%) 2.70s 2.73s p=0.008 n=6
Check Time 49.39s (± 0.69%) 49.37s (± 0.62%) ~ 49.06s 49.84s p=0.810 n=6
Emit Time 3.95s (± 1.71%) 3.95s (± 3.65%) ~ 3.78s 4.15s p=1.000 n=6
Total Time 63.52s (± 0.46%) 63.51s (± 0.65%) ~ 63.11s 64.14s p=1.000 n=6
self-build-src-public-api - node (v18.15.0, x64)
Memory used 2,383,194k (± 0.04%) 2,389,284k (± 0.04%) +6,091k (+ 0.26%) 2,388,194k 2,391,157k p=0.005 n=6
Parse Time 7.64s (± 1.10%) 7.66s (± 0.34%) ~ 7.62s 7.69s p=0.298 n=6
Bind Time 2.70s (± 3.86%) 2.74s (± 0.64%) ~ 2.72s 2.77s p=0.747 n=6
Check Time 49.52s (± 0.74%) 49.24s (± 0.56%) ~ 48.83s 49.55s p=0.173 n=6
Emit Time 3.93s (± 3.42%) 4.09s (± 3.24%) ~ 3.91s 4.26s p=0.066 n=6
Total Time 63.79s (± 0.46%) 63.74s (± 0.44%) ~ 63.38s 64.08s p=0.630 n=6
self-compiler - node (v18.15.0, x64)
Memory used 419,276k (± 0.01%) 421,242k (± 0.01%) +1,965k (+ 0.47%) 421,197k 421,284k p=0.005 n=6
Parse Time 4.20s (± 0.60%) 4.19s (± 1.83%) ~ 4.04s 4.24s p=0.466 n=6
Bind Time 1.57s (± 1.99%) 1.64s (± 1.87%) 🔻+0.07s (+ 4.46%) 1.62s 1.70s p=0.005 n=6
Check Time 22.24s (± 0.34%) 22.32s (± 0.28%) ~ 22.24s 22.42s p=0.092 n=6
Emit Time 1.71s (± 0.96%) 1.73s (± 0.70%) ~ 1.71s 1.74s p=0.285 n=6
Total Time 29.72s (± 0.25%) 29.88s (± 0.23%) +0.16s (+ 0.55%) 29.80s 29.97s p=0.010 n=6
ts-pre-modules - node (v18.15.0, x64)
Memory used 369,059k (± 0.03%) 369,168k (± 0.04%) ~ 369,019k 369,405k p=0.230 n=6
Parse Time 2.44s (± 0.85%) 2.43s (± 0.81%) ~ 2.40s 2.45s p=0.871 n=6
Bind Time 1.32s (± 1.34%) 1.33s (± 1.00%) ~ 1.31s 1.34s p=0.128 n=6
Check Time 13.29s (± 0.15%) 13.36s (± 0.17%) +0.07s (+ 0.54%) 13.32s 13.38s p=0.005 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 17.04s (± 0.20%) 17.12s (± 0.11%) +0.08s (+ 0.49%) 17.10s 17.14s p=0.005 n=6
vscode - node (v18.15.0, x64)
Memory used 2,920,642k (± 0.00%) 2,920,814k (± 0.00%) +172k (+ 0.01%) 2,920,642k 2,920,944k p=0.045 n=6
Parse Time 16.50s (± 0.33%) 16.49s (± 0.27%) ~ 16.43s 16.57s p=0.421 n=6
Bind Time 4.91s (± 0.58%) 4.93s (± 0.30%) ~ 4.91s 4.95s p=0.224 n=6
Check Time 87.81s (± 0.45%) 87.73s (± 0.36%) ~ 87.39s 88.13s p=0.630 n=6
Emit Time 26.05s (± 8.93%) 25.34s (± 8.46%) ~ 23.87s 28.16s p=0.810 n=6
Total Time 135.27s (± 1.62%) 134.49s (± 1.54%) ~ 132.82s 137.30s p=0.378 n=6
webpack - node (v18.15.0, x64)
Memory used 409,585k (± 0.01%) 409,686k (± 0.02%) ~ 409,567k 409,805k p=0.066 n=6
Parse Time 4.83s (± 0.54%) 4.81s (± 1.10%) ~ 4.74s 4.86s p=0.687 n=6
Bind Time 2.02s (± 0.66%) 2.02s (± 0.73%) ~ 2.00s 2.04s p=0.681 n=6
Check Time 21.05s (± 0.64%) 21.08s (± 0.55%) ~ 20.90s 21.22s p=0.748 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 27.90s (± 0.51%) 27.91s (± 0.49%) ~ 27.72s 28.05s p=0.572 n=6
xstate-main - node (v18.15.0, x64)
Memory used 459,129k (± 0.01%) 459,205k (± 0.01%) +76k (+ 0.02%) 459,137k 459,256k p=0.037 n=6
Parse Time 4.01s (± 0.56%) 3.99s (± 0.67%) ~ 3.96s 4.02s p=0.195 n=6
Bind Time 1.48s (± 0.60%) 1.47s (± 0.67%) ~ 1.45s 1.48s p=0.070 n=6
Check Time 22.36s (± 0.55%) 22.37s (± 0.61%) ~ 22.16s 22.47s p=0.571 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 27.85s (± 0.44%) 27.83s (± 0.40%) ~ 27.66s 27.91s p=0.872 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - 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

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

🎉

We think the memory increase is just the increased cache size from NoSyntacticPrinter, but that can be fixed in a follow-up (and the difference is small).

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

Successfully merging this pull request may close these issues.

9 participants