|
|
|
|
|
by iooi
2898 days ago
|
|
I'm assuming you're talking about Python, which is also "4-5 lines" to use multithreading or multiprocessing. Can you explain what's wrong with GIL languages? Now that I think about it, it's even less than 4 lines: from multiprocess.pool import Pool (or ThreadPool) pool = Pool() pool.map(scrape, urls) |
|
However, for example when generating reports, try use the same instrument for serializing 4 pages of DB records to 4 pieces of a big CSV file, each working on a single CPU core. There the languages without GIL truly shine. And languages like Python and Ruby struggle unless their GIL implementations compromise and yield without waiting for an I/O operation to complete.