Просмотр исходного кода

chore: increase traversal rounds

Co-authored-by: blueloveTH <28104173+blueloveTH@users.noreply.github.com>
copilot-swe-agent[bot] 2 месяцев назад
Родитель
Сommit
7c5a033a86
2 измененных файлов с 4 добавлено и 4 удалено
  1. BIN
      benchmarks/struct_array_traverse
  2. 4 4
      benchmarks/struct_array_traverse.c

BIN
benchmarks/struct_array_traverse


+ 4 - 4
benchmarks/struct_array_traverse.c

@@ -15,7 +15,7 @@ static uint64_t bench_int(void) {
 
     volatile long long total = 0;
     uint64_t start = nanos();
-    for (int round = 0; round < 1000; ++round) {
+    for (int round = 0; round < 100000; ++round) {
         long long sum = 0;
         for (int i = 0; i < 1000; ++i) sum += arr[i];
         total += sum;
@@ -23,7 +23,7 @@ static uint64_t bench_int(void) {
     uint64_t end = nanos();
     // prevent optimization
     if (total == 0) printf("unused: %lld\n", total);
-    return (end - start) / 1000;
+    return (end - start) / 100000;
 }
 
 static uint64_t bench_char(void) {
@@ -32,14 +32,14 @@ static uint64_t bench_char(void) {
 
     volatile long long total = 0;
     uint64_t start = nanos();
-    for (int round = 0; round < 1000; ++round) {
+    for (int round = 0; round < 100000; ++round) {
         long long sum = 0;
         for (int i = 0; i < 1000; ++i) sum += arr[i];
         total += sum;
     }
     uint64_t end = nanos();
     if (total == 0) printf("unused: %lld\n", total);
-    return (end - start) / 1000;
+    return (end - start) / 100000;
 }
 
 int main(void) {