- DelphiTools - https://www.delphitools.info -

Slim Reader/Writer Locks Rock!

padlockI recently posted abut the new Slim R/W Locks [1] introduced with Vista, and how they were vastly more efficient than TMREWS [2].

Apparently, they’re also more efficient than Critical Sections…

Following Up

If you follow the comments in the previous article [1], some extra benchmarks where published, including “degenerate” cases where the Slim R/W Locks are used as exclusive locks.

If you only use the Write lock portion of a R/W Lock, it will behave like an exclusive lock, aka Critical Section.

It appeared that Slim R/W Locks areĀ 1.5 to 2 times faster than Critical Sections.

Wrapping Up

So the advantages of Critical Sections that remain are:

Both Critical Sections and Slim R/W Locks share the following advantages over custom implementations (like TMonitor)