Re:Python stands to lose its GIL, and gain a lot of speed
by adgjlsfhk1 on Sunday October 17, 2021 @12:18PM
(#28897522)
each python process requires somewhere around 200mb of memory and .1s to do nothing. if you want libraries, it scales from there.
[ Parent
| on HN ]
Re:Python stands to lose its GIL, and gain a lot of speed
by TekMol on Sunday October 17, 2021 @12:33PM
(#28897643)
Really? That sounds like an aweful lot.
When I execute this:
python3 -c 'import time; time.sleep(60)'
And then pmap the process id of that process, I get 26144K. That is 26MB.As for timing, when I execute this:
time python3 -c ''
I get 0.02s
Re:Python stands to lose its GIL, and gain a lot of speed
by lazide on Sunday October 17, 2021 @12:48PM
(#28897760)
Also generally no one spins up distinct, new processes for the ‘co-ordinated distinct process work queue’ when they can just fork(), which should be way faster and pretty much every platform uses copy-on-write for this, so also has minimal memory overhead (at least initially)
Re:Python stands to lose its GIL, and gain a lot of speed
by jesboat on Sunday October 17, 2021 @01:19PM
(#28898004)
The problem is (perhaps amusingly) with refcounting. As the processes run, they'll each be doing refcount operations on the same module/class/function/etc objects which causes the memory to be unshared.
Re:Python stands to lose its GIL, and gain a lot of speed
by lazide on Sunday October 17, 2021 @02:02PM
(#28898367)
Only where there is memory churn. If you’re in a tight processing loop (checksumming a file? Reading data in and computing something from it?) then the majority of objects are never referenced or dereferenced from the baseline.
Also, since the copy on write generally is memory page by memory page, even if you were doing a lot of that, if most of those ref counts are in a small number of pages, it’s not likely to really change much.
It would be good to get real numbers here of course. I couldn’t find anyone obviously complaining about obvious issues with it in Python after a cursory search though.
Re:Python stands to lose its GIL, and gain a lot of speed
by byroot on Sunday October 17, 2021 @05:57PM
(#28900162)
That was solved years ago by moving the refcounts into different pages: https://instagram-engineering.com/copy-on-write-friendly-pyt...