diff --git a/benchmarks/BenchOps/BenchOps.cpp b/benchmarks/BenchOps/BenchOps.cpp index fe44e4a4c..34d477116 100644 --- a/benchmarks/BenchOps/BenchOps.cpp +++ b/benchmarks/BenchOps/BenchOps.cpp @@ -14,6 +14,19 @@ Data src[16], dst[16]; #define N 10000000 +int count; + +force_inline void SSEZero16(void *t) +{ + _mm_storeu_si128((__m128i*)t, _mm_setzero_si128()); +} + +force_inline void SSEZero32(void *t) +{ + _mm_storeu_si128((__m128i*)t, _mm_setzero_si128()); + _mm_storeu_si128((__m128i*)t + 1, _mm_setzero_si128()); +} + CONSOLE_APP_MAIN { { @@ -23,6 +36,17 @@ CONSOLE_APP_MAIN AtomicDec(val); } } + { + RTIMING("Atomic and test"); + for(int i = 0; i < N; i++) { + if(i & 1) { + AtomicInc(val); + AtomicInc(val); + } + if(AtomicDec(val)) + count++; + } + } { static StaticMutex mtx; RTIMING("StaticMutex"); @@ -50,6 +74,12 @@ CONSOLE_APP_MAIN delete[] new byte[32]; } } + { + RTIMING("Alloc32/Free32"); + for(int i = 0; i < N; i++) { + MemoryFree32(MemoryAlloc32()); + } + } { RTIMING("Alloc/Free large"); for(int i = 0; i < N; i++) { @@ -74,6 +104,18 @@ CONSOLE_APP_MAIN dst[i & 15].Zero(); } } + { + RTIMING("SSEZero32"); + for(int i = 0; i < N; i++) { + SSEZero32(&dst[i & 15]); + } + } + { + RTIMING("SSEZero16"); + for(int i = 0; i < N; i++) { + SSEZero16(&dst[i & 15]); + } + } { RTIMING("Copy32"); for(int i = 0; i < N; i++) { diff --git a/benchmarks/BenchOps/BenchOps.upp b/benchmarks/BenchOps/BenchOps.upp index 7f14d1880..d4f5979e6 100644 --- a/benchmarks/BenchOps/BenchOps.upp +++ b/benchmarks/BenchOps/BenchOps.upp @@ -2,7 +2,7 @@ uses Core; file - BenchOps.cpp; + BenchOps.cpp optimize_speed; mainconfig "" = "MT";