top | item 43332979

(no title)

pseudopersonal | 11 months ago

The post title is a bit misleading. It should say a 10x faster build time, or a 10x faster TypeScript compiler. tsc (compiler) is 10x faster, but not the final TS program runtime. Still an amazing feat! But doom will not run faster

"To meet those goals, we’ve begun work on a native port of the TypeScript compiler and tools. The native implementation will drastically improve editor startup, reduce most build times by 10x, and substantially reduce memory usage."

discuss

order

kaoD|11 months ago

To clarify why it's actually not that ambiguous: TS is not (and does not have) a runtime at all. Even TS-first runtimes like Deno are (1) not TS but its own thing and most importantly (2) just JS engines with a frontend layer that treats TS as a first-class citizen (in Deno's case, V8).

It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further (e.g. by proving that a function diverges) but to my knowledge they currently don't and I don't think there's any in the works (or if that's even possible while maintaining runtime soundness, considering you can "lie" to TS by casting to `unknown` and then back to any other type).

dec0dedab0de|11 months ago

“faster typescript” would also be a valid way to say the typescript compiler found a way to automatically write more performant javascript.

Just like if you said faster C++ that could mean the compiler runs faster, or the resulting machine code runs faster.

Just because the compile target is another human readable language doesn’t mean it ceases to be a typescript program.

I didn’t think this particular example was very ambiguous because a general 10x speed up in the resulting JS would be insane, and I have used typescript enough to wish the compiler was faster. Though if we’re being pedantic, which I enjoy doing sometimes, I would say it is ambiguous.

jilles|11 months ago

If you have to explain why something is not ambiguous it is by definition ambiguous.

pzo|11 months ago

there is static hermes from Meta that do AoT compilation to native so I find it actually ambiguous. For a second I thought they did a compiler instead of transpile r.

maxloh|11 months ago

> It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further.

Yeah, that exists. AssemblyScript has an AOT compiler that generates binaries from statically typed code.

seanmcdirmid|11 months ago

> It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further

Typescript's type system is unsound so it probably will never be very useful for an optimizing compiler. That was never the point of TS however.

xanth|11 months ago

Unfortunately many TS users have a surface level understanding of TS leading them to believe that TS is "real"

pas|11 months ago

I use TS a lot and still assumed they are embarking on a native runtime/compiler whatever epic journey.

fabian2k|11 months ago

I don't think this is misleading for anyone familiar with Typescript. Typescript itself has no impact on performance, and it is known that the compilation and type-checking speed is often a problem. So I immediately assumed that it was about exactly that.

hexomancer|11 months ago

When I read the title I thought maybe they implemented a typescript to binary (instead of javascript) code compiler that speeds up the program by 10x, it would also have the added benefit of speeding up the compiler by 10x!

I don't think that is too far fetched either since typescript already has most of the type information.

ggus|11 months ago

Agree. TypeScript is primarily a programming language. Did they make the language faster? No. Hence, the title is misleading.

hansifer|11 months ago

That's debatable. I think most people that work with TS see it as a syntax extension for JS. Do you think JSX is a programming language?

mmcnl|11 months ago

For anyone who uses TypeScript on a daily basis it's not ambiguous at all. Everyone who works with TS knows the runtime code is JavaScript code that is generated by the TypeScript compiler. And it's also pretty common knowledge that JavaScript is quite fast, but TS itself is not.

Etheryte|11 months ago

I don't think it's misleading at all, because you can't run Typescript. Typescript is either compiled, transpiled or stripped down into another language and that's what gets run in the end.

alpaca128|11 months ago

You can't run Java either as it's compiled to bytecode, yet when someone says "we made Java 10x faster" you wouldn't assume that just the compilation got faster, right? When people market Rust projects as blazingly fast nobody assumes it's about compilation, in part because a blazingly fast Rust compiler would be a miracle. Outside of this comment section people have always been using a programming language name for this because everyone knows what they mean.

It would be possible that MS wrote a TypeScript compiler that emits native binaries and that made the language 10x faster, why not?

wendyshu|11 months ago

Sure you can run Typescript. It's a programming language, someone could always write an interpreter for it.

zamadatix|11 months ago

You could make the same argument of anything but bytecode and even then some would debate if it's really running directly enough on modern CPUs. In the end it still remains that you have the time it takes to build your project in a given language and the runtime performance of the end result. Those remain very useful distinctions regardless of how many layers of indirection occur between source code and execution.

surajrmal|11 months ago

Tell that to the deno project.

darknavi|11 months ago

That could be a little confusing but (generally today) TypeScript does not "run", JavaScript does.

9rx|11 months ago

> TypeScript does not "run"

Except in the case of Doom, which can run on anything.

rs186|11 months ago

This seems pedantic. As a TypeScript user who is aware of the conversations about build performance, the title is not ambiguous at all. I know exactly they are talking about build time.

lordofgibbons|11 months ago

It was ambiguous to me. When someone says making a language X-times faster, it's natural to think about runtime performance, not compile times. I know TS runs on JS runtimes, but I assumed, based on the title, they created/modified a JS runtime to natively run TS fast.

dimitropoulos|11 months ago

look, not to argue with a stranger on hacker news, lol, but genuine calm question here: is this really a helpful nit? I know what you're getting at but the blogpost itself doesn't imply that JavaScript is 10x faster. I could complain, about your suggested change, that it's really `build and typecheck` time. It's a title. Sometimes they don't have _all_ the context. That's ok.

pseudopersonal|11 months ago

It is for me. If someone says TypeScript is faster than X, they rarely mean the build time. I understand other people's points about TypeScript not being a runtime at all and only being a compiler, but when casually saying "TypeScript is faster than say ruby", people do not mean the compiler.

legohead|11 months ago

misleading titles are a no-no on HN.

I agree with pseudopersonal in that the title should be changed. technically it's not misleading, but not everyone uses or is familiar with typescript.

k__|11 months ago

It could have been a new TSC that compiles to WASM.

jasonjmcghee|11 months ago

Unfortunately many people only look at headlines, so titles do matter. People take them at face value.

dcre|11 months ago

The explanations are of course correct, but I think you're right and there's not much downside to being clearer in the title. Maybe they decided against saying "compiler" because the performance boost also covers the language server.

hinkley|11 months ago

Also it’s 4 times faster but runs multithreaded, which was tricky to do in JavaScript (but easier now).

hot_gril|11 months ago

So I'm +inf as fast using JS

_ink_|11 months ago

Does Deno benefit from that?

TechSquidTV|11 months ago

Since you don't execute TypeScript, and TS never has anything to do with the end resulting app, I don't think it was misleading at all.