Live data from Hacker News

Perry Compiles TypeScript directly to executables using SWC and LLVM

perryts.com

11–20 of 109 posts

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#11
Perry uses NaN-boxing to preserve TypeScript's dynamic type system at runtime, the same approach as JavaScriptCore. The PERF_ROADMAP is honest about the cost: 1.86x behind Zig on image convolution, with 1.24 billion wasted instructions traced specifically to NaN-box unboxing. You cannot get C-level performance without dropping TypeScript semantics, and dropping them means you are no longer compiling TypeScript.

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#12

Perry uses NaN-boxing to preserve TypeScript's dynamic type system at runtime, the same approach as JavaScriptCore. The PERF_ROADMAP is honest about the cost: 1.86x behind Zig on image convolution, with 1.24 billion wasted instructions traced specifically to NaN-box unboxing. You cannot get C-level performance without dropping TypeScript semantics, and dropping them means you are no longer compiling TypeScript.

I think you mean you can't get that performance without monomorphization. When you know the types you can...

...wait, I went and looked up that file.

"The Three Optimizations That Would Close the Gap"

You're presenting the data from there in an extremely misleading way! They in no way need to drop any Typescript semantics to go faster.

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#13
I'm not against AI usage but the website, documentation, and even the comments the creator (proggeramlug) makes in response to questions are all very clearly AI-generated. Also, as someone else noticed, the pacing of the commits is eerily fast. That combined with the level of functionality makes me dubious how much accountability the creators have over the implementation.

Like you really built a backend that lowers to LLVM, integrated it with a generational gc, wrote a cross-platform reactive runtime, and built support for eleven different targets within like a year? Are you just prompting the model to tack on the next coolest thing or do you understand how these features work?

I worry how many of these kinds of projects will show up now. How do you guarantee stability? If there's a memory corruption error in the GC implementation, who's going to debug it?

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#14

Perry uses NaN-boxing to preserve TypeScript's dynamic type system at runtime, the same approach as JavaScriptCore. The PERF_ROADMAP is honest about the cost: 1.86x behind Zig on image convolution, with 1.24 billion wasted instructions traced specifically to NaN-box unboxing. You cannot get C-level performance without dropping TypeScript semantics, and dropping them means you are no longer compiling TypeScript.

I think you mean you can't get that performance without monomorphization. When you know the types you can... ...wait, I went and looked up that file. "The Three Optimizations That Would Close the Gap" You're presenting the data from there in an extremely misleading way! They in no way need to drop any Typescript semantics to go faster.

You're right. The typed buffer locals optimization keeps TypeScript semantics intact by exploiting the existing Buffer/Uint8Array type annotation to skip the NaN-unbox. It's not dropping types, it's using them. The floor I described applies to any-typed paths where static type info isn't available. For well-typed TypeScript, the roadmap shows the gap closes without semantic changes.

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#15

Perry uses NaN-boxing to preserve TypeScript's dynamic type system at runtime, the same approach as JavaScriptCore. The PERF_ROADMAP is honest about the cost: 1.86x behind Zig on image convolution, with 1.24 billion wasted instructions traced specifically to NaN-box unboxing. You cannot get C-level performance without dropping TypeScript semantics, and dropping them means you are no longer compiling TypeScript.

I think you mean you can't get that performance without monomorphization. When you know the types you can... ...wait, I went and looked up that file. "The Three Optimizations That Would Close the Gap" You're presenting the data from there in an extremely misleading way! They in no way need to drop any Typescript semantics to go faster.

Typescript is a dynamic language. Without changing the language, there is fundamentaly no way to resolve at compile time decisions that can be made only at runtime (ie, they are data driven). Monomorphization helps pin down (some) dynamic types but the fundamental problem remains.

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#16
post #5

Fascinating. I've written cross platform (WASM, iOS, Android) libraries with Rust before and had a good time but Rust can be a pain too. Cross-platform Typescript is a really interesting proposition. That said, the more I think about it the more dubious I am. The site boasts no runtime dependencies but clearly it’s going to need things like a garbage collector, you can’t just magic that requirement away. At a certain…

how do one tell when text is ai generated - honest question. What are the tell tale signs?

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#17

I'm not against AI usage but the website, documentation, and even the comments the creator (proggeramlug) makes in response to questions are all very clearly AI-generated. Also, as someone else noticed, the pacing of the commits is eerily fast. That combined with the level of functionality makes me dubious how much accountability the creators have over the implementation. Like you really built a backend that lowers t…

This is how software development works now. We have to live with it.

The models are good enough that this works.

You can keep disagreeing for a while, but know that almost all the code in the industry is written like this now.

Re: Perry Compiles TypeScript directly to executables using SWC and LLVM

#20
post #5

Fascinating. I've written cross platform (WASM, iOS, Android) libraries with Rust before and had a good time but Rust can be a pain too. Cross-platform Typescript is a really interesting proposition. That said, the more I think about it the more dubious I am. The site boasts no runtime dependencies but clearly it’s going to need things like a garbage collector, you can’t just magic that requirement away. At a certain…

how do one tell when text is ai generated - honest question. What are the tell tale signs?

In regards to the site, all of them follow almost the same templates.

Once you see a few, it becomes obvious

Post reply on HN