פלאנט תוכנה חופשית בישראל (Planet FOSS-IL)

26 פברואר, 2015

Oz Nahum

Simple Multiprocessing Task Queue in Python

Yet another tutorial about Python's multiprocessing. What make this one different? Well, it's based on a real like example and show what is going on behind the sceanes on your Linux host. ... continue reading...

26 פברואר, 2015 06:01 PM

22 פברואר, 2015

Shlomi Fish

Optimisation Tip: Avoid Excessive Forks+EXECVEs to Processes

This will come as a surprise to few, but performing a separate fork() and EXECVE system calls (e.g: for `factor "$n"` in Perl or popen in C), on each iteration of a loop can really kill performance. One option to reduce that would be to read individual lines from a seq 2 999999 | xargs factor loop, or avoid forking altogether.

I discovered this issue while working on Project Euler problem #141, and I should have realised that the sub-100% CPU utilisation of the program was caused by the excessive spawning of new processes.

Licence

You can reuse this entry under the Creative Commons Attribution 3.0 Unported licence, or at your option any later version. See the instructions of how to comply with it.

22 פברואר, 2015 01:33 PM