4 ms·
Though it's not only about number crunching. I tried to implement a streaming protocol for certain ip cameras: You may already see the effects of GIL + the gene
by Phil_Latio 5y ago
Though it's not only about number crunching. I tried to implement a streaming protocol for certain ip cameras: You may already see the effects of GIL + the general slowness when reading many small packets from a network socket in one thread and parse/process the packets in another. While Python is my favorite tool for many years and I was seemingly aware of it's downsides, I really didn't expect how bad it performed in this case.
- xscott 5y ago> [...] when reading many small packets from a network socket [...] Yeah, I should've said it more carefully. That's what I was hinting at with the mention of Amdahl's law. The separate bits of I/O are done in C extensions which can release the GIL, and those can be done in parallel (with each other and your computation), but if each bit of work is small, the synchronization cost (reacquiring the GIL for each packet) becomes relatively large.