On Mon, 13 Apr 2020 11:35:34 +0100 Steve Dower email@example.com wrote:
Neither Windows not macOS support fork (macOS only recently).
Victor's argument: "fork() is not terrific with inline reference counts".
My argument: people shouldn't generally use fork() anyway, because it has other issues.
My statement that people should prefer "forkserver" was in that context (if you are trying to build parallel applications using fork() calls, think twice). Obviously on Windows you'll use the "spawn" method, because it's the only available one ;-) And on macOS, you'll probably do whatever the latest recommended thing to do is ("spawn", I suppose).
Separating refcounts theoretically improves cache locality, specifically the case where cache invalidation impacts multiple CPUs (and even the case where a single thread moves between CPUs).
I'm a bit curious why it would improve, rather than degrade, cache locality. If you take the typical example of the eval loop, an object is incref'ed and decref'ed just about the same time that it gets used.
Two CPUs can read the contents of a string from their own cache. As soon as one touches the refcount, the cache line containing both the refcount and the string data in the other CPU is invalidated, and now it has to wait for synchronisation before reading the data.
Ah, you're right. However, the GIL should make such events less frequent than in a language like C++. Compared to the overhead of look up reference counts in a different memory area (probably using a non-trivial algorithm to determine the exact address), I'm not sure which factor would dominate.
and this code that they're using doesn't have any system dependencies that differ in debug builds (spoiler: they do).
Are you talking about Windows? On non-Windows systems, I don't think there are "system dependencies that differ in debug builds".
Of course I'm talking about Windows. I'm about the only person here who does, and I'm having to represent at least half of our overall userbase (look up my PyCon 2019 talk for the charts).
Ok :-) However, Victor's point holds for non-Windows platforms, which is *also* half of our userbase.