HackerTrans
TopNewTrendsCommentsPastAskShowJobs

norswap

no profile record

Submissions

TypeScript Infers Type Variables

norswap.com
2 points·by norswap·w zeszłym miesiącu·0 comments

TypeScript Distributes Unions

norswap.com
2 points·by norswap·w zeszłym miesiącu·0 comments

comments

norswap
·w zeszłym roku·discuss
I used to work on compilers & JITs, and 100% this — polymorphic calls is the killer of JIT performance, which is why something native is preferable to something that JIT compiles.

Also for command-line tools, the JIT warmup time can be pretty significant, adding a lot to overall command-to-result latency (and in some cases even wiping out the JIT performance entirely!)
norswap
·4 lata temu·discuss
Strange to see people in this thread seemingly accepting this as face value evidence that the trend is dying. For that, you'd need to also see a chart of people who have added .eth to their name.

(I have no horse in this race, I had .eth in my username and then removed it because I decided that I'd rather not encourage people to look into the transactions I'm making, though admittedly it's still easy enough.)
norswap
·7 lat temu·discuss
I mostly agree with your point on RAII.

But I don't think OP was advocating RAII.

The typical argument for GC is that it is less error-prone than even RAII. And I agree with that point. It's a trade-off on which you have to decide on. I think the tiny perf penalty is often worth it.

You can still retain stale data under a GC, but real leaks (unreachable allocated memory) are precluded — which is usually considered (not unreasonably) to be the more common and serious problem.

I think GC is a sane default because it's less error prone, and god knows the average developer will make enough errors as it is. I'd trust myself with manual memory management, but not a random group of developers I don't know. What about you?
norswap
·7 lat temu·discuss
I've always seen automatic reference counting classified as GC.

e.g. https://users.cecs.anu.edu.au/~steveb/pubs/papers/rc-ismm-20...

> Reference counting and tracing are the two fundamental approaches that have underpinned garbage collection since 1960.

https://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf

> Tracing and reference counting are uniformly viewed as being fundamentally different approaches to garbage collection that possess very distinct performance properties.

This last one is great if you want to understand GC tradeoffs btw, highly recommend it.

---

And as the first paper implies, refcounting is often slower (because it trashes caches). The issue is having to propagate the diminution of refcounts amongst a graph of references. This also creates de facto "pauses", much like tracing GC (although arguably more predictable!).

And this "propagation of diminished refcount" is very much a memory traversal — (probably) smaller in scope than (non-incremental) tracing, but also much less local.
norswap
·7 lat temu·discuss
Ridiculous.

The problem is not that you don't know when/where the lifetime will end — that can usually be characterized by a terse "English" description. The problem is that this lifetime is dynamic in nature.

The end of the lifetime of an object may coincide with some user input, for instance.

At this point, either you go back to manual management, with the potential for errors (and for what it's worth, I think manual management is fine in many cases) ... or .... or what, exactly?

Even Rust doesn't solve that problem at all. If your objects can survive outside of a "linear" execution, which is the case in interactive or multi-threaded programs, you're falling back on reference counting — garbage collection.

No one has ever devised a scheme that lets you specify very dynamic lifetimes AND statically checks that no leak can occur.

I'd stake a lot on that being impossible in general, and the best we can hope for being an AI that searches a way to insert the manual memory management calls (mostly, "free" and a minimal set of reference counts) assorted with a proof that this change will not cause any leaks or invalid accesses. We're a long way off that yet.
norswap
·8 lat temu·discuss
If it causes problems... run and never look back.
norswap
·8 lat temu·discuss
How does what you say contradict the OP in any way, shape or form?

He says ask to meet people to understand how everything works. It's not about impressing them, even if it shows proper respect as a side effect (and showing respect by listening is quite the opposing of suggesting new things nilly willy).