[*] continue to shid n piss on microsoft

This commit is contained in:
Reece Wilson 2023-08-20 15:01:06 +01:00
parent 8f7753f831
commit 01a5e4348c
2 changed files with 55 additions and 16 deletions

@ -1 +1 @@
Subproject commit 2a1556d80c1b4f58a1288054ba699eb3bda4f699
Subproject commit 2a82e406a3948cfbde7d0e274988c43ca6aa6e09

View File

@ -17,14 +17,28 @@
TEST(Allocationless, SOO)
{
AuThreadPrimitives::ConditionMutex condMutex;
AuThreadPrimitives::ConditionVariable condVariable(AuUnsafeRaiiToShared(condMutex.AsPointer()));
AuThreadPrimitives::Mutex mutex;
AuThreadPrimitives::Event event(false, true, false);
AuThreadPrimitives::Semaphore semaphore;
AuThreadPrimitives::CriticalSection cs;
AuThreadPrimitives::RWLock rwLock;
AuThreadPrimitives::RWRenterableLock rwLock2;
{
AuThreadPrimitives::ConditionMutex condMutex;
AuThreadPrimitives::ConditionVariable condVariable(AuUnsafeRaiiToShared(condMutex.AsPointer()));
AuThreadPrimitives::Mutex mutex;
AuThreadPrimitives::Event event(false, true, false);
AuThreadPrimitives::Semaphore semaphore;
AuThreadPrimitives::CriticalSection cs;
AuThreadPrimitives::RWLock rwLock;
AuThreadPrimitives::RWRenterableLock rwLock2;
}
{
AuCondMutex condMutex;
AuCond condVariable(AuUnsafeRaiiToShared(condMutex.AsPointer()));
AuMutex mutex;
AuBinarySemaphore event(false, true, false);
AuSemaphore semaphore;
AuRenterableMutex cs;
AuRWLock rwLock;
AuRWRenterableLock rwLock2;
}
#if defined(TO_PROVE_A_POINT)
@ -52,10 +66,6 @@ TEST(Allocationless, SOO)
ASSERT_TRUE(AuSwInfo::IsWindowsXPOrGreater()); // ok this doesnt prove a point, but still
ASSERT_FALSE(!AuSwInfo::IsWindowsXPOrGreater());
// 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
// here's some fails where you might be able optimize a bit if you cared so deeply about shaving a few bytes off for
// less optimization, more slow compatibility layers, and lower res yielding, just to, i dont know, be forced into
// "windows 8+ optimization?" "ucrt optimization?" to save like 8-16 bytes???
#if 0
static_assert(sizeof(AuThreadPrimitives::Semaphore) <= sizeof(SRWLOCK) + sizeof(CONDITION_VARIABLE) + 4);
static_assert(sizeof(AuThreadPrimitives::Mutex) <= sizeof(SRWLOCK));
@ -63,8 +73,16 @@ TEST(Allocationless, SOO)
// note: performance will suffer under the stl under older windows versions
static_assert(sizeof(AuThreadPrimitives::Semaphore) <= sizeof(std::counting_semaphore)); // once again, this is optimized for a win8+ interface, and will suffer under older oses
// wont cuck our apis into being this small and intentionally bad. im not microsoft.
#endif
// So, uh, wouldn't it be funny if we could beat these too?
// Oh wait..
static_assert((sizeof(AuFutexMutex) - sizeof(void *) /*ignore vtable; these are final and declared in the header*/) < sizeof(std::timed_mutex));
static_assert((sizeof(AuFutexMutex) - sizeof(void *) /*ignore vtable; these are final and declared in the header*/) < sizeof(std::mutex));
static_assert((sizeof(AuFutexCond) - sizeof(void *) /*ignore vtable; these are final and declared in the header*/) < sizeof(std::condition_variable));
static_assert(sizeof(AuFutexCond) < sizeof(std::condition_variable));
static_assert(sizeof(AuFutexMutex) < sizeof(CRITICAL_SECTION));
static_assert(sizeof(AuFutexCond) == sizeof(CONDITION_VARIABLE));
#endif
}
@ -113,7 +131,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 1 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 3 Benchmark 1'000'000 [MS-STL]");
SysBenchmark("Mutex 3 Benchmark 1'000'000 [MS-STL or Clang libc++stl]");
for (AU_ITERATE_N(i, 1'000'000))
{
@ -128,7 +146,7 @@ TEST(Mutex, Benchmark)
// (relative to Mutex 2 Benchmark)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
SysBenchmark("Mutex 4 Benchmark 1'000'000 [no-new] [MS-STL]");
SysBenchmark("Mutex 4 Benchmark 1'000'000 [no-new] [MS-STL or Clang libc++stl]");
std::mutex mutex;
for (AU_ITERATE_N(i, 1'000'000))
@ -173,6 +191,27 @@ TEST(Mutex, Benchmark)
}
#endif
{
SysBenchmark("Mutex 7 Benchmark 1'000'000 [AuFutexMutex]");
for (AU_ITERATE_N(i, 1'000'000))
{
AuFutexMutex lock;
AU_LOCK_GUARD(lock);
}
}
{
SysBenchmark("Mutex 8 Benchmark 1'000'000 [no-new] [AuFutexMutex]");
AuFutexMutex lock;
for (AU_ITERATE_N(i, 1'000'000))
{
AU_LOCK_GUARD(lock);
}
}
/*
Windows 7, i9 9900k (Q4 2018) @ 5GHz under KVM (v5.16.16), modified OVMF/EDK II, and modified QEMU:
08:13:17 [Debug] | [Benchmark] Mutex Benchmark 1'000'000 took 10.23965ms