News for hackers. Stuff that matters.
Re:A 10x Faster TypeScript by gwbas1c on Tuesday March 11, 2025 @01:42PM (#43335065)
When I read the article it was very clear, due to the compiler's in-memory graphs, that they needed a GC.

(IE, as opposed to reference counting, where if you have cyclic loops, you need to manually go in and "break" the loop so memory gets reclaimed.)

Re:A 10x Faster TypeScript by tuveson on Tuesday March 11, 2025 @02:09PM (#43335368)
> When I read the article it was very clear, due to the compiler's in-memory graphs, that they needed a GC.

It's actually pretty easy to do something like this with C, just using something like an arena allocator, or honestly, leaking memory. I actually wrote a little allocator yesterday that just dumps memory into a linkedlist, it's not very complicated: http://github.com/danieltuveson/dsalloc/

You allocate wherever you want, and when you're done with the big messy memory graph, you throw it all out at once.

There are obviously a lot of other reasons to choose go over C, though (easier to learn, nicer tooling, memory safety, etc).

Re:A 10x Faster TypeScript by gwbas1c on Tuesday March 11, 2025 @02:16PM (#43335438)
I get the impression they'd use smart pointers (C++) or Rc/Arc (Rust)