New issue
Advanced search Search tips

Issue 592752 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Apr 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Feature



Sign in to add a comment

Investigate and Move to Windows SRWLocks for base::Lock

Project Member Reported by robliao@chromium.org, Mar 7 2016

Issue description

Slim Reader/Writer Locks (SRWLock)
https://msdn.microsoft.com/en-us/library/windows/desktop/aa904937(v=vs.85).aspx

Now that we're on Win7+, we can investigate and move towards SRWLocks. They're pointer sizes and generally faster than critsecs under exclusive mode.
 
Labels: -Type-Bug Type-Feature
Components: Internals>PlatformIntegration
Tightloop Tests on a Powerful Machine

  for (unsigned int i = 0; i < 10000000; ++i) {
    EnterCriticalSection(&critsec);
    LeaveCriticalSection(&critsec);
  }

vs

  for (unsigned int i = 0; i < 10000000; i++) {
    AcquireSRWLockExclusive(&srwlock);
    ReleaseSRWLockExclusive(&srwlock);
  }

The SRWLock version for release builds is around 20-30 ms faster. 
On debug builds, SRWLock is around 40-50 ms faster.
Cc: -robliao@chromium.org
Owner: robliao@chromium.org
Status: Started (was: Available)
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 11 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7a8a904bfdf23bb8cacba471718bc09a0d9a3175

commit 7a8a904bfdf23bb8cacba471718bc09a0d9a3175
Author: robliao <robliao@chromium.org>
Date: Mon Apr 11 19:39:42 2016

Migrate from CRITICAL_SECTION to SRWLOCK

With the new Win 7 minimum version requirement, we can start using SRWLOCKs, which are lighter weight and generally faster than CRITICAL_SECTIONS under exclusive mode, which is what we use.

BUG= 592752 

Review URL: https://codereview.chromium.org/1864323002

Cr-Commit-Position: refs/heads/master@{#386442}

[modify] https://crrev.com/7a8a904bfdf23bb8cacba471718bc09a0d9a3175/base/synchronization/condition_variable.h
[modify] https://crrev.com/7a8a904bfdf23bb8cacba471718bc09a0d9a3175/base/synchronization/condition_variable_win.cc
[modify] https://crrev.com/7a8a904bfdf23bb8cacba471718bc09a0d9a3175/base/synchronization/lock.h
[modify] https://crrev.com/7a8a904bfdf23bb8cacba471718bc09a0d9a3175/base/synchronization/lock_impl.h
[modify] https://crrev.com/7a8a904bfdf23bb8cacba471718bc09a0d9a3175/base/synchronization/lock_impl_win.cc

Status: Verified (was: Started)
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/8ce8b7f02264873346f8a6ca0be5b6492dd4e7c4

commit 8ce8b7f02264873346f8a6ca0be5b6492dd4e7c4
Author: Loo Rong Jie <loorongjie@gmail.com>
Date: Thu Jun 01 12:18:44 2017

[base] Migrate Mutex from CRITICAL_SECTION to SRWLOCK

SRWLOCK is a faster and lightweight alternative of CRITICAL_SECTION for
non-recursive use case.

Bug:  chromium:592752 
Change-Id: Ie97cd9cee2d50a95f316b41c30e953f586b06c99
Reviewed-on: https://chromium-review.googlesource.com/520828
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Loo Rong Jie <loorongjie@gmail.com>
Cr-Commit-Position: refs/heads/master@{#45658}
[modify] https://crrev.com/8ce8b7f02264873346f8a6ca0be5b6492dd4e7c4/src/base/platform/condition-variable.cc
[modify] https://crrev.com/8ce8b7f02264873346f8a6ca0be5b6492dd4e7c4/src/base/platform/mutex.cc
[modify] https://crrev.com/8ce8b7f02264873346f8a6ca0be5b6492dd4e7c4/src/base/platform/mutex.h

Sign in to add a comment