News for hackers. Stuff that matters.
Re:Moving from TypeScript to Rust / WebAssembly by cies on Thursday July 09, 2020 @03:21AM (#23777776)
I'd be hard pressed if a backend in Rust gives the same perf as Kotlin/F#. Especially if you write the Rust with an async stack you will likely come out significantly faster than the other options: small binaries, short startup time, less memory usage, more throughput, slightly shorter request cycles, ...

The only place that the langs you mention probably win is: learning curve (F# maybe not so much) a.k.a. getting language illiterate people up to speed, and compile times.

Re:Moving from TypeScript to Rust / WebAssembly by flohofwoe on Thursday July 09, 2020 @04:47AM (#23778209)
If you allocate and free small memory chunks at high frequency in a non-GC language, then it's quite likely that similar code in a GC'ed language will come out faster. The point of manual memory management isn't that it is "automatically" faster than a GC, but that it gives you a lot of control to reduce the allocation frequency (e.g. by grouping many small items into few large allocations, or moving allocations out of the hot code path).

Also, async itself doesn't magically make code run faster (on the contrary), it just lets you (ideally) do something else instead of waiting for a blocking operation to complete, or at least give you the illusion of sequential control flow (unlike nested callbacks).

Re:Moving from TypeScript to Rust / WebAssembly by unrealhoang on Thursday July 09, 2020 @06:26AM (#23778676)
Modern allocators (jemalloc, mimalloc) do pooling optimization just as well as GC. The point of non-GC language is usually about pointing directly to the source data instead of copy and having value type that nicely fit together in the same memory page instead of jumping around in heap space. I know JIT can do all that, but reliably? We'd need Sufficiently Smart Compiler.
Re:Moving from TypeScript to Rust / WebAssembly by laurencerowe on Thursday July 09, 2020 @03:47AM (#23777902)
Whether to use an async stack or not is very application dependent. For something closer to an application server than a proxy server I’m unconvinced async would be superior to threads.

I feel that Rust should be competing with C/C++ here though. I want a modern language with the same speed and control of memory usage. What’s A little frustrating (and don’t get me wrong, I’m rooting for Rust to get there) is that it feels like it should be possible to offer this, at least for threaded web servers.

Re:Moving from TypeScript to Rust / WebAssembly by Karrot_Kream on Thursday July 09, 2020 @03:48AM (#23777911)
There are other interesting languages in this space that I really enjoy playing with. Both Nim and Zig generate native code and are really fun, albeit very different, languages to work with.
Re:Moving from TypeScript to Rust / WebAssembly by Karrot_Kream on Thursday July 09, 2020 @03:47AM (#23777904)
I'm not sure. These reasons sound reasonable, but in webapps most of the time is spent IO handling anyway. As long as you're using async implementations in any language with performant "threads", I'm not sure of there would be a large difference in response times unless computation was involved in the request path.
Re:Moving from TypeScript to Rust / WebAssembly by entha_saava on Thursday July 09, 2020 @03:53AM (#23777939)
You forgot development times.
Re:Moving from TypeScript to Rust / WebAssembly by cies on Friday July 10, 2020 @06:05AM (#23789843)
I broke it down into:

> a.k.a. getting language illiterate people up to speed, and compile times.

With equally skilled people I dont think these languages yield different dev speed, apart from the damage done by compile times.