Locks serialize execution.
Bad
lock(_sync)
{
Process();
}
Better
-
Reduce lock scope
-
Prefer immutable data
-
Use
ConcurrentDictionary
Why
CPU cores idle while waiting.
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
Locks serialize execution.
Bad
lock(_sync)
{
Process();
}
Better
Reduce lock scope
Prefer immutable data
Use ConcurrentDictionary
Why
CPU cores idle while waiting.