News for hackers. Stuff that matters.
Re:A 10x Faster TypeScript by Starlord2048 on Tuesday March 11, 2025 @12:17PM (#43334009)
[flagged]
Re:A 10x Faster TypeScript by noelwelsh on Tuesday March 11, 2025 @12:29PM (#43334142)
I don't think this is accurate.

Javascript is not slow because of GC or JIT (the JVM is about twice as fast in benchmarks; Go has a GC) but because JS as a language is not designed for performance. Despite all the work that V8 does it cannot perform enough analysis to recover desirable performance. The simplest example to explain is the lack of machine numbers (e.g. ints). JS doesn't have any representation for this so V8 does a lot of work to try to figure out when a number can be represented as an int, but it won't catch all cases.

As for "working solution over language politics" you are entirely pulling that out of thin air. It's not supported by the article in any way. There is discussion at https://github.com/microsoft/typescript-go/discussions/411 that mentions different points.

Re:A 10x Faster TypeScript by dleeftink on Tuesday March 11, 2025 @12:40PM (#43334296)
I think JS can really zoom if you let it. Hamsters.js, GPU.js, taichi.js, ndarray, arquero, S.js, are all solid foundations for doing things really efficiently. Sure, not 'native' performance or on the compile side, but having their computational models in mind can really let you work around the language's limitations.
Re:A 10x Faster TypeScript by jsheard on Tuesday March 11, 2025 @12:51PM (#43334461)
JS can be pretty fast if you let it, but the problem is the fastest path is extremely unergonomic. If you always take the fastest possible path you end up more or less writing asm.js by hand, or a worse version of C that doesn't even have proper structs.
Re:A 10x Faster TypeScript by dleeftink on Tuesday March 11, 2025 @12:56PM (#43334524)
I find these userland libraries particularly effective, because you'll never leave JS land, conveniently abstracting over Workers, WebGL/WebGPU and WASM.
Re:A 10x Faster TypeScript by nine_k on Tuesday March 11, 2025 @01:28PM (#43334918)
JS, interestingly, has a notion of integers, but only in the form of integer arrays, like Int16Array.

I wonder if Typescript could introduce integer type(s) that a direct TS -> native code compiler (JIT or AOT) could use. Since TS becomes valid JS if all type annotations are removed, such numbers would just become normal JS numbers from the POV of a JS runtime which does not understand TS.

Re:A 10x Faster TypeScript by maxloh on Tuesday March 11, 2025 @02:09PM (#43335372)
AssemblyScript (for WASM) and Huawei's ArkTS (for mobile apps) already exist in this landscape. However, they are too specific in their use cases and have never gained public attention.
Re:A 10x Faster TypeScript by scottlawson on Tuesday March 11, 2025 @01:54PM (#43335212)
you replied to an LLM generated comment. if you look at the posting history you can confirm it
Re:A 10x Faster TypeScript by nindalf on Tuesday March 11, 2025 @12:23PM (#43334084)
> is this the beginning of a larger trend where JS/TS tooling migrates to native implementations

No, it is not. It is a continuation of an existing trend

You may be interested in esbuild (https://github.com/evanw/esbuild), turborepo (https://github.com/vercel/turborepo), biome-js (https://github.com/biomejs/biome) are all native reimplementations of existing projects in JS/TS. esbuild is written in Go, the others in Rust.

> reveals something deeper: Microsoft prioritized shipping a working solution over language politics

Its not that "deep". I don't see the politics either way, there are clearly successful projects using both Go and Rust. The only people who see "politics" are those who see people disagreeing, are unable to understand the substance of the disagreement and decide "ah, it's just politics".

Re:A 10x Faster TypeScript by christianqchung on Tuesday March 11, 2025 @12:29PM (#43334151)
This is not accusatory, but do you write your comments with AI? I checked your profile and someone else had the same question a few days ago. It's the persistent structure of "it isn't X – it's Y" with the em dash (– not -) that makes me wonder this. Nothing to add to your comment otherwise, sorry.
Re:A 10x Faster TypeScript by mannykoum on Tuesday March 11, 2025 @12:44PM (#43334336)
Sorry for being pedantic but they are using an en dash (–) not an em dash (—) which is a little strange because the latter is usually the one meant for adding information in secondary sentences—like commas and and parentheses. In addition, in most styles, you're not supposed to add spaces around it.

So, I don't think the comment is AI-generated for this reason.

Re:A 10x Faster TypeScript by CharlesW on Tuesday March 11, 2025 @01:39PM (#43335020)
"The en-dash is also increasingly used to replace the long dash ('—', also called an em dash or em rule). When using it to replace a long dash, spaces are needed either side of it – like so." https://en.wikipedia.org/wiki/En_(typography)
Re:A 10x Faster TypeScript by christianqchung on Tuesday March 11, 2025 @02:16PM (#43335439)
You're right, oops. I agree with your reasoning (comment still gives off slop vibes but that's unprovable). But the parent has been flagged, so I'm not sure if that means admins/dang has agreed with me or if it was flagged for another reason.
Re:A 10x Faster TypeScript by johnisgood on Tuesday March 11, 2025 @04:54PM (#43336895)
I think anyone can flag a comment, and if enough people flag a comment, it will become flagged.
Re:A 10x Faster TypeScript by hombre_fatal on Tuesday March 11, 2025 @12:44PM (#43334337)
em-dash is shift-option-hyphen on macOS, so it's not a good heuristic—I use it myself.

They're using en-dash which is even easier: option-hyphen.

This is the wrong way to do AI detection. For one, LLM would have used the right dash. But at least find someone wasting our time with belabored or overwrought text that doesn't even interact with anything.

Re:A 10x Faster TypeScript by never_inline on Tuesday March 11, 2025 @01:13PM (#43334735)
This is definitely AI, repetitive and reads in style of a marketing copy / sensational report.
Re:A 10x Faster TypeScript by sapiogram on Tuesday March 11, 2025 @02:05PM (#43335334)
They're not "definitely" an AI. Sounds like a normal Go enthusiast to me.
Re:A 10x Faster TypeScript by nindalf on Wednesday March 12, 2025 @01:46AM (#43340281)
A Go enthusiast who’s never heard of esbuild? Not impossible, but unlikely.
Re:A 10x Faster TypeScript by sapiogram on Wednesday March 12, 2025 @06:53AM (#43341860)
So, a go enthusiast who does exclusively backend work? Seems likely enough, given that community's overall disdain for Javascript.
Re:A 10x Faster TypeScript by niederman on Tuesday March 11, 2025 @12:42PM (#43334314)
You know, some humans use the correct dash too...
Re:A 10x Faster TypeScript by ilikegreen on Tuesday March 11, 2025 @01:06PM (#43334663)
The em dash thing is not very conclusive. I have been writing with the em dash for many years, because it looks better and is very accessible on Mac OS (long press on dash key), while carrying a different tone than the simple dash. That, and I read some Tristram Shandy.
Re:A 10x Faster TypeScript by harrall on Tuesday March 11, 2025 @01:04PM (#43334634)
Two hyphens (-) make a em dash (—) on Apple devices and many word processors.

In the pre-Unicode days, people would use two hyphens (--) to simulate em dashes.

Re:A 10x Faster TypeScript by nindalf on Tuesday March 11, 2025 @12:40PM (#43334293)
That would explain a lot.
Re:A 10x Faster TypeScript by the_mitsuhiko on Tuesday March 11, 2025 @12:42PM (#43334312)
> The Go choice over Rust/C# reveals something deeper: Microsoft prioritized shipping a working solution over language politics. Go's simplicity (compared to Rust) and deployment model (compared to C#) won the day.

I'm not sure that this is particularly accurate for the Rust case. The goal of this project was to perform a 1:1 port from TypeScript to a faster language. The existing codebase assumes a garbage collector so Rust is not really a realistic option here. I would bet they picked GCed languages only.

Re:A 10x Faster TypeScript by whazor on Tuesday March 11, 2025 @01:28PM (#43334914)
Re:A 10x Faster TypeScript by pc86 on Tuesday March 11, 2025 @12:45PM (#43334351)
I can't imagine the devs at Microsoft have any issues with C#'s "deployment model."
Re:A 10x Faster TypeScript by Yoric on Tuesday March 11, 2025 @12:49PM (#43334419)
I can imagine C# being annoying to integrate into some CIs, for instance. Go fits a sweet spot, with its fast compiler and usually limited number of external dependencies.
Re:A 10x Faster TypeScript by giancarlostoro on Tuesday March 11, 2025 @12:49PM (#43334432)
I assume they picked Go because the binaries can be very stand alone.
Re:A 10x Faster TypeScript by register on Tuesday March 11, 2025 @12:25PM (#43334100)
I don't see why Go deployment model is superior to C#. You can easily build native binaries in C# as well nowadays.
Re:A 10x Faster TypeScript by gwbas1c on Tuesday March 11, 2025 @12:56PM (#43334525)
I get the impression that, because Go has a lot of similar semantics to Typescript, it was easier to port to Go than other languages.

From https://github.com/microsoft/typescript-go/discussions/411

> Idiomatic Go strongly resembles the existing coding patterns of the TypeScript codebase, which makes this porting effort much more tractable.

> We also have an unusually large amount of graph processing, specifically traversing trees in both upward and downward walks involving polymorphic nodes. Go does an excellent job of making this ergonomic, especially in the context of needing to resemble the JavaScript version of the code.

Personally, I'm a big believer in choosing the right language for the job. C# is a great language, and often is "good enough" for many jobs. (I've done it for 20 years.) That doesn't mean it's always the best choice for the job. Likewise, sometimes picking a "familiar language" for a target audience is better than picking a personal favorite.

Re:A 10x Faster TypeScript by abdusco on Tuesday March 11, 2025 @12:39PM (#43334281)
Smaller binary sizes for easier + cheaper distribution might be a factor.
Re:A 10x Faster TypeScript by gwbas1c on Tuesday March 11, 2025 @12:57PM (#43334542)
You can make very small binaries in C# if you want to.

But, the team posted their rationale for Go here: https://github.com/microsoft/typescript-go/discussions/411

Re:A 10x Faster TypeScript by guappa on Wednesday March 12, 2025 @03:03AM (#43340579)
Come on… 1 statically linked executable and it can cross build incredibly easily. There's no comparison even.
Re:A 10x Faster TypeScript by nine_k on Tuesday March 11, 2025 @01:20PM (#43334825)
Go with parametric types is already a reasonably expressive language. Much more expressive than C in which a number of compilers has been written, at least initially; not everyone had the luxury of using OCaml or Haskell.

There is already a growing number of native-code tools of the JS/TS ecosystem, like esbuild or swc.

Maybe we should expect attempts of native AOT compilation for TS itself, to run on the server side, much like C# has an AOC native-code compiler.

Re:A 10x Faster TypeScript by gherkinnn on Tuesday March 11, 2025 @12:38PM (#43334258)
It *almost* sounds like you're telling the authors, one of which posted this, what their motivations are.
Re:A 10x Faster TypeScript by sebzim4500 on Tuesday March 11, 2025 @12:48PM (#43334398)
>The Go choice over Rust/C# reveals something deeper: Microsoft prioritized shipping a working solution over language politics. Go's simplicity (compared to Rust) and deployment model (compared to C#) won the day. Even Anders Hejlsberg – father of C# – chose Go for pragmatic reasons!

I don't follow. If they had picked Rust over Go why couldn't you also argue that they are prioritising shipping a working solution over language politics. It seems like a meaningless statement.

Re:A 10x Faster TypeScript by madeofpalk on Tuesday March 11, 2025 @12:40PM (#43334294)
> it signals we've hit fundamental limits in JS/TS for systems programming

Really is this a surprise to anyone? I don't think anyone thinks JS is suitable for 'systems programming'.

Javascript is the language we have for the browser - there's no value in debating it's merits when it's the only option. Javascript on the server has only ever accrued benefits from being the same language as the browser.

Re:A 10x Faster TypeScript by rvz on Tuesday March 11, 2025 @12:35PM (#43334218)
> When a language team abandons self-hosting (TS in TS) for raw performance (Go), it signals we've hit fundamental limits in JS/TS for systems programming.

I hope you really mean for "userspace tools / programs" which is what these dev-tools are, and not in the area of device drivers, since that is where "systems programming" is more relevant.

I don't know why one would choose JS or TS for "systems programming", but I'm assuming you're talking about user-space programs.

But really, those who know the difference between a compiled language and a VM-based language know the obvious fundamental performance limitations of developer tools written in VM-based languages like JS or TS and would avoid them as they are not designed for this use case.

Re:A 10x Faster TypeScript by pjmlp on Tuesday March 11, 2025 @12:41PM (#43334300)
Back in my day, writing compilers was part of systems programming.
Re:A 10x Faster TypeScript by Yoric on Tuesday March 11, 2025 @12:50PM (#43334442)
Yeah, the term has changed meaning several times. Early on, "systems programmer" meant basically what we call a "developer" now (by opposition to a programmer or a researcher).
Re:A 10x Faster TypeScript by sethaurus on Wednesday March 12, 2025 @03:11AM (#43340613)
At that time, what would have been the distinction between "programmer" and "developer"?
Re:A 10x Faster TypeScript by Yoric on Wednesday March 12, 2025 @04:37AM (#43341004)
If my memory serves, the "programmer" was essentially a mathematician, working on a single algorithm, while a "system developer" was building an entire system around it.
Re:A 10x Faster TypeScript by scotty79 on Tuesday March 11, 2025 @12:49PM (#43334435)
> Go's simplicity

I think they went for Go mostly because of memory management, async and syntactic similarity to interpreted languages which makes total sense for a port.

Re:A 10x Faster TypeScript by ninetyninenine on Tuesday March 11, 2025 @12:22PM (#43334067)
I wish there was a language like rust without the borrow checking and lifetimes that was also popular and lives in the same area as go. Because I think go is actually the best language in this category but it’s only the best because there is nothing else. All in all golang is not an elegant language.
Re:A 10x Faster TypeScript by noelwelsh on Tuesday March 11, 2025 @12:33PM (#43334193)
O'Caml is similar, now that it has multicore. Scala is also similar, though the native code side (https://scala-native.org/en/stable/) is not nearly as well developed as the JVM side.
Re:A 10x Faster TypeScript by ninetyninenine on Tuesday March 11, 2025 @01:49PM (#43335145)
The problem with O'Caml is it won't get popular because people are afraid of FP. But I would be totally down to use it.
Re:A 10x Faster TypeScript by sapiogram on Tuesday March 11, 2025 @12:25PM (#43334104)
Rust loses a lot of its nice properties without borrow checking and lifetimes, though. For example, resources no longer get cleaned up automatically, and the compiler no longer protects you against data races. Which in turn makes the entire language memory unsafe.
Re:A 10x Faster TypeScript by SkiFire13 on Tuesday March 11, 2025 @12:32PM (#43334185)
I believe OP meant to give it a GC like in Go, while keeping other features from Rust from enums/match/generics/traits/etc etc.

This should prevent most of the memory safety issues, though data races could still be tricky (e.g. Go is memory unsafe due to data races)

Re:A 10x Faster TypeScript by throw-the-towel on Tuesday March 11, 2025 @12:27PM (#43334129)
OTOH it would still have Rust's sane type system and all the nice features it makes possible.
Re:A 10x Faster TypeScript by nine_k on Tuesday March 11, 2025 @01:36PM (#43334988)
OCaml and Haskell already have that nice type system (and even more nice). If OCaml's syntax bothers you, there is Reason [1] which is a different frontend to the same compiler suite.

Also in this space is Gleam [2] which targets Erlang / OTP, if high concurrency and fault tolerance is your cup of tea.

[1]: https://reasonml.github.io/

[2]: https://gleam.run/

Re:A 10x Faster TypeScript by duped on Tuesday March 11, 2025 @12:49PM (#43334425)
That language is Rust, though.
Re:A 10x Faster TypeScript by michaelsbradley on Tuesday March 11, 2025 @12:26PM (#43334118)
It’s not popular compared to Go/Rust, but many find Nim scratches that itch:

https://nim-lang.org/

Re:A 10x Faster TypeScript by pclmulqdq on Tuesday March 11, 2025 @12:52PM (#43334473)
Zig is another popular neo-language in the same rough space.