Sid (@SidChatterjee) on X

X (formerly Twitter) ·

2 min read Original article ↗

Sid on X: "A few days ago, I started rewriting the typescript compiler after I got tired of it consuming gigabytes of memory when type checking the Cloudflare dashboard Just got to 50% of the typescript compiler and conformance suite They run in 400 ms and with peak memory of 79 MB"

  • user avatar

    A few days ago, I started rewriting the typescript compiler after I got tired of it consuming gigabytes of memory when type checking the Cloudflare dashboard Just got to 50% of the typescript compiler and conformance suite They run in 400 ms and with peak memory of 79 MB

  • user avatar

    Somewhat proud of the architecture. It’s still CLI of course with an identical interface to typescript go I use a shared memory arena with interior mutability for types Completely thread safe and multithreaded

    user avatar

    I’m very actively ensuring no clones or allocations unless necessary so every single type representation is stored at most once

    user avatar

    Just got type declaration support for the typical libs done and directive support for tests That was painful Every couple of sessions, I hit an infinite loop because I forget a recursion guard or a visited set or memo

    user avatar

    The conformance and compiler tests are fantastic though, very helpful and thorough as hell (as you would expect) There’s about 15,000 of them and we now pass half

    user avatar

    I’ll publish and open source once I get to full conformance and perhaps after another memory audit

    user avatar

    I even do strutural sharing so type storage in memory is efficient across multiple tests in a suite that all import type declaration libs that have overlap

  • user avatar

    Does the "gigabytes of memory" apply to the Go-based TS 7.0 preview?