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.
I have done some modifications to
lock_slowandunlockofRawMutex.These are the benchmark results currently (on 8-core
Aarch64device):After the modifications, its the following:
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.