[+] More uncontested primitive benchmarks

This commit is contained in:
Reece Wilson 2023-09-18 17:45:36 +01:00
parent 880831b2fd
commit 112b118c71

View File

@ -110,7 +110,7 @@ TEST(Mutex, LockTest)
TEST(Mutex, Benchmark)
{
{
SysBenchmark("Mutex Benchmark 1'000'000");
SysBenchmark("Mutex Benchmark 1'000'000\t\t\t[AuMutex]");
for (AU_ITERATE_N(i, 1'000'000))
{
@ -120,7 +120,7 @@ TEST(Mutex, Benchmark)
}
{
SysBenchmark("Mutex 2 Benchmark 1'000'000 [no-new]");
SysBenchmark("Mutex 2 Benchmark 1'000'000 [no-new]\t[AuMutex]");
AuThreadPrimitives::Mutex mutex;
for (AU_ITERATE_N(i, 1'000'000))
@ -135,7 +135,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 1 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 3 Benchmark 1'000'000 [MS-STL or Clang libc++stl]");
SysBenchmark("Mutex 3 Benchmark 1'000'000\t\t[MS-STL or Clang libc++stl]");
for (AU_ITERATE_N(i, 1'000'000))
{
@ -150,7 +150,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 2 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 4 Benchmark 1'000'000 [no-new] [MS-STL or Clang libc++stl]");
SysBenchmark("Mutex 4 Benchmark 1'000'000 [no-new]\t[MS-STL or Clang libc++stl]");
std::mutex mutex;
for (AU_ITERATE_N(i, 1'000'000))
@ -166,7 +166,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 1 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 5 Benchmark 1'000'000 [SRW-Lock]");
SysBenchmark("Mutex 5 Benchmark 1'000'000\t\t[SRW-Lock]");
for (AU_ITERATE_N(i, 1'000'000))
{
@ -182,7 +182,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 2 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 6 Benchmark 1'000'000 [no-new] [SRW-Lock]");
SysBenchmark("Mutex 6 Benchmark 1'000'000 [no-new]\t[SRW-Lock]");
SRWLOCK lock;
InitializeSRWLock(&lock);
@ -196,7 +196,7 @@ TEST(Mutex, Benchmark)
#endif
{
SysBenchmark("Mutex 7 Benchmark 1'000'000 [AuFutexMutex]");
SysBenchmark("Mutex 7 Benchmark 1'000'000\t\t[AuFutexMutex]");
for (AU_ITERATE_N(i, 1'000'000))
{
@ -206,7 +206,7 @@ TEST(Mutex, Benchmark)
}
{
SysBenchmark("Mutex 8 Benchmark 1'000'000 [no-new] [AuFutexMutex]");
SysBenchmark("Mutex 8 Benchmark 1'000'000 [no-new]\t[AuFutexMutex]");
AuFutexMutex lock;
@ -215,6 +215,112 @@ TEST(Mutex, Benchmark)
AU_LOCK_GUARD(lock);
}
}
{
SysBenchmark("Mutex 9 Benchmark 1'000'000\t\t[Au CriticalSection/Renterable Mutex]");
for (AU_ITERATE_N(i, 1'000'000))
{
AuRenterableMutex cs;
AU_LOCK_GUARD(cs);
}
}
{
SysBenchmark("Mutex 10 Benchmark 1'000'000 [no-new]\t[Au CriticalSection/Renterable Mutex]");
AuRenterableMutex cs;
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(cs);
}
}
{
SysBenchmark("RW-Lock 11 Benchmark 1'000'000 [no-new]\t[RWLock_A_Read]\t\t\t");
AuRWLock rwLock;
auto pReadable = rwLock->AsReadable();
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(pReadable);
}
}
{
SysBenchmark("RW-Lock 12 Benchmark 1'000'000 [no-new]\t[RWLock_A_Write]\t\t");
AuRWLock rwLock;
auto pWritable = rwLock->AsWritable();
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(pWritable);
}
}
{
SysBenchmark("RW-Lock 13 Benchmark 1'000'000 [no-new]\t[RWLock_BRenterWrite_Read]\t");
AuRWRenterableLock rwLock;
auto pReadable = rwLock->AsReadable();
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(pReadable);
}
}
{
SysBenchmark("RW-Lock 14 Benchmark 1'000'000 [no-new]\t[RWLock_BRenterWrite_Write]\t");
AuRWRenterableLock rwLock;
auto pWritable = rwLock->AsWritable();
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(pWritable);
}
}
{
SysBenchmark("RW-Lock 15 Benchmark 1'000'000\t\t[RWLock_A_Read]\t\t\t");
for (AU_ITERATE_N(i, 1'000'000))
{
AuRWLock rwLock;
AU_LOCK_GUARD(rwLock->AsReadable());
}
}
{
SysBenchmark("RW-Lock 16 Benchmark 1'000'000\t\t[RWLock_A_Write]\t\t");
for (AU_ITERATE_N(i, 1'000'000))
{
AuRWLock rwLock;
AU_LOCK_GUARD(rwLock->AsWritable());
}
}
{
SysBenchmark("RW-Lock 17 Benchmark 1'000'000\t\t[RWLock_BRenterWrite_Read]\t");
for (AU_ITERATE_N(i, 1'000'000))
{
AuRWRenterableLock rwLock;
AU_LOCK_GUARD(rwLock->AsReadable());
}
}
{
SysBenchmark("RW-Lock 18 Benchmark 1'000'000\t\t[RWLock_BRenterWrite_Write]\t");
for (AU_ITERATE_N(i, 1'000'000))
{
AuRWRenterableLock rwLock;
AU_LOCK_GUARD(rwLock->AsWritable());
}
}
/*
Windows 7, i9 9900k (Q4 2018) @ 5GHz under KVM (v5.16.16), modified OVMF/EDK II, and modified QEMU: