New issue
Advanced search Search tips
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
link

Issue 592752: Investigate and Move to Windows SRWLocks for base::Lock

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

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.
 

Comment 1 by robliao@chromium.org, Mar 7 2016

Labels: -Type-Bug Type-Feature

Comment 2 by jsc...@chromium.org, Apr 5 2016

Components: Internals>PlatformIntegration

Comment 3 by robliao@chromium.org, Apr 5 2016

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.

Comment 4 by robliao@chromium.org, Apr 5 2016

Cc: -robliao@chromium.org
Owner: robliao@chromium.org
Status: Started (was: Available)

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

Project Member

Comment 6 by robliao@chromium.org, Apr 12 2016

Status: Verified (was: Started)

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

Project Member
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