Skip to content

Conversation

@oldnewthing
Copy link
Member

Instead of running 100,000 iterations hoping to hit a race condition, use an instrumented vector/map that lets us inject delays into specific operations, and which detects concurrency violations. This allows us to force specific race conditions rather than waiting for them to happen.

This reduces the running time of the multi* tests from 80 seconds to 1.5 seconds, as measured on a Surface Pro 5 (dual Core-i5 7300U).

You can flip the #if at the top of multi_threaded_vector.cpp and multi_threaded_map.cpp to force the test to use a single-threaded collection and observe that the race conditions are hit.

@oldnewthing oldnewthing requested review from dunhor and kennykerr August 8, 2020 03:45
Instead of running 100,000 iterations hoping to hit a race condition,
use an instrumented vector/map that lets us inject delays into specific
operations, and which detects concurrency violations. This allows us
to force specific race conditions rather than waiting for them to happen.

This reduces the running time of the multi* tests from 80 seconds to
1.5 seconds, as measured on a Surface Pro 5 (dual Core-i5 7300U).

You can flip the #if at the top of multi_threaded_vector.cpp and
multi_threaded_map.cpp to force the test to use a single-threaded
collection and observe that the race conditions are hit.
Copy link
Member

@ChrisGuzak ChrisGuzak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the test speed up.

@kennykerr kennykerr merged commit 2cb852b into microsoft:master Aug 11, 2020
@oldnewthing oldnewthing deleted the concurrency-test branch August 11, 2020 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants