Do any engines or optimizers product TS-specific performance gains?

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • prepack

    Discontinued A JavaScript bundle optimizer.

    You can still do optimisations based purely on Javascript semantics. This is similar to the first example you give with dead function elimination, and many minifiers do some amount of this already, but you can take it to some extremes. One example of this is the (no longer maintained) Prepack project from Facebook. The core idea is to evaluate as much Javascript as possible at compile time, with the expectation that the result will probably be smaller (albeit less human readable) than the initial code.

  • assemblyscript

    A TypeScript-like language for WebAssembly.

    If you can guarantee that Typescript type hints will always be followed, you can turn it into more optimised code. Unfortunately, this means you've got to break Javascript semantics, so this means creating a new language, but people have done it. For example, AssemblyScript is a language that is designed as a strict subset of Typescript that compiles directly down to WebAssembly instead of Javascript, producing much more efficient code (most of the time). The tradeoff is that it has some slightly different semantics to Javascript, which means your existing codebase — and most of the libraries you use — will probably require some adaption before running correctly in AssemblyScript.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • closure-compiler

    A JavaScript checker and optimizer.

    I think only Google Closure Compiler did some optimizations based on its JSDoc-style annotations (see docs). If I remember correctly, types mostly allowed renaming objects' properties across modules, but most other advanced optimizations (like dead code elimination or functions inlining) didn't rely on types. In my experience properties renaming resulted in subtle, hard to discover bugs and I'd say they didn't bring much benefit.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts