Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convert the codebase to modules#51387

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jakebailey merged 36 commits intomicrosoft:mainfromjakebailey:typeformer-2
Nov 7, 2022

Conversation

jakebailey
Copy link
Member

@jakebaileyjakebailey commentedNov 2, 2022
edited
Loading

This is it; the PR that converts the TypeScript repo from namespaces to modules.

TL;DR: The TypeScript compiler is now implemented internally with modules, not namespaces. The compiler is now10-25% faster.tsc is now30% faster to start. Our npm package is now43% smaller. More improvements are in the works.

If you're reading this and the 5.0 beta is out, now that the above results were as of this PR; the final performance change of TS 5.0 is different!

Closes#35210
Closes#39247
Closes#49037
Closes#49332
Closes#50758
For#27891
For#32949
For#34617

For those who are looking at the diff and wondering how they can see what this PRactually does, consider looking at each commit, or look at my silly stacked PR gerrit-clone thing atjakebailey#1 (which I will try to keep up to date).

Want to try this out now? Set this in yourpackage.json:

"typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-51387-49"

(Or, wait until the next nightly after this is merged.)

How?

The bulk of the work to convert the repo to modules is done via automation, followed by a load of changes by hand to completely restructure our build system. To see the conversion process, take a look at the commits in this PR, each of which come with their own descriptive commit message.

In short, thetypeformer project recreates our old namespaces as "barrel" modules, reexporting each file from the barrel module corresponding to its original namespace. Symbols which previously were available "globally" via namespaces are now imported in big import blocks at the top of each file, in such a way that the final code looks nearly identical to the input (but unindented one level).

This, with a little hand modification, gets us to a place where we can emit CJS and have everything working.

However, this turns out to incur a big performance penalty; our old TS namespaces were just objects, but CJS imports/exports are more expensive than plain objects. Additionally, many consumers currently expect to be able to load TS as a single file, and that same file must be usable in Node and the browser. Unless we wanted to change that expectation and break the world, we needed to bundle.

As an experiment while working on this conversion, I tried simply runningesbuild on our source files directly; with a little more tweaking, I was able to produce a working output for our codebase. Unexpectedly, this also brought major performance wins in our benchmarks (see the next section). Those performance benefits (and speedy build times) were too good to pass up, and so, our main JS outputs are now produced by esbuild.

To mitigate the risk of not usingtsc's output, I have created a--bundle=false mode for our build. This mode usestsc to emit CJS, producing modules matchingsrc 1:1. This is tested in CI so we can reliably switch back totsc's CJS emit if needed. The new build is also constructed such that it'd be easy to transition to running a bundler ontsc's ESM emit (rather than directly onsrc).

Since our outputs are bundled, we needed a way to "bundle" our d.ts files too. To handle this, I wrote a small-ish (400 line) d.ts bundler that can serve our needs. This bundler is "dumb" and cannot handle cases that a more widely-usable bundler (like api-extractor) should, e.g. properly renaming types with the same name but declared in separate files or avoiding aliasing globals, which are cases that we can avoid or ignore, respectively.

Benefits for users of TypeScript

Firstly, the performance of the compiler has increased byanywhere from10 to 25%. This largely thanks to scope lifting. TypeScript namespaces are emitted as a series of IIFEs which push properties onto a single object. Non-local accesses to exports of that namespace are implicitly fully qualified, incurring the overhead of an object access. With modules, all of our internal helpers have been lifted to the top and are available for direct calls.

Secondly, our package is now~43% smaller (from 63.6 MB down to 35.6 MB). This is due in part to dropping some redundant files from our package, includingtypescriptServices.js, which was identical totypescript.js (see the breaking changes section below), a change in the indentation used in our bundle files (4 spaces -> 2 spaces), plus a large amount of tree shaking intsc.js andtypingsInstaller.js. TypeScript 4.9 was made smaller by 2 MB already (thanks to#50421), so this is excellent progress.

Finally, as a result of both of the previous performance improvements (faster code and less of it),tsc.js is30% faster to start andtypescript.js (our public API) is10% faster to import. As we improve performance and code size, these numbers are likely to improve. We now include these metrics in our benchmarks to track over time and in relevant PRs.

Benefits for the TypeScript team (and contributors)

For those who work on TypeScript itself, this change comes with a number of important benefits.

Now that we are modules, we are dogfooding the module experience. Effectively everyone is using modules and has been for a long time, but we've been using namespaces. This left us unable to experience things like auto-imports, giant import blocks, etc, ourselves. (During testing of this PR, we found multiple interesting auto-import and quick fix bugs; win!)

Being modules also provides us the ability to start integrating excellent external tooling into our build process. As previously mentioned, our JS outputs are now produced by esbuild. This lets us start running tests in seconds (or less), representing a significant shortening of the develop/test/debug loop.1 Of course, this is potentially limiting; if we need new syntax features that aren't yet implemented in esbuild, we can switch to bundling the ESM output oftsc instead, restoring the status quo.

Additionally, since I had to change the entire build process to support this conversion, it's a great time to make build changes that would normally be difficult during our typical dev cycle. This includes replacing our task runner with a lightweight alternative (we don't need too much fanciness anymore), rewriting/deleting a number of scripts, and removing/replacing outdated dependencies. After this change, ournpm audit is clean and our dev dependency count has been halved.

No, we're not yet shipping ESM

This PRdoes not convert the TypeScript package to ESM (#32949). The package still consists of a handful of un-tree-shakeable large files (though there are now fewer of them, and they are smaller). Allowing TypeScript to be packaged as ESM is a further challenge that will build on this change, but for this PR, the goal is to convert the repo'ssource files to modules without causing major breaks for downstream users. (For the future, see the "future" section below.)

Breaking changes

This conversion introduces a number of breaking changes for consumers of the TypeScript package; those usingtsc or the language service in their editor should see no changes (besides improved performance and smaller install sizes).

  • typescriptServices.js has been removed; this file was identical totypescript.js, the entrypoint for our npm package.
  • protocol.d.ts is no longer included in the package; usetsserverlibrary.d.ts'sts.server.protocol namespace instead.
    • Some elements of the protocol are not actually exported by thets.server.protocol namespace, but were emitted in the oldprotocol.d.ts file, and may need to be accessed off of thets namespace instead. SeeDon't depend on typescript protocol.d.ts vscode#163365 for an potential way to minimize changes to protocol-using codebases.
  • The output files have changed significantly; if you are patching TypeScript, you will definitely need to change your patches.
    • Since I know prettier post-processes our package to extractjust enough of the codebase to parse code, I have created aproof-of-concept that can be expanded on to achieve a similar result with the new 5.0 output by using a tool like terser or rollup to tree-shake inside of the library itself. In the future, we may be able to improve this situation by restructuring our codebase in a way that allows us to export just the parser (Create a parser npm module #34617). cc@fisker
  • The TypeScript package now targets ES2018. Prior to 5.0, our package targeted ES5 syntax and the ES2015 library, however, esbuild has a hard minimum syntax target of ES2015 (aka ES6). ES2018 was chosen as a balance between compatibility with older environments and access to more modern syntax and library features.2
    • If you are looking to run the TypeScript compiler itself in an environment older than ES2018, you will need to downlevel our package's syntax and potentially polyfill the environment. (This may have already been the case; we don't test the TypeScript compiler on EOL versions of Node in CI and we're aware of a handful of cases where we were already using helpers outside our target range unconditionally.)

The future?

The module conversion opens the door to many future improvements.

Our codebase is massively circular thanks to how easy it was to introduce cycles with namespaces. Namespace emit ordering was controlled bytsconfig.json, which allowed us to structure things "just right" and not crash, but things aren't so straightforward in modules. The modules themselves define their execution order, and the current state is one that works (even if the use of "namespace barrels" is suboptimal). But, this shouldn't be permanent; now that we are modules and it's not costly to introduce new files into the mix, we can start restructuring the codebase and unraveling our import cycles. In an ESM future, breaking these cycles may lead to improved tree shaking for those who bundle TypeScript into their codebases.

In terms of performance, a small number of namespaces remain in the codebase (Debug,Parser, others) which would benefit from being converted to modules to allow for direct calls. We also lost some performance in our parser due tolet/const (disproportionally so; the other parts of the compiler were only slightly affected but had much larger net wins). We may be able to restructure the parser to avoid the temporal dead zone performance cost.3

In terms of code size, may even be able to do some amount of ESM emitnow. A few of our bundles are not for import, only for execution (tsc,tsserver,typingsInstaller). If we are willing to drop versions of Node before ESM (Node <12), we can drop another 7 MB from our package by using esbuild's ESM code splitting for those bundles.

In the process of making bundling work, I fixedmonaco tono longer depend on the source-level structure of our package. This means that we could potentially start minifying our codebase, reducing the package size significantly. This is not without gotchas, of course; we know that there are downstream users who patch our package post-install, which is much more difficult when the output isn't predictably formatted (or effectively impossible using "patch" when minified).

On the shoulders of giants

I have many people to thank:

  • @weswigham and@elibarzilay, who authored the previous versions of the typeformer project. They did most of the hard work in conceptualizing how this could be possible and providing a base set of transforms to get it done.
  • @dsherret, for the excellentts-morph, with which I rewrote the typeformer project for excellent TS-to-TS source modification fidelity.
  • @evanw, for the excellentesbuild, which gives us speedy build times and an output that is faster for our users.
  • Everyone on the team who tested this PR out early and helped iron out the bugs. This PR touches effectively every line of code in the project; testing is key!

PR notes:

  • This PRMUST be merged via a merge commit. Squashing will break.git-blame-ignore-revs as it references specific commits in the PR thatgit blame should ignore; I want to ignore only the automated steps in this PR. I have attempted to make this PR as few commits as possible while still making sense.
  • The breaking changes listed above need to be added to the wiki (without all of my exposition).
  • Until the point at which we are ready to merge this, expect this PR to either have conflicts. The nature of this transformation means that any change tosrc inmain will cause this PR to have conflicts, and the only way to fix that is to rerun the entire transformation from scratch and force push.

Footnotes

  1. Specifically, the time it takes to to run the "local" build task (everything but tests) has been reduced from ~30s to ~20s on my machine. When changing the checker, the build time has been reduced from ~18s to ~14 seconds. When changing nothing, the build time has been reduced from 1.3s to 0.7s.

  2. ES2018 is the ECMAScript version implemented by Node 10. We could have bumped to ES2019 (Node 12), but this would only give us optional catch binding; we already conditionally use newer library features liketrimStart /trimEnd. We could have also bumped up to ES2020 (Node 14, though, seeRecommended tsconfig.json target option for Node 14 is ES2020 which is not fully supported by Node 14. #46325), which would give us native nullish coalescing and optional chaining, but it seemed like too big of a jump to drop Node 12, even if it is end-of-life and untested in our CI.

  3. In an earlier revision of this stack, I used babel to downlevellet/const tovar after bundling. This increased performance as expected, but we decided to not add this step; in the ESM future, we wouldn't want to end up with all of ourexport const declarations turning intoexport var, and avoiding the transformation simplifies the build and improves the debugging experience when loops are involved. If we change our minds, this is easy to reimplement, albeit slow.

robpalme, RyanCavanaugh, styfle, a-tarasyuk, Kyza, anuraghazra, evanw, esdmr, khawarizmus, michaelhays, and 443 more reacted with thumbs up emojihood, sattwyk, AlexXi19, luqmansen, jameskraus, binamralamsal, darrylyeo, peebeejay, meabed, hinell, and 13 more reacted with laugh emojiandrewbranch, alyahmedaly, RyanCavanaugh, styfle, savannahostrowski, gulshan, a-tarasyuk, Kyza, anuraghazra, evanw, and 280 more reacted with hooray emojiheejaechang, andrewbranch, styfle, RyanCavanaugh, theMosaad, a-tarasyuk, anuraghazra, Kyza, evanw, QuiiBz, and 223 more reacted with heart emojiandrewbranch, RyanCavanaugh, styfle, alexrock, atk, theMosaad, a-tarasyuk, Kyza, anuraghazra, ElianCordoba, and 239 more reacted with rocket emojijaydenseric, brunojppb, lzehrung, ild0tt0re, yonycalsin, devjoseluis, flipsi, seanhuggins1, dashed, codyebberson, and 29 more reacted with eyes emoji
@typescript-bot
Copy link
Collaborator

Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping@sheetalkamat,@amcasey,@mjbvz,@minestarks for you. Feel free to loop in other consumers/maintainers if necessary

@typescript-bottypescript-bot added the For Milestone BugPRs that fix a bug with a specific milestone labelNov 2, 2022
@jakebailey
Copy link
MemberAuthor

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot user test tsserver
@typescript-bot test tsserver top100
@typescript-bot run dt
@typescript-bot perf test this
@typescript-bot pack this

ryan4664, meabed, and alejandrozepeda reacted with thumbs up emoji

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the diff-based top-repos suite (tsserver) on this PR at4ddaab5. You can monitor the buildhere.

Update:The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the tarball bundle task on this PR at4ddaab5. You can monitor the buildhere.

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the extended test suite on this PR at4ddaab5. You can monitor the buildhere.

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at4ddaab5. You can monitor the buildhere.

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the diff-based user code test suite on this PR at4ddaab5. You can monitor the buildhere.

Update:The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the perf test suite on this PR at4ddaab5. You can monitor the buildhere.

Update:The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the diff-based top-repos suite on this PR at4ddaab5. You can monitor the buildhere.

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Heya@jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at4ddaab5. You can monitor the buildhere.

Update:The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commentedNov 2, 2022
edited
Loading

Hey@jakebailey, I've packed this intoan installable tgz. You can install it for testing by referencing it in yourpackage.json like so:

{    "devDependencies": {        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/137480/artifacts?artifactName=tgz&fileId=08B819ABB40DEE8CC5C34203005549FD20C0C0D9489D7C8D01E9D8A9C76FF4C102&fileName=/typescript-5.0.0-insiders.20221102.tgz"    }}

and then runningnpm install.


There is also a playgroundfor this build and annpm module you can use via"typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-51387-10".;

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparingmain andrefs/pull/51387/merge:

Everything looks good!

1 similar comment
@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparingmain andrefs/pull/51387/merge:

Everything looks good!

@zachkirsch
Copy link

Wahoo!!

OzakIOne, maranomynet, mikimaine, tonivj5, hood, SagnikPradhan, an1ndra, and KVRA reacted with thumbs up emojiOzakIOne reacted with laugh emojiOzakIOne, tavindev, hood, ricardo-rp, jleonard-r7, aloukissas, itpropro, benpsnyder, and dolfies reacted with hooray emojialoukissas reacted with heart emoji

@jakebaileyjakebailey added Breaking ChangeWould introduce errors in existing code APIRelates to the public API for TypeScript and removed Breaking ChangeWould introduce errors in existing code labelsNov 2, 2022
@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..51387
Metricmain51387DeltaBestWorst
Angular - node (v18.10.0, x64)
Memory used353,963k (± 0.02%)341,189k (± 0.02%)🟩-12,774k (- 3.61%)340,973k341,325k
Parse Time1.56s (± 0.49%)1.56s (± 1.07%)+0.01s (+ 0.51%)1.53s1.61s
Bind Time0.61s (± 0.60%)0.53s (± 1.09%)🟩-0.07s (-12.05%)0.52s0.54s
Check Time4.42s (± 0.55%)4.04s (± 0.81%)🟩-0.38s (- 8.71%)3.97s4.13s
Emit Time4.93s (± 0.64%)4.24s (± 0.68%)🟩-0.68s (-13.86%)4.16s4.28s
Total Time11.51s (± 0.46%)10.38s (± 0.54%)🟩-1.13s (- 9.83%)10.22s10.48s
Compiler-Unions - node (v18.10.0, x64)
Memory used200,772k (± 0.62%)189,497k (± 0.65%)🟩-11,275k (- 5.62%)184,501k190,132k
Parse Time0.60s (± 1.33%)0.62s (± 0.76%)+0.02s (+ 3.49%)0.61s0.63s
Bind Time0.36s (± 0.94%)0.33s (± 1.04%)🟩-0.04s (- 9.92%)0.32s0.33s
Check Time5.37s (± 0.75%)4.97s (± 0.80%)🟩-0.40s (- 7.41%)4.88s5.07s
Emit Time1.81s (± 0.81%)1.53s (± 0.96%)🟩-0.28s (-15.57%)1.50s1.57s
Total Time8.15s (± 0.71%)7.46s (± 0.63%)🟩-0.70s (- 8.54%)7.35s7.59s
Monaco - node (v18.10.0, x64)
Memory used331,748k (± 0.01%)320,323k (± 0.01%)🟩-11,425k (- 3.44%)320,228k320,396k
Parse Time1.17s (± 0.65%)1.16s (± 1.01%)-0.01s (- 0.94%)1.13s1.18s
Bind Time0.56s (± 1.25%)0.49s (± 0.98%)🟩-0.07s (-13.19%)0.48s0.50s
Check Time4.31s (± 0.90%)3.87s (± 0.64%)🟩-0.44s (-10.31%)3.81s3.93s
Emit Time2.61s (± 0.72%)2.24s (± 0.82%)🟩-0.38s (-14.43%)2.21s2.28s
Total Time8.66s (± 0.71%)7.75s (± 0.57%)🟩-0.91s (-10.52%)7.67s7.86s
TFS - node (v18.10.0, x64)
Memory used294,811k (± 0.01%)283,086k (± 0.15%)🟩-11,725k (- 3.98%)282,571k284,787k
Parse Time0.94s (± 1.05%)0.96s (± 1.28%)+0.02s (+ 2.56%)0.93s1.00s
Bind Time0.60s (± 3.95%)0.45s (± 5.92%)🟩-0.15s (-25.67%)0.42s0.55s
Check Time4.01s (± 0.67%)3.79s (± 0.63%)🟩-0.22s (- 5.49%)3.72s3.83s
Emit Time2.63s (± 0.60%)2.18s (± 0.76%)🟩-0.45s (-17.25%)2.15s2.21s
Total Time8.18s (± 0.72%)7.38s (± 0.40%)🟩-0.81s (- 9.86%)7.32s7.45s
material-ui - node (v18.10.0, x64)
Memory used439,901k (± 0.01%)428,116k (± 0.02%)-11,785k (- 2.68%)428,021k428,314k
Parse Time1.37s (± 0.84%)1.34s (± 1.05%)-0.02s (- 1.68%)1.32s1.38s
Bind Time0.44s (± 1.07%)0.49s (± 1.00%)+0.05s (+12.27%)0.48s0.50s
Check Time10.83s (± 0.24%)10.07s (± 0.71%)🟩-0.76s (- 7.04%)9.91s10.22s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time12.64s (± 0.22%)11.91s (± 0.62%)🟩-0.73s (- 5.80%)11.75s12.07s
xstate - node (v18.10.0, x64)
Memory used557,292k (± 0.01%)518,650k (± 0.01%)🟩-38,642k (- 6.93%)518,577k518,712k
Parse Time1.91s (± 0.56%)1.91s (± 0.64%)0.00s ( 0.00%)1.89s1.94s
Bind Time0.69s (± 2.31%)0.78s (± 2.75%)+0.09s (+12.46%)0.73s0.82s
Check Time1.10s (± 0.62%)1.04s (± 0.96%)🟩-0.06s (- 5.52%)1.01s1.06s
Emit Time0.06s (± 0.00%)0.06s (± 5.97%)🟩-0.00s (- 5.00%)0.05s0.06s
Total Time3.76s (± 0.52%)3.78s (± 0.64%)+0.03s (+ 0.67%)3.73s3.84s
Angular - node (v16.17.1, x64)
Memory used353,451k (± 0.02%)340,567k (± 0.02%)🟩-12,885k (- 3.65%)340,356k340,667k
Parse Time1.90s (± 0.53%)1.87s (± 0.47%)-0.03s (- 1.58%)1.85s1.90s
Bind Time0.75s (± 0.89%)0.64s (± 0.76%)🟩-0.11s (-14.13%)0.64s0.66s
Check Time5.70s (± 0.46%)5.11s (± 0.55%)🟩-0.59s (-10.36%)5.05s5.17s
Emit Time6.10s (± 0.47%)5.06s (± 0.67%)🟩-1.04s (-17.11%)4.96s5.12s
Total Time14.46s (± 0.39%)12.69s (± 0.34%)🟩-1.77s (-12.22%)12.59s12.77s
Compiler-Unions - node (v16.17.1, x64)
Memory used198,088k (± 0.49%)188,067k (± 0.65%)🟩-10,021k (- 5.06%)185,981k189,586k
Parse Time0.79s (± 1.22%)0.79s (± 0.43%)+0.00s (+ 0.25%)0.78s0.79s
Bind Time0.45s (± 0.89%)0.42s (± 0.89%)🟩-0.04s (- 7.98%)0.41s0.42s
Check Time6.43s (± 0.56%)5.93s (± 0.52%)🟩-0.50s (- 7.75%)5.87s5.99s
Emit Time2.26s (± 0.85%)1.90s (± 1.02%)🟩-0.36s (-16.05%)1.86s1.94s
Total Time9.92s (± 0.34%)9.03s (± 0.50%)🟩-0.89s (- 9.01%)8.96s9.13s
Monaco - node (v16.17.1, x64)
Memory used331,211k (± 0.02%)319,611k (± 0.01%)🟩-11,600k (- 3.50%)319,554k319,651k
Parse Time1.43s (± 0.62%)1.43s (± 0.71%)-0.01s (- 0.63%)1.41s1.44s
Bind Time0.69s (± 0.84%)0.59s (± 0.50%)🟩-0.10s (-14.57%)0.59s0.60s
Check Time5.47s (± 0.58%)4.85s (± 0.50%)🟩-0.62s (-11.35%)4.82s4.90s
Emit Time3.25s (± 0.50%)2.69s (± 0.63%)🟩-0.56s (-17.28%)2.65s2.72s
Total Time10.85s (± 0.36%)9.56s (± 0.34%)🟩-1.29s (-11.91%)9.52s9.66s
TFS - node (v16.17.1, x64)
Memory used294,130k (± 0.02%)282,238k (± 0.01%)🟩-11,892k (- 4.04%)282,172k282,258k
Parse Time1.23s (± 0.89%)1.16s (± 0.71%)🟩-0.06s (- 5.21%)1.14s1.18s
Bind Time0.64s (± 1.37%)0.67s (± 3.75%)+0.03s (+ 4.35%)0.58s0.72s
Check Time5.14s (± 0.45%)4.74s (± 0.56%)🟩-0.40s (- 7.86%)4.69s4.81s
Emit Time3.49s (± 0.40%)2.74s (± 2.18%)🟩-0.75s (-21.50%)2.65s2.86s
Total Time10.50s (± 0.39%)9.31s (± 1.04%)🟩-1.19s (-11.37%)9.16s9.51s
material-ui - node (v16.17.1, x64)
Memory used439,323k (± 0.02%)427,401k (± 0.00%)-11,923k (- 2.71%)427,380k427,411k
Parse Time1.72s (± 1.19%)1.64s (± 0.81%)🟩-0.08s (- 4.88%)1.62s1.67s
Bind Time0.54s (± 0.63%)0.50s (± 1.33%)🟩-0.04s (- 6.89%)0.49s0.52s
Check Time12.44s (± 0.57%)11.58s (± 0.62%)🟩-0.87s (- 6.95%)11.47s11.77s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time14.70s (± 0.46%)13.72s (± 0.57%)🟩-0.98s (- 6.69%)13.63s13.92s
xstate - node (v16.17.1, x64)
Memory used554,924k (± 0.01%)516,288k (± 0.01%)🟩-38,636k (- 6.96%)516,155k516,473k
Parse Time2.31s (± 0.35%)2.31s (± 0.46%)-0.00s (- 0.22%)2.28s2.33s
Bind Time0.89s (± 2.01%)0.84s (± 1.77%)🟩-0.05s (- 5.17%)0.81s0.89s
Check Time1.43s (± 0.80%)1.35s (± 0.52%)🟩-0.08s (- 5.86%)1.33s1.36s
Emit Time0.07s (± 4.37%)0.06s (± 0.00%)🟩-0.01s (-11.76%)0.06s0.06s
Total Time4.70s (± 0.39%)4.57s (± 0.35%)-0.14s (- 2.89%)4.53s4.59s
Angular - node (v14.15.1, x64)
Memory used347,641k (± 0.01%)334,066k (± 0.01%)🟩-13,575k (- 3.91%)334,031k334,115k
Parse Time2.07s (± 0.45%)2.06s (± 0.51%)-0.02s (- 0.77%)2.03s2.08s
Bind Time0.80s (± 0.87%)0.70s (± 1.06%)🟩-0.10s (-12.61%)0.68s0.71s
Check Time6.00s (± 0.40%)5.52s (± 0.70%)🟩-0.48s (- 8.03%)5.45s5.60s
Emit Time6.29s (± 0.94%)5.26s (± 1.14%)🟩-1.03s (-16.34%)5.14s5.37s
Total Time15.16s (± 0.43%)13.54s (± 0.74%)🟩-1.62s (-10.71%)13.33s13.73s
Compiler-Unions - node (v14.15.1, x64)
Memory used190,940k (± 0.67%)182,029k (± 0.65%)🟩-8,911k (- 4.67%)180,480k184,472k
Parse Time0.86s (± 0.47%)0.90s (± 0.49%)+0.04s (+ 5.01%)0.89s0.91s
Bind Time0.49s (± 1.06%)0.46s (± 0.48%)🟩-0.03s (- 6.11%)0.46s0.47s
Check Time6.78s (± 0.55%)6.29s (± 0.63%)🟩-0.48s (- 7.13%)6.17s6.35s
Emit Time2.43s (± 0.88%)2.06s (± 1.60%)🟩-0.37s (-15.35%)2.02s2.17s
Total Time10.56s (± 0.39%)9.71s (± 0.40%)🟩-0.84s (- 7.98%)9.63s9.82s
Monaco - node (v14.15.1, x64)
Memory used326,563k (± 0.01%)314,468k (± 0.02%)🟩-12,095k (- 3.70%)314,372k314,561k
Parse Time1.59s (± 0.75%)1.59s (± 0.63%)-0.00s (- 0.06%)1.57s1.61s
Bind Time0.73s (± 0.41%)0.64s (± 1.10%)🟩-0.09s (-12.70%)0.63s0.66s
Check Time5.76s (± 0.39%)5.21s (± 0.25%)🟩-0.55s (- 9.58%)5.18s5.25s
Emit Time3.39s (± 0.38%)2.88s (± 0.80%)🟩-0.50s (-14.86%)2.85s2.94s
Total Time11.47s (± 0.18%)10.32s (± 0.35%)🟩-1.15s (-10.03%)10.27s10.44s
TFS - node (v14.15.1, x64)
Memory used289,789k (± 0.01%)279,265k (± 0.01%)🟩-10,525k (- 3.63%)279,185k279,325k
Parse Time1.29s (± 0.48%)1.35s (± 1.37%)+0.06s (+ 4.50%)1.31s1.39s
Bind Time0.80s (± 0.45%)0.59s (± 0.80%)🟩-0.21s (-26.24%)0.58s0.60s
Check Time5.40s (± 0.35%)5.10s (± 0.40%)🟩-0.30s (- 5.52%)5.08s5.17s
Emit Time3.61s (± 0.84%)3.06s (± 0.89%)🟩-0.55s (-15.20%)2.99s3.12s
Total Time11.11s (± 0.33%)10.11s (± 0.32%)🟩-1.00s (- 9.04%)10.03s10.17s
material-ui - node (v14.15.1, x64)
Memory used435,469k (± 0.00%)422,806k (± 0.01%)-12,663k (- 2.91%)422,708k422,860k
Parse Time1.90s (± 0.92%)1.89s (± 0.49%)-0.01s (- 0.53%)1.88s1.92s
Bind Time0.59s (± 0.62%)0.54s (± 0.96%)🟩-0.05s (- 8.02%)0.53s0.55s
Check Time12.87s (± 0.38%)12.09s (± 0.64%)🟩-0.79s (- 6.10%)11.94s12.24s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.36s (± 0.35%)14.52s (± 0.55%)🟩-0.84s (- 5.49%)14.36s14.69s
xstate - node (v14.15.1, x64)
Memory used543,999k (± 0.01%)504,396k (± 0.01%)🟩-39,603k (- 7.28%)504,336k504,458k
Parse Time2.61s (± 0.59%)2.64s (± 0.77%)+0.03s (+ 1.11%)2.60s2.69s
Bind Time0.98s (± 1.17%)0.85s (± 0.76%)🟩-0.13s (-13.33%)0.84s0.87s
Check Time1.51s (± 0.39%)1.48s (± 0.40%)-0.03s (- 1.98%)1.47s1.49s
Emit Time0.07s (± 3.14%)0.07s (± 0.00%)-0.00s (- 1.41%)0.07s0.07s
Total Time5.18s (± 0.35%)5.05s (± 0.37%)-0.13s (- 2.55%)4.99s5.07s
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-126-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.15.1, x64)
BenchmarkNameIterations
Current5138710
Baselinemain10

TSServer

Comparison Report - main..51387
Metricmain51387DeltaBestWorst
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen1,066ms (± 0.34%)1,058ms (± 0.73%)-9ms (- 0.83%)1,042ms1,081ms
Req 2 - geterr2,738ms (± 0.48%)2,525ms (± 0.85%)🟩-212ms (- 7.75%)2,488ms2,565ms
Req 3 - references191ms (± 0.97%)166ms (± 0.42%)🟩-26ms (-13.32%)165ms168ms
Req 4 - navto147ms (± 1.34%)140ms (± 2.21%)🟩-7ms (- 4.97%)137ms152ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo44ms (± 1.27%)61ms (± 2.32%)🔻+17ms (+38.58%)57ms62ms
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen1,132ms (± 0.81%)1,113ms (± 0.82%)-20ms (- 1.75%)1,087ms1,128ms
Req 2 - geterr1,616ms (± 0.58%)1,513ms (± 0.63%)🟩-103ms (- 6.38%)1,496ms1,544ms
Req 3 - references198ms (± 0.95%)176ms (± 4.29%)🟩-22ms (-11.16%)167ms196ms
Req 4 - navto161ms (± 1.18%)175ms (± 9.71%)+14ms (+ 8.83%)149ms200ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo86ms (± 6.89%)52ms (± 4.33%)🟩-34ms (-39.93%)48ms56ms
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen1,628ms (± 0.43%)1,521ms (± 0.68%)🟩-107ms (- 6.59%)1,497ms1,547ms
Req 2 - geterr570ms (± 0.63%)556ms (± 0.85%)-14ms (- 2.44%)545ms569ms
Req 3 - references52ms (± 1.28%)59ms (± 2.22%)+7ms (+13.27%)57ms62ms
Req 4 - navto207ms (± 0.85%)196ms (± 0.64%)🟩-11ms (- 5.08%)193ms198ms
Req 5 - completionInfo count3,209 (± 0.00%)3,149 (± 0.00%)-60 (- 1.87%)3,1493,149
Req 5 - completionInfo209ms (± 1.79%)210ms (± 1.29%)+1ms (+ 0.53%)205ms216ms
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen1,329ms (± 0.37%)1,309ms (± 0.50%)-20ms (- 1.52%)1,293ms1,323ms
Req 2 - geterr3,266ms (± 0.72%)3,071ms (± 0.53%)🟩-196ms (- 5.99%)3,018ms3,097ms
Req 3 - references224ms (± 1.19%)195ms (± 0.89%)🟩-30ms (-13.21%)191ms199ms
Req 4 - navto158ms (± 0.61%)157ms (± 7.29%)-1ms (- 0.63%)149ms203ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo53ms (± 1.16%)61ms (± 6.30%)+8ms (+15.44%)56ms72ms
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen1,411ms (± 0.46%)1,376ms (± 0.59%)-35ms (- 2.45%)1,356ms1,388ms
Req 2 - geterr2,123ms (± 0.48%)1,995ms (± 0.40%)🟩-129ms (- 6.06%)1,981ms2,013ms
Req 3 - references232ms (± 0.78%)199ms (± 0.79%)🟩-34ms (-14.43%)195ms202ms
Req 4 - navto172ms (± 1.22%)167ms (± 0.89%)-4ms (- 2.50%)164ms171ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo52ms (± 1.43%)56ms (± 2.13%)+4ms (+ 7.65%)55ms59ms
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen1,920ms (± 0.52%)1,814ms (± 0.52%)🟩-106ms (- 5.52%)1,792ms1,832ms
Req 2 - geterr734ms (± 0.59%)712ms (± 0.64%)🟩-22ms (- 3.02%)702ms720ms
Req 3 - references60ms (± 1.25%)67ms (± 1.26%)+7ms (+11.09%)66ms69ms
Req 4 - navto209ms (± 0.81%)198ms (± 0.94%)🟩-11ms (- 5.37%)194ms202ms
Req 5 - completionInfo count3,209 (± 0.00%)3,149 (± 0.00%)-60 (- 1.87%)3,1493,149
Req 5 - completionInfo259ms (± 0.73%)250ms (± 0.39%)🟩-9ms (- 3.36%)248ms252ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,453ms (± 0.60%)1,462ms (± 0.50%)+9ms (+ 0.63%)1,447ms1,476ms
Req 2 - geterr3,548ms (± 0.72%)3,357ms (± 0.50%)🟩-191ms (- 5.38%)3,323ms3,397ms
Req 3 - references234ms (± 0.38%)206ms (± 0.59%)🟩-28ms (-11.86%)204ms209ms
Req 4 - navto174ms (± 0.82%)165ms (± 2.29%)🟩-8ms (- 4.73%)160ms180ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo56ms (± 3.73%)65ms (± 5.19%)+9ms (+15.25%)61ms74ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,528ms (± 0.71%)1,542ms (± 0.47%)+14ms (+ 0.93%)1,524ms1,555ms
Req 2 - geterr2,332ms (± 0.68%)2,190ms (± 0.30%)🟩-142ms (- 6.09%)2,176ms2,203ms
Req 3 - references246ms (± 0.44%)215ms (± 1.03%)🟩-31ms (-12.75%)211ms220ms
Req 4 - navto184ms (± 0.65%)178ms (± 0.90%)🟩-6ms (- 3.43%)174ms180ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo55ms (± 1.35%)61ms (± 0.00%)+6ms (+10.31%)61ms61ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen2,144ms (± 0.73%)2,048ms (± 0.91%)🟩-96ms (- 4.47%)2,008ms2,080ms
Req 2 - geterr760ms (± 0.52%)746ms (± 0.33%)-14ms (- 1.83%)742ms753ms
Req 3 - references67ms (± 2.61%)73ms (± 2.18%)+7ms (+10.23%)70ms77ms
Req 4 - navto230ms (± 0.96%)221ms (± 0.63%)🟩-9ms (- 3.87%)218ms225ms
Req 5 - completionInfo count3,209 (± 0.00%)3,149 (± 0.00%)-60 (- 1.87%)3,1493,149
Req 5 - completionInfo279ms (± 1.01%)277ms (± 1.79%)-2ms (- 0.72%)268ms286ms
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-126-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.15.1, x64)
BenchmarkNameIterations
Current5138710
Baselinemain10

Startup

Comparison Report - main..51387
Metricmain51387DeltaBestWorst
tsc-startup - node (v16.17.1, x64)
Execution time158.07ms (± 0.38%)117.80ms (± 0.42%)🟩-40.27ms (-25.48%)115.63ms127.81ms
tsserver-startup - node (v16.17.1, x64)
Execution time222.85ms (± 0.30%)199.11ms (± 0.36%)🟩-23.74ms (-10.65%)195.57ms208.26ms
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time211.02ms (± 0.30%)188.57ms (± 0.37%)🟩-22.45ms (-10.64%)185.48ms197.64ms
typescript-startup - node (v16.17.1, x64)
Execution time200.94ms (± 0.31%)174.15ms (± 0.35%)🟩-26.79ms (-13.33%)171.22ms181.93ms
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-126-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
BenchmarkNameIterations
Current5138710
Baselinemain10

Developer Information:

Download Benchmark

Maxwell2022, ddaletski, ahejlsberg, bpartridge, spartanatreyu, wrslatz, tuananh, ricardo-rp, TrinTragula, taskylizard, and 8 more reacted with heart emojiVirtualTim reacted with rocket emoji

@evanw
Copy link
Contributor

Congrats! This is very exciting. I believe this PR also closes#39247.

DanielRosenwasser, alexgorbatchev, jakebailey, tonivj5, transitive-bullshit, joca-immersa, jgoz, fratzinger, maciejcieslar, rojasleon, and 20 more reacted with thumbs up emoji

@jakebailey
Copy link
MemberAuthor

jakebailey commentedNov 2, 2022
edited
Loading

It does! Thanks.

orta, tintin10q, tuananh, mkopa, itpropro, and avevlad reacted with heart emoji

@jakebailey
Copy link
MemberAuthor

Alright everyone, it's happening. See you on the other side.

bboydflo, hadeeb, gabrielmaldi, DanielRosenwasser, nk980113, and albertms10 reacted with thumbs up emojiDanielRosenwasser, razh, RyanCavanaugh, savannahostrowski, jasonlyu123, nitsky, SuperchupuDev, mschilde, chentsulin, Jack-Works, and 13 more reacted with laugh emojiwrslatz, DanielRosenwasser, razh, RyanCavanaugh, Silic0nS0ldier, savannahostrowski, robpalme, nitsky, SuperchupuDev, Kyza, and 20 more reacted with hooray emojiDanielRosenwasser, razh, RyanCavanaugh, savannahostrowski, gabro, nitsky, SuperchupuDev, Kyza, chentsulin, imranbarbhuiya, and 6 more reacted with heart emojiandrewbranch, Nemikolh, wrslatz, rubiesonthesky, oxc, DanielRosenwasser, razh, RyanCavanaugh, radekmie, Silic0nS0ldier, and 42 more reacted with rocket emoji

@jakebaileyjakebailey merged commit1d96eb4 intomicrosoft:mainNov 7, 2022
@andrewbranch
Copy link
Member

Congratulations, Jake! 🌟

DanielRosenwasser, razh, Silic0nS0ldier, savannahostrowski, RyanCavanaugh, JoshuaKGoldberg, wrslatz, sam2schwab, KhafraDev, 7rulnik, and 37 more reacted with hooray emojijakebailey, electron-space, ghishadow, Strato, and Meemaw reacted with heart emoji

@jakebailey
Copy link
MemberAuthor

jakebailey commentedNov 7, 2022
edited
Loading

If you have a PR and are struggling to figure out how to fix your branches (after realizing what happened to main), here's what I am finding works the best:

  1. git merge d83a5e1281379da54221fe39d5c0cb6ef4d1c109 to get up to speed with main just before this change.
  2. Dogit merge main, no options. The ones that try and ignore whitespace do not work.
  3. Use the new VS Code merge editor; it uses its own merge algorithm, and most of the time, you can just click "Accept Combination" and get the right result.
oxc, morajabi, shamrin, Lirhblack, ExE-Boss, albertms10, and andriyor reacted with thumbs up emoji

@jakebaileyjakebailey deleted the typeformer-2 branchNovember 7, 2022 23:53
@fiskerfisker mentioned this pull requestNov 8, 2022
4 tasks
@codyebbersoncodyebberson mentioned this pull requestJun 24, 2023
@LoganDark
Copy link

Late to the party, but if thesize of your indentation is a concern, why switch from 4 spaces to 2 spaces instead of 1 tab?

@RyanCavanaugh
Copy link
Member

Switching from 4 spaces to 2 was just an artifact of switching emitters, not really anything intentional. We're not laser-focused on the smallest-possible non-gzipped artifact, otherwise we would of course use a minifier.

LoganDark reacted with thumbs up emoji

@LoganDark
Copy link

LoganDark commentedJul 10, 2024
edited
Loading

Ah, so not necessarily a concern, just an interesting observation then.

RyanCavanaugh, jakebailey, ghishadow, and andriyor reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@DanielRosenwasserDanielRosenwasserDanielRosenwasser approved these changes

@andrewbranchandrewbranchandrewbranch approved these changes

@RyanCavanaughRyanCavanaughRyanCavanaugh approved these changes

@sheetalkamatsheetalkamatsheetalkamat approved these changes

@gary-huanggary-huanggary-huang approved these changes

@BenonardoBenonardoBenonardo approved these changes

Labels
APIRelates to the public API for TypeScriptAuthor: TeamBreaking ChangeWould introduce errors in existing codeFor Milestone BugPRs that fix a bug with a specific milestone
Projects
None yet
19 participants
@jakebailey@typescript-bot@zachkirsch@evanw@johnnyreilly@fisker@jpike88@adamburgess@cefn@haikyuu@weswigham@rchl@andrewbranch@LoganDark@RyanCavanaugh@DanielRosenwasser@sheetalkamat@gary-huang@Benonardo

[8]ページ先頭

©2009-2025 Movatter.jp