Repository navigation
Expand file tree
/
Copy pathbenchmarker_script.py
More file actions
66 lines (58 loc) · 2.44 KB
/
Copy pathbenchmarker_script.py
File metadata and controls
66 lines (58 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import asyncio
import rwlocker
from benchmarks.benchmark_scenario import (
IOBoundScenario, AsyncIOBoundScenario,
PureOverheadScenario, AsyncPureOverheadScenario
)
from benchmarks.benchmark_base import BenchmarkConfig
from benchmarks import (
thread_rwlock_benchmark,
async_rwlock_benchmark,
thread_rwcondition_benchmark,
async_rwcondition_benchmark
)
locks = [
thread_rwlock_benchmark.StandardRLockWrapper,
thread_rwlock_benchmark.StandardLockWrapper,
rwlocker.RWLockWrite, rwlocker.RWLockWriteReentrantWriter,
rwlocker.RWLockRead, rwlocker.RWLockReadReentrantWriter,
rwlocker.RWLockReaderPhaseFair, rwlocker.RWLockReaderPhaseFairReentrantWriter,
rwlocker.RWLockFair, rwlocker.RWLockFairReentrantWriter
]
async_locks = [
async_rwlock_benchmark.AsyncStandardLockWrapper,
rwlocker.AsyncRWLockWrite, rwlocker.AsyncRWLockWriteReentrantWriter,
rwlocker.AsyncRWLockRead, rwlocker.AsyncRWLockReadReentrantWriter,
rwlocker.AsyncRWLockReaderPhaseFair, rwlocker.AsyncRWLockReaderPhaseFairReentrantWriter,
rwlocker.AsyncRWLockFair, rwlocker.AsyncRWLockFairReentrantWriter
]
conditions = [
thread_rwcondition_benchmark.StandardConditionWrapper,
thread_rwcondition_benchmark.RWConditionWriteWrapper,
thread_rwcondition_benchmark.RWConditionReadWrapper,
thread_rwcondition_benchmark.RWConditionReaderPhaseFairWrapper,
thread_rwcondition_benchmark.RWConditionFairWrapper
]
async_conditions = [
async_rwcondition_benchmark.AsyncStandardConditionWrapper,
async_rwcondition_benchmark.AsyncRWConditionWriteWrapper,
async_rwcondition_benchmark.AsyncRWConditionReadWrapper,
async_rwcondition_benchmark.AsyncRWConditionReaderPhaseFairWrapper,
async_rwcondition_benchmark.AsyncRWConditionFairWrapper
]
scenarios = [
PureOverheadScenario(iterations=10)
]
async_scenarios = [
AsyncPureOverheadScenario(iterations=10)
]
benchmark_config = BenchmarkConfig.interactive()
if __name__ == '__main__':
thread_rwlock_benchmark.benchmark(scenarios=scenarios, locks=locks, config=benchmark_config)
asyncio.run(async_rwlock_benchmark.benchmark(
scenarios=async_scenarios, locks=async_locks, config=benchmark_config
))
thread_rwcondition_benchmark.benchmark(scenarios=scenarios, conditions=conditions, config=benchmark_config)
asyncio.run(async_rwcondition_benchmark.benchmark(
scenarios=async_scenarios, conditions=async_conditions, config=benchmark_config
))