Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


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)


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.


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.


That was solved years ago by moving the refcounts into different pages: https://instagram-engineering.com/copy-on-write-friendly-pyt...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: