mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@9485 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a52af3d4b3
commit
f16d7eae2e
2 changed files with 43 additions and 1 deletions
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ uses
|
|||
Core;
|
||||
|
||||
file
|
||||
BenchOps.cpp;
|
||||
BenchOps.cpp optimize_speed;
|
||||
|
||||
mainconfig
|
||||
"" = "MT";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue