|
@@ -1,3 +1,4 @@
|
|
|
|
+#include <inttypes.h>
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
#include "core/HashMap.h"
|
|
#include "core/HashMap.h"
|
|
@@ -38,7 +39,7 @@ static void fillOrder(HashMapInt* m) {
|
|
for(int i = 0; i < 10000; i++) {
|
|
for(int i = 0; i < 10000; i++) {
|
|
*putHashMapKeyInt(m, i) = i * i;
|
|
*putHashMapKeyInt(m, i) = i * i;
|
|
}
|
|
}
|
|
- printf("Fill Order: %ldns\n", getNanos() - nanos);
|
|
|
|
|
|
+ printf("Fill Order: %" PRId64 "ns\n", getNanos() - nanos);
|
|
}
|
|
}
|
|
|
|
|
|
static void fillChaos(HashMapInt* m) {
|
|
static void fillChaos(HashMapInt* m) {
|
|
@@ -49,7 +50,7 @@ static void fillChaos(HashMapInt* m) {
|
|
int r = randomI32(&random, 0, 10000);
|
|
int r = randomI32(&random, 0, 10000);
|
|
*putHashMapKeyInt(m, r) = r * r;
|
|
*putHashMapKeyInt(m, r) = r * r;
|
|
}
|
|
}
|
|
- printf("Fill Chaos: %ldns\n", getNanos() - nanos);
|
|
|
|
|
|
+ printf("Fill Chaos: %" PRId64 "ns\n", getNanos() - nanos);
|
|
}
|
|
}
|
|
|
|
|
|
static i64 average(HashMapInt* m, i64 (*f)(const HashMapInt* m), int n) {
|
|
static i64 average(HashMapInt* m, i64 (*f)(const HashMapInt* m), int n) {
|
|
@@ -65,8 +66,8 @@ static void order(int n) {
|
|
initHashMapInt(&m);
|
|
initHashMapInt(&m);
|
|
fillOrder(&m);
|
|
fillOrder(&m);
|
|
puts("Order Probing");
|
|
puts("Order Probing");
|
|
- printf("Search | %ld ms\n", average(&m, testSearch, n));
|
|
|
|
- printf("EmptySearch | %ld ms\n", average(&m, testEmptySearch, n));
|
|
|
|
|
|
+ printf("Search | %" PRId64 " ms\n", average(&m, testSearch, n));
|
|
|
|
+ printf("EmptySearch | %" PRId64 " ms\n", average(&m, testEmptySearch, n));
|
|
destroyHashMapInt(&m);
|
|
destroyHashMapInt(&m);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -75,8 +76,8 @@ static void chaos(int n) {
|
|
initHashMapInt(&m);
|
|
initHashMapInt(&m);
|
|
fillChaos(&m);
|
|
fillChaos(&m);
|
|
puts("Chaos Probing");
|
|
puts("Chaos Probing");
|
|
- printf("Search | %ld ms\n", average(&m, testSearch, n));
|
|
|
|
- printf("EmptySearch | %ld ms\n", average(&m, testEmptySearch, n));
|
|
|
|
|
|
+ printf("Search | %" PRId64 " ms\n", average(&m, testSearch, n));
|
|
|
|
+ printf("EmptySearch | %" PRId64 " ms\n", average(&m, testEmptySearch, n));
|
|
destroyHashMapInt(&m);
|
|
destroyHashMapInt(&m);
|
|
}
|
|
}
|
|
|
|
|