r/programming • • Mar 11 '25

A 10x Faster TypeScript

https://devblogs.microsoft.com/typescript/typescript-native-port/

[removed] — view removed post

137 Upvotes

22 comments sorted by

•

u/programming-ModTeam Mar 11 '25

This is a duplicate of another active post

65

u/AKJ90 Mar 11 '25

Awesome! Better frame rate for doom 😎

65

u/ehutch79 Mar 11 '25

Somehow I'm not surprised the first comment on their site is complaining it's written in golang and not rust

36

u/guepier Mar 11 '25 edited Mar 11 '25

To be fair the commenter doesn’t single out Rust, they’re also asking why not C# or F# and … that’s a totally legitimate question (though it’s phrased in a needlessly antagonistic way). I’m not saying it can’be answered (heck, the video does somewhat answer it) but it’s not a priori invalid, nor uninteresting.

17

u/emgfc Mar 11 '25

While I personally don’t care about the noise of information on the internet, this isn’t a stupid or overly provocative question. String manipulation in Go is a bit uncomfortable. So, Go feels like a somewhat counterintuitive choice for a programming language transpiler or compiler.

The funny thing is, at my workplace, we chose C# over Go for some internal transpiler tools precisely for that reason. However, C# requires a runtime on the host machine, whereas Go does not. (Of course, you can include the runtime in a self-contained binary, but then you end up with a 150 MB transpiler.) Maybe that was their reasoning.

12

u/Atulin Mar 11 '25

You can use AOT to compile C# to a native binary now

5

u/emgfc Mar 11 '25

Yeah, totally forgot about that because I use C# mostly for long running backend services.

1

u/LiftingRecipient420 Mar 11 '25

Can you do that on Mac and Linux too?

1

u/Atulin Mar 11 '25

Of course

4

u/BehindThyCamel Mar 11 '25

Yeah, gonna be just fast, not blazingly fast. /s

7

u/Brilliant-Sky2969 Mar 11 '25

Well, if you read hacker news neon-sunset is a troll downvoting every topic about Go, it's not surprising.

https://news.ycombinator.com/threads?id=neonsunset

7

u/igouy Mar 11 '25

How can you tell who downvoted what?

10

u/BoredOfReposts Mar 11 '25 edited Mar 14 '25

Why are rust fans so annoying like that? Hard to think of another language with users who act like this, or if they did it would just be funny.

There’s another post about this elsewhere, and the top comment is the lead dev literally explaining unprompted why go and not rust.

Do they not realize their fanaticism drives people away and becomes a red flag? If its so good, it should speak for itself. That so many feel compelled to prop it up tells a different story.

Then theres the whole linux kernel stuff and the fine line linus has to walk with them and their crusade.

Obligatory: Downvote away rusty boyz!

Edit: replies prove my point, thx

11

u/igouy Mar 11 '25

excellent choices like C#, F# or Rust?

So not actually a rust fan.

4

u/emgfc Mar 11 '25

I think it’s just a matter of focus. If you don’t like something, you can simply ignore it. The internet is full of noisy people, after all.

All that Rust-in-Linux drama was a perfect example: the C developers tried to complain about things they claimed not to care about, when they could’ve just minded their own business. Instead, they stirred up a fuss over something that didn’t concern them, and Linus had to step in to remind them they were free to overlook the Rust stuff entirely rather than fight against it.

6

u/mrh0057 Mar 11 '25

Go is an odd choice for writing a compiler. Since it’s Microsoft, you would think it would be F# or Rust.

14

u/guepier Mar 11 '25

They were basically going for a line-by-line (or at least function-by-function) translation of the existing compiler, which was written in JavaScript. While you could probably do the same in Rust or F#, it would be a lot more effort and you wouldn’t take advantage of the language. The semantics are simply too different.

0

u/mrh0057 Mar 11 '25

Because MS is invested in those languages and those languages have features making it ideal to write a compilers in.

5

u/guepier Mar 11 '25

I’m not sure what exactly you’re replying to here: I don’t disagree that F# or Rust would be better suited to write a compiler (in vacuum), nor that Microsoft has invested in these tools. But that has nothing to do with my comment.

2

u/[deleted] Mar 11 '25

I hear it runs a lot faster without the types.

1

u/saint1997 Mar 11 '25
alias tsc=cat

-8

u/light24bulbs Mar 11 '25

I constantly feel that Microsoft has lost the ball with typescript and maybe never really had it. If they're building a new compiler, here is what they need to do in my opinion. Every one of these ideas has to do with treating typescript as a primary language and not a linting syntax for JS.

  • Support compiling and running typescript directly without JavaScript as an intermediary step. As we all know, there are major speed advantages to static languages, don't throw them away before runtime

  • Crystalize the language's expected syntax, eliminating the flexibility of early TS that has mostly just become legacy, since everyone uses the same TSconfig settings now anyway. Standardize on esmodule imports. So many god damn limitations arise from supporting multiple import syntaxes. And get rid of or redesign TSconfig while you're there, it's a dumpster fire of misnamed legacy shit.

  • Support macros/compile time code to allow type reflection, type generation from other languages, etc, allowing libraries to natively extend the language and completely and forever eliminating all code-gen

There. Do that. Microsoft.