From 61f5ad7107405f414b1b14ddff712388ecece98c Mon Sep 17 00:00:00 2001 From: jam Date: Fri, 11 Sep 2015 10:06:57 -0700 Subject: [PATCH] Revert of Try changing LockImpl to not have a spin count to see how it affects performance. (patchset #1 id:1 of https://codereview.chromium.org/1333053002/ ) Reason for revert: didn't make any difference Original issue's description: > Try changing LockImpl to not have a spin count to see how it affects performance. > > This was last change 7 years ago, and we have grown a lot of usages of locks since then. Since we don't use pthread_spin_lock on posix, I'm curious how this affects performance today on Windows. > > Committed: https://crrev.com/00c9ca679badffc7584439fff00f18cb3977d5da > Cr-Commit-Position: refs/heads/master@{#348280} TBR=cpu@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1340653003 Cr-Commit-Position: refs/heads/master@{#348417} --- base/synchronization/lock_impl_win.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/synchronization/lock_impl_win.cc b/base/synchronization/lock_impl_win.cc index 86febe911a99..fbc1bdd464b0 100644 --- a/base/synchronization/lock_impl_win.cc +++ b/base/synchronization/lock_impl_win.cc @@ -8,7 +8,9 @@ namespace base { namespace internal { LockImpl::LockImpl() { - ::InitializeCriticalSection(&native_handle_); + // The second parameter is the spin count, for short-held locks it avoid the + // contending thread from going to sleep which helps performance greatly. + ::InitializeCriticalSectionAndSpinCount(&native_handle_, 2000); } LockImpl::~LockImpl() { -- 2.11.4.GIT