| ▲ | zdragnar 12 hours ago |
| Why do you think Golang is no longer a reasonable choice? |
|
| ▲ | vaughands 12 hours ago | parent | next [-] |
| I suppose my comment sort of implies this. I think the naive knee jerk reaction is that if you can spit out perfect machine level code against a specification, then logically being closer to bare metal would help with performance. However, without knowing the details of how things worked it is tough to say whether it is truly "reasonable" or not. But more importantly, the Typescript team themselves [1] picked Golang mostly out of ergonomics and ease of porting at the time. It is becoming more increasingly more to "taste" what ergonomics means. Notably, they did not pick it because they believed it to be the fastest option. But speed was on the mind, giving way to ergonomics and ease of porting. At least, this is my read. [1] https://github.com/microsoft/typescript-go/discussions/411 |
| |
| ▲ | dunham 11 hours ago | parent | next [-] | | The author of esbuild used Rust and later switched to Go. He describes some of his experience here: https://news.ycombinator.com/item?id=22336284 It is one person and one project, but I found it interesting to read about his experience. I like Go, but I probably would have tried Rust first because I want pattern matching when implementing languages. | | |
| ▲ | e12e 3 hours ago | parent [-] | | Very interesting. With rust's ocaml heritage, I'd imagine a straight port from typescript would be simpler and more idiomatic than a port to go. I guess not. | | |
| ▲ | jitl 11 minutes ago | parent [-] | | Rust memory management is very different from GC heap memory management. |
|
| |
| ▲ | andrewingram 3 hours ago | parent | prev [-] | | The notable thing that these LLM-generated ports aren't doing is _rewriting in Go_. TypeScript 7 is a lot faster than the JS/TS-based version 6, but memory use is a major bottleneck. However, it mostly represents a mechanical port of the old codebase to Go. What I haven't seen anyone do is try a true rewrite in Go optimized for performance (whilst keeping a strong emphasis on readability). |
|
|
| ▲ | lifthrasiir 12 hours ago | parent | prev | next [-] |
| Presumably because Rust is more suitable than Go in agentic coding? (I'm not sure, but that seems the purported answer.) |
| |
| ▲ | lifeisloving 11 hours ago | parent [-] | | Language and compiler design/ implementation is very much a human task. There's lots of nuances to consider. I doubt they want agent spaghetti code in their codebase either. | | |
| ▲ | true_religion an hour ago | parent [-] | | I don't know. Many people implementing DSLs were happy to live with whatever lexx and yacc spat out for years. |
|
|
|
| ▲ | 12 hours ago | parent | prev | next [-] |
| [deleted] |
|
| ▲ | spankalee 12 hours ago | parent | prev | next [-] |
| Rust is better at targeting WebAssembly |
| |
| ▲ | cowsandmilk 11 hours ago | parent | next [-] | | why would that be important? Having a typescript compiler in wasm seems like a pretty niche need. | | |
| ▲ | Benjamin_Dobell 3 hours ago | parent | next [-] | | It's extremely useful if your distribution platform is the web. However, I find it much more valuable as a type checker than a compiler. I use TypeScript extensively (in several projects) for defining schemas types. For example, in the Breaka Club (https://breaka.club/) editor, which is not presently exposed to kids yet, we define behaviors for characters, props, mosaics (terrain tiles) and items in JSON. But the JSON has type checking and real-time completion as you type. Not naive property auto-suggestion, we have effect types and they're context aware in that you can refer to targets introduced higher in parent constructs of the JSON — and they're fully type checked. If you refer to a target that does not exist in a context, it won't validate and you cannot save the schema. We use tsgo for development, but the editor (runtime schema validation) is presently stuck on TypeScript 6 because there's no WASM support. Now, is it nutty that we're using TypeScript for JSON validation? A little. But it's extremely powerful. We're going far beyond what's capable with Zod or ArkType. | |
| ▲ | pjmlp 5 hours ago | parent | prev | next [-] | | Because you need to keep the compiler running here, - https://www.typescriptlang.org - https://code.visualstudio.com/docs/remote/vscode-web | |
| ▲ | tcfhgj 2 hours ago | parent | prev | next [-] | | But it's not the only niche, see Typst compiler in wasm for live document generation in the browser. | |
| ▲ | viraptor 8 hours ago | parent | prev [-] | | Theo is making a new twist on the idea of IDE which hosts the application itself. I'm sure there's going to be a video about it soon. But the idea is to embed the whole compilation and type-check in wasm in the browser which then runs the app immediately, as the agents edit the code. |
| |
| ▲ | teki_one 11 hours ago | parent | prev | next [-] | | Why? | | |
| ▲ | spankalee 11 hours ago | parent | next [-] | | Wasm is a first-class target for Rust, which produces faster and smaller Wasm binaries. My understanding is that you need to use TinyGo to reasonably target Wasm with Go. Go having a garbage collector isn't necessarily bad, since Wasm has GC, but I think Go's GC can't easily use Wasm GC because Go has interior pointers. | | |
| ▲ | win311fwg 6 hours ago | parent [-] | | WASM is also a first-class target for Go (gc). However, it has a relatively large runtime, so TinyGo is often preferred when bundle size needs to be small. |
| |
| ▲ | 0x696C6961 11 hours ago | parent | prev | next [-] | | I think the main advantage is size. Rust doesn't need to include the runtime. | |
| ▲ | cmrdporcupine 11 hours ago | parent | prev [-] | | I'm assuming they mean because it doesn't need a garbage collector or much of a runtime at all. You can target direct to WASM and use I guess WASI, while Go brings with it a garbage collector and so on. |
| |
| ▲ | pebal 5 hours ago | parent | prev [-] | | WASM makes no sense and has no future. | | |
| ▲ | pjmlp 5 hours ago | parent [-] | | It does here, https://www.typescriptlang.org | | |
| ▲ | pebal 4 hours ago | parent [-] | | I’m not saying it doesn't work. I’m saying it’s a waste of resources and won’t gain widespread popularity. The current trend is porting source code to languages that generate native code. | | |
| ▲ | pjmlp 4 hours ago | parent | next [-] | | I dislike the WebAssembly advocacy of some folks, where they act as if there weren't similar attempts all the way back to UNCOL in 1958, and even in recent history, seem to only focus on JVM, while ignoring the CLR and BEAM. However, there are indeed some cases where it does make sense since we have it around anyway, and one of them is running the Typescript compiler in the browser, now that it is written in a compiled language. | |
| ▲ | dwattttt 4 hours ago | parent | prev | next [-] | | Languages that target WebAssembly _are_ languages that generate native code? C & Rust for example. | |
| ▲ | josephg an hour ago | parent | prev [-] | | > I’m saying it’s a waste of resources A waste of what resources? Other people's time? That isn't up to you to decide. I think your comment is a waste of resources. But how you spend your time isn't up to me. And how wasm people spend their time isn't up to you. > The current trend is porting source code to languages that generate native code. Cool story, but without wasm, how are you gonna run that native code in a browser? | | |
|
|
|
|
|
| ▲ | sreekanth850 11 hours ago | parent | prev | next [-] |
| Rust is more close to metal. No GC |
| |
| ▲ | aka-rider 5 hours ago | parent | next [-] | | GC doesn’t affect performance (at least visibly), memory allocations on critical paths do. Moreover, Rust ARC may cause memory fragmentation and perform worse than a GC. Writing Rust, Zig, or Go, you would still control memory manually, where it matters. | | |
| ▲ | dwattttt 4 hours ago | parent | next [-] | | It does have an impact. Discord blogged about unavoidable GC delays in go that occurred because go needed to traverse live memory, their only option (in go) for reducing that pause was to reduce the size of their data set. | |
| ▲ | sreekanth850 4 hours ago | parent | prev [-] | | https://discord.com/blog/why-discord-is-switching-from-go-to... GC absolutely has performance costs, even with minimal allocations, because tracing collectors must scan live objects. This is exactly what this post says. Don't know if its really improved over time in real world cases. |
| |
| ▲ | pebal 8 hours ago | parent | prev [-] | | There is no connection. Rust has ARC which performs worse than the tracing GC. | | |
| ▲ | saagarjha 5 hours ago | parent [-] | | Than Go's GC? I think that is fairly unlikely in most cases. | | |
| ▲ | pebal 5 hours ago | parent [-] | | It depends on the workload. ARC can be more expensive than tracing GC, especially with heavily shared objects. But my main point was that the presence of a GC has nothing to do with how close a language is to the metal. Memory management strategy and low-level capabilities are two separate things. | | |
| ▲ | sreekanth850 4 hours ago | parent [-] | | I gave two separate reasons. Rust provides explicit control over memory allocation and management, and it has no garbage collector. | | |
| ▲ | pebal 2 hours ago | parent [-] | | Rust could just as well have an optional tracing GC for shared ownership instead of ARC, potentially improving performance rather than reducing it. Having a GC doesn't inherently make a language slower. | | |
| ▲ | josephg an hour ago | parent [-] | | > a GC doesn't inherently make a language slower. Yeah but let's be honest; GC languages (Go, Java, C#) usually are slower than systems languages. Systems languages just give you more, low level control over the computer from within your program. You can use that control to improve performance. Eg, you can control data locality, memory access patterns, the emitted assembler, and way more stuff. Of course you're right - if you misuse arc, you can make your program slow. So don't misuse arc then. Rust gives you lots of options for structuring memory. If you choose badly, that's on you. |
|
|
|
|
|
|
|
| ▲ | conartist6 11 hours ago | parent | prev [-] |
| Was it ever a reasonable choice? At the time the choice was made the tooling ecosystem was already split between Rust and JS, and by putting TS in Go they chose to split it three ways. Why not split it 4 or 5 ways then? The pressure will always be towards less duplicated work. The only real choice of language to build the next generation of JS tools in is JS. Anything else is a vote of no confidence in ourselves. |
| |
| ▲ | dwattttt 4 hours ago | parent [-] | | It's ok for a language (JS in this instance) to be good in a domain but not good in all domains. Pulling a language in every direction forces it to make compromises that hurt its applicability in specific areas. | | |
| ▲ | conartist6 2 hours ago | parent [-] | | You seem sure like them that JS is not good. They didn't even bother to consider it as a choice! If you wanted to point to their evidence you couldn't because they don't have any. | | |
| ▲ | Rapzid 43 minutes ago | parent | next [-] | | It was already in "JS". It was ported to Go. | |
| ▲ | dwattttt an hour ago | parent | prev [-] | | I'm suggesting that JS is not good for every possible use. And that is ok. I would not want a core internet router or a kernel to be implemented in JS. But I am happy it is used elsewhere. | | |
| ▲ | conartist6 30 minutes ago | parent [-] | | So for context my beef with them is that they didn't try. I think you're being very "hand wavey" about why JS isn't a good host language, just as they were. If the argument is that it's not fast enough, JS is actually quite fast: https://mrale.ph/blog/2018-02-03-maybe-you-dont-need-rust-to... If the argument is "we need to show a 10x boost in raw throughput" then I think we first need to have an argument about why throughput is the right metric as a target for optimization. Throughput is the critical performance measure of a batch processing architecture. IDE's, like web UIs, "feel fast" when they're responsive, which is to say when they can start giving the user access to useful output (and interaction) at the soonest moment the program could possibly be ready to do so. In web perf we might measure this as INP or the time it takes from Interaction to Next Paint. JS won't be winning prizes for throughput, no, but if we completed the move away from a batch processing mindset to an incremental recomputation mindset, and at the same time switched to measuring responsiveness metrics like INP, suddenly the perf characteristics of JS seem a lot more helpful. It's the closest language to the DOM, so when your IDE's interface is built on web technology you'll optimize INP by keeping the data layer in JS: https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r... There's an even stronger reason than the DOM though to see JS as the "native" layer for perf: plugins. An IDE's selling point is integration, and users want to extend their IDEs by writing Javascript code. Like it or not, JS is the most natural and highly-performant native kernel language for a system of JS plugins. |
|
|
|
|