DelphiTools – TCriticalSection (along with TMonitor) suffers from a severe design flaw in which entering/leaving different TCriticalSection instances can end up serializing your threads, and the whole can even end up performing worse than if your threads had been serialized. This is because it’s a small, dynamically allocated object, so several TCriticalSection instances can end up in the same CPU cache line, and when that happens, you’ll have cache conflicts aplenty between the cores running the threads. How severe can that be? Well, it depends on how many cores you have, but the more cores you ...
Visits by Source
Users who voted for this posting
Kyle A. Miller