Skip to content

Reliability improvements for RawMutex #528

Description

@Radonoxius

I have done some modifications to lock_slow and unlock of RawMutex.

These are the benchmark results currently (on 8-core Aarch64 device):

- Running with 8 threads
- 5 iterations inside lock, 5 iterations outside lock
- 5 seconds per test
        name         |    average     |     median     |    std.dev.   
parking_lot::Mutex   |   1036.994 kHz |   1669.948 kHz |    851.467 kHz
std::sync::Mutex     |    677.364 kHz |    680.531 kHz |     12.590 kHz
pthread_mutex_t      |    633.672 kHz |   1008.571 kHz |    378.294 kHz

After the modifications, its the following:

- Running with 8 threads
- 5 iterations inside lock, 5 iterations outside lock
- 5 seconds per test
        name         |    average     |     median     |    std.dev.   
parking_lot::Mutex   |   1399.458 kHz |   1440.332 kHz |     69.834 kHz
std::sync::Mutex     |    670.454 kHz |    672.427 kHz |     12.889 kHz
pthread_mutex_t      |    638.275 kHz |    900.675 kHz |    348.836 kHz

Would you be interested in a PR for these modifications?

The optimisation involves the removal of unnecessary CAS (weak) operations. It might fare even better on x86_64.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions