Dismissing Python Garbage Collection (2017)
instagram-engineering.com
instagram-engineering.com
Original discussion: https://news.ycombinator.com/item?id=13421464
I'd be curious to know if this hack has survived for four years.
If your C library uses FFI or Ctypes it'll work perfectly fine under pypy.
If you want CoW-friendly GC, you need to move your color bits / reference counts to be all together in the headers of your GC arenas instead of being in the object headers. That way, your high mutation bits are all together in a small number of pages. Those pages with the color bits/counters end up not being shared across processes, but at least they're all packed together to minimize the number of affected pages.
So, no, this article is not an excellent argument against reference counting.
Most problems people ascribe to reference counting have way more to do with excessive memory allocation and instead of fixing that problem and getting massive speedups of 7x or more, people try to fiddle with memory management schemes to gain 5% here or there at the expense of large unpredictable pauses.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Truly the real man solution. The only way this could have been better is if the vm for hack was written in brainfuck.
I get why people hate C, but once you get used to a couple of good libraries things get much easier - we're not in the 90s anymore and there's plenty to choose from, with some of them having excellent quality code. And especially in cases like these when it turns out you can get some benefits from delayed freeing of memory C's manual memory management is an asset.
I'd never really used it much before a year ago so I was quite surprised how flat most abstractions are.
I wouldn't write my website in C but equally it wouldn't need many features to be python-esque.