Skip to content

feature request - faster compiler #38732

@sod

Description

@sod

Preamble

What if a build that requires 300 seconds now would be done in 3 seconds instead? Without cache? This currently becomes reality for VDOM based frameworks like vue & react.

With angular it's not that easy, as the framework is basicly a compiler.

🚀 feature request

Faster compiler.

Description

Pretty sure the angular team loves performance and compiler stuff. So I just wanna see what you think about this.

There are currently two typescript to javascript compilers in development:

https://github.com/evanw/esbuild (written in go)
https://github.com/swc-project/swc (written in rust)

In the wild:
esbuild is used by vite - maybe the next official bundler for vue 3
swc is used by deno - a secure alternative to node.js, which natively understands typescript files

The performance is pretty remarkable. The performance gains are in the 100x ballpark. So if your typical webpack + loader written in javascript builds something in 50s, these two do the same in 500ms! So the current javascript based approaches clearly are bottlenecking in what V8 is capable of.

We switched our jest unit tests from ts-jest to swc-jest and the runtime went down from 50s to 11s - pretty much just the compute of executing the suite itself is left, the compile effort nearly disappears. Of course the tests run in JIT mode. If we had an angular compiler that fast, this could be even more swift.

swc in particular may be interesting for angular, as the deno team right now tries to boost the typescript performance if they can just generate the AST via swc. Maybe you could do something similar. Get the AST from swc.

Of course you are google. Maybe V8 just needs some optimizations for parsers. Sure thats not important for browser performance. But so much of the javascript tooling right now relies on V8. If rust or go can do the same task in a 1/100 of the time, there clearly seems to be some low hanging fruit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerIssues related to `ngc`, Angular's template compilerarea: performanceIssues related to performanceneeds: discussionIndicates than an issue is an open discussion

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions