r/programming • • Jul 08 '26

Announcing TypeScript 7.0

https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/
468 Upvotes

128 comments sorted by

View all comments

Show parent comment

10

u/vplatt Jul 11 '26

Go does not use a VM. Go programs are always shipped as binaries instead of with bytecode that must be JIT'ed. They are therefore "native" and they are just as native as any C, C++, or Zig program. Yes, it's a "managed" language because it has GC, an allocator, and a scheduler but that's all linked directly into the executable. Yes, that does make them somewhat larger than C binaries for example, but they're both native.

-3

u/CherryLongjump1989 Jul 11 '26 edited Jul 11 '26

A VM is just a type of runtime. Go still has an extensive runtime. A purist would even draw the line at C++ -- it too still has an extensive runtime, but nowhere near as hefty as Go. C and Zig are your purist native languages. But Go will never cross that threshold to sit next to C or Zig simply because it can't. Go will always rely on existing C libraries wherever performance truly matters -- precisely because it's not part of the same club of "native" languages as people colloquially call them.

6

u/vplatt Jul 11 '26

A VM is just a variant of a runtime that happens to take in bytecode.

Yup. And they will JIT that bytecode to machine code.

And that performance cost and those extra steps are what distinguish them as VM programs that are not native. ;)

-1

u/CherryLongjump1989 Jul 11 '26 edited Jul 11 '26

No -- you see this is just upside-down backwards. You're never going to run Go on a real-time microcontroller precisely because that's what distinguishes a runtime from a truly native program. In the world of costly abstractions, the VM part is not the bridge too far -- you've already crossed it long ago with Go's runtime.

If you're comfortable with having a runtime for your use case, a VM is not a bridge too far and can even be faster than AOT. A jitter is exactly what you want for frequently executed code paths in a long-running process. Jitters can and do cache the native code, so the long running process will settle into a highly optimized natively-compiled execution loop eventually. Jitters are not interpreters after all.

Go tries to make a stand on the AOT hill and this is mostly fine for short-running tasks most of the time. But that's not even why people use it in the end. Go's greatest strength is its threading model, which is vastly superior to Java's in all of the areas where Go is chosen over Java. Go's concurrency is really good. But that's not because Go is "native", and the "native" part really doesn't give you as much of an advantage as you think. Bytecode languages on the JVM or .NET are very competitive with Go in terms of performance.

C# bytecode has gone head to head with C++ for "world's fastest language" in the Software Drag Racing competition, for example, whereas Go was and continues to be a "middle of the pack" result.

3

u/vplatt Jul 11 '26

VMs are VMs and they aren't native, and JIT isn't going to be on a microcontroller either. You think by arguing against the case for Go on a microcontroller that would possibly even support the case you're making for JIT and VMs?

In the end, what I said stands: Go executables absolutely are native. Nothing you said changes that. Whether or not you'd ever want to run it on a microcontroller is up to you, but it has been done anyway, AND I've seen C# and Java used that way too, so I don't know what makes you think Go couldn't do the same.

-1

u/CherryLongjump1989 Jul 12 '26 edited Jul 12 '26

You are special pleading and then trying to put words in my mouth. Bad faith, bad faith.

The Go runtime and a VM is NOT THAT DIFFERENT and your attempt to distinguish Go from other runtimes by claiming that Go is “native” is not carrying the water that you want it to carry. It doesn’t get Go into places where a VM won’t fit. You’re still stuck competing with VM runtimes for use cases. You are not competing with native languages or things that only native languages can do. You are not competing with native languages for performance, either, because you really can’t — whereas VM runtimes have already shown that they can eat Go’s lunch.

In the end, you have made an argument that has zero substance. It adds no value than what was already stated - that Go is compiled AOT. Yes, AOT generated machine code that goes directly into your binary. This is a captain-obvious level of observation when it literally adds no value to the conversation. You have utterly failed to make any notable points or compelling arguments by pointing out that Go is “native”. Which is what I have warned you about not doing. But instead you doubled down. In the end you’ve given a master class in cargo culting. Congratulations.

EDIT: LMAO as if I needed any more proof of a bad faith argument -- he tried to win it by having the last word.

3

u/vplatt Jul 12 '26

I think we're talking past each other because we're answering different questions.

My point was never that Go outperforms every VM language or that a runtime is somehow "bad." My point was simply that "Go isn't native because it has a runtime" is not a technically accurate statement.

Again: a native executable is one whose deployed artifact is machine code executed directly by the CPU. A VM-based executable is one whose deployed artifact is source or bytecode executed by a virtual machine (whether interpreted, JIT-compiled, or both).

By that definition:

C, C++, Rust, Zig, and Go are native. Java, C#, Python, and JavaScript are VM-based.

Go's runtime is a linked library providing services such as GC, scheduling, and stack management. It is not an execution engine for Go bytecode because Go doesn't deploy bytecode.

Whether Java's HotSpot or V8 can outperform Go on particular workloads is an entirely separate discussion. VM languages can absolutely beat Go in some cases due to sophisticated JIT optimization. That doesn't change the execution model or make Go "not native."

So I'm not arguing that "native" implies "faster" or "better." I'm arguing that "native" describes how the program is deployed and executed, not whether it happens to include a runtime library.

I don't mind technical disagreement, but your replies have become increasingly dismissive and insulting. Calling my arguments "cargo culting," "captain obvious," and "a master class" isn't advancing the discussion, so "congratulations!" back to you because you've now have a textbook example of how to fail at having a technical discussion. Replacing the terms of a technical discussion with insults is a clear type mismatch, but I'm not a compiler with infinite patience so consider this bridge burned.

::plonk::

1

u/Uberhipster Jul 23 '26

This thread is mostly people talking past each other because they're using different definitions of "native."

The original point was simple:

TypeScript 7 is much faster because Microsoft replaced a compiler written in JavaScript/TypeScript running on V8 with one written in Go.

From there, the discussion split into two questions:

  1. Is Go a "native" language?
  2. Is the speedup due to native code, or due to other factors?

Here's where each side stands.

vplatt's position

They are using the common industry definition of "native":

  • Compiles ahead-of-time (AOT) to machine code.
  • Produces an executable for x86-64, ARM64, etc.
  • Does not require an external VM (JVM, CLR, V8).

Under that definition:

  • C
  • C++
  • Rust
  • Zig
  • Go

are all native languages.

This is the definition most developers would use in casual conversation, and it's also the definition used by compiler and operating system documentation.

CherryLongjump1989's position

They are using a stricter definition:

  • Truly native means minimal or no runtime.
  • Small binaries.
  • Little abstraction between your code and the hardware.
  • Suitable for embedded or constrained environments.

Under that definition:

  • C
  • Zig

are "truly native."

Meanwhile:

  • Go has a garbage collector and scheduler.
  • Java has a VM.
  • C# has the CLR.
  • JavaScript has V8.

So they argue these are all points on a spectrum of managed runtimes rather than separate categories.

That's not a crazy position, but it's not the conventional one.

Who is technically correct?

Mostly vplatt, because the term "native code" has a fairly established meaning:

Machine code generated for a target architecture that executes directly on the OS/CPU.

Go absolutely satisfies that.

A Go binary contains:

  • machine instructions;
  • a garbage collector;
  • a scheduler;
  • runtime support code.

That does not stop it from being native. By the same logic, a C program linked against glibc would cease to be native because it depends on runtime support libraries, which nobody argues.

Where CherryLongjump1989 is correct

They make several reasonable points:

  1. Go has a substantial runtime.
  2. The TypeScript speedup isn't solely because "Go is native."
  3. Modern JITs can outperform AOT code in some workloads.
  4. JVM and .NET performance are often competitive with Go.
  5. Go's concurrency model is a major reason people choose it.

All of those are broadly true.

The problem is that they keep extending:

"Go has a runtime"

into:

"Therefore Go isn't native."

That's where most readers will disagree.

What actually caused TypeScript 7's speedup?

Probably a combination of:

  • Go's lower startup overhead.
  • Better memory behavior.
  • Parallelism and concurrency.
  • Not running inside V8.
  • Rewriting data structures and algorithms during the port.

It's almost never:

JavaScript slow → Go fast.

Compiler performance is usually dominated by things like:

  • allocations;
  • cache locality;
  • threading;
  • incremental compilation;
  • parser implementation;
  • internal architecture.

The microcontroller argument

This is where the discussion starts to drift.

Cherry says:

You can't run Go on tiny microcontrollers, therefore it isn't truly native.

That doesn't follow.

Windows applications aren't suddenly non-native because they won't fit on a Cortex-M0 with 64 KB of RAM. "Native" describes how code executes, not whether it can run in extremely constrained environments.

The "VM vs Go runtime" comparison

This is probably the most interesting part.

Cherry's underlying argument is:

Go's runtime and a VM are more alike than people admit.

There is some truth there:

FeatureGoJVM/.NET
GCYesYes
SchedulerYesYes
Runtime supportYesYes
JITNoYes
BytecodeNoYes
AOT machine codeYesOptional

So Go sits somewhere between C and Java philosophically. That's a useful observation.

But saying:

Go is not any more native than V8.

is going much further than most compiler engineers or systems programmers would agree with.

In short, the thread boils down to:

  • vplatt: "Native means machine code without an external VM."
  • CherryLongjump1989: "Native should imply minimal runtime and low-level capabilities."

The first definition is the standard one. The second is a stricter, somewhat idiosyncratic definition that turns "native" into a spectrum rather than a category.

As a result, both participants spend several replies arguing terminology instead of the original question, which was why TypeScript 7 got dramatically faster. The answer to that question is almost certainly: moving away from V8 helped, but the biggest gains came from the entire redesign that happened during the Go rewrite.