Skip to content

Instantly share code, notes, and snippets.

@alekswn
Last active January 5, 2026 20:39
Show Gist options
  • Select an option

  • Save alekswn/24fb2d1892bb0914b34ca9bcf66145f6 to your computer and use it in GitHub Desktop.

Select an option

Save alekswn/24fb2d1892bb0914b34ca9bcf66145f6 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <pthread.h>
#include <time.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#ifdef __x86_64__
#include <x86intrin.h>
#define GET_CYCLES() __rdtsc()
#elif defined(__aarch64__)
static inline uint64_t GET_CYCLES(void) {
uint64_t cycles;
__asm__ volatile("mrs %0, cntvct_el0" : "=r" (cycles));
return cycles;
}
#else
#define GET_CYCLES() 0 // Fallback for unsupported architectures
#endif
typedef struct {
size_t value;
pthread_mutex_t mutex;
} mutex_counter_t;
typedef struct {
union {
mutex_counter_t *mutex_counters;
atomic_size_t *atomic_counters;
size_t *plain_counters;
}; // 8 bytes
uint32_t *cycles; // 4 bytes
uint32_t num_iterations; // 4 bytes
uint16_t num_counters; // 2 bytes
uint16_t thread_id; // 2 bytes
memory_order mem_order; //1 byte?
} __attribute__((aligned(64))) thread_data_t;
static inline
void increment_cas_counter(atomic_size_t *counter, memory_order mem_order) {
size_t expected, required;
do {
expected = atomic_load_explicit(counter, mem_order);
required = expected + 1;
} while (!atomic_compare_exchange_weak_explicit(counter,
&expected, required,
mem_order, mem_order));
}
#define DECLARE_COUNTER_THREAD(name, impl) \
void* name##_counter_thread(void* arg) { \
thread_data_t *data = (thread_data_t*)arg; \
for (size_t i = 0, j = 0; i < data->num_iterations; i++, j = (j+1) % data->num_counters) { \
uint64_t start_cycles = GET_CYCLES(); \
do { \
impl \
} while(0); \
uint64_t end_cycles = GET_CYCLES(); \
data->cycles[i] = end_cycles - start_cycles; \
} \
return NULL; \
}
DECLARE_COUNTER_THREAD(mutex,
pthread_mutex_lock(&data->mutex_counters[j].mutex);
data->mutex_counters[j].value++;
pthread_mutex_unlock(&data->mutex_counters[j].mutex);
)
DECLARE_COUNTER_THREAD(atomic_fetch_add,
atomic_fetch_add_explicit(&data->atomic_counters[j], 1, data->mem_order);
)
DECLARE_COUNTER_THREAD(atomic_cas,
increment_cas_counter(&data->atomic_counters[j], data->mem_order);
)
DECLARE_COUNTER_THREAD(plain,
data->plain_counters[(size_t)data->thread_id*(size_t)data->num_counters + j]++;
)
DECLARE_COUNTER_THREAD(noop,
(void)0;
)
double get_time_diff(struct timeval *start, struct timeval *end) {
return (end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec) / 1000000.0;
}
int compare_uint32(const void *a, const void *b) {
uint32_t ua = *(const uint32_t*)a;
uint32_t ub = *(const uint32_t*)b;
return (ua > ub) - (ua < ub);
}
void calculate_percentiles(uint32_t array[], size_t sz,
size_t denominator, const size_t numerators[],
size_t num_percentiles, uint32_t out_percentiles[]) {
qsort(array, sz, sizeof(uint32_t), compare_uint32);
for (size_t i = 0; i < num_percentiles; i++) {
const size_t sz_mult_numerator = sz * numerators[i];
const size_t index = sz_mult_numerator / denominator;
const size_t reminder = sz_mult_numerator % denominator;
if (index == 0) {
out_percentiles[i] = array[0];
continue;
}
out_percentiles[i] = array[index - 1];
if (reminder && index) {
out_percentiles[i] += array[index+1];
out_percentiles[i] /= 2;
}
}
}
#define DECLARE_RUN_BENCHMARK(name, counter_decl, counter_name, thread_name, init_impl, cleanup_impl, m_order) \
double run_##name##_counter_benchmark(uint16_t num_threads, uint16_t num_counters, \
uint32_t total_iterations, uint32_t cycles[]) { \
pthread_t threads[num_threads]; \
thread_data_t thread_data[num_threads]; \
counter_decl; \
struct timeval start, end; \
for (size_t i = 0; i < num_counters; i++) { \
init_impl \
} \
const uint32_t increments_per_iteration = (uint32_t)num_threads; \
const uint32_t base_iterations = total_iterations / increments_per_iteration; \
const uint32_t remainder = total_iterations % increments_per_iteration; \
for (size_t t = 0, i = 0; t < num_threads; t++) { \
const uint32_t num_iterations = base_iterations + (t < remainder ? 1 : 0); \
thread_data[t].counter_name = counter_name; \
thread_data[t].cycles = &cycles[i]; \
thread_data[t].num_counters = num_counters; \
thread_data[t].num_iterations = num_iterations; \
thread_data[t].thread_id = t; \
thread_data[t].mem_order = m_order; \
i+=num_iterations; \
} \
gettimeofday(&start, NULL); \
for (size_t t = 0; t < num_threads; t++) { \
pthread_create(&threads[t], NULL, thread_name##_counter_thread, &thread_data[t]); \
} \
for (int t = 0; t < num_threads; t++) { \
pthread_join(threads[t], NULL); \
} \
gettimeofday(&end, NULL); \
uint32_t total_increments = 0; \
for (int i = 0; i < num_counters; i++) { \
cleanup_impl \
} \
if (total_increments != total_iterations) abort(); \
return get_time_diff(&start, &end); \
}
DECLARE_RUN_BENCHMARK(mutex, mutex_counter_t mutex_counters[num_counters], mutex_counters, mutex, {
if (pthread_mutex_init(&mutex_counters[i].mutex, NULL))
abort();
mutex_counters[i].value = 0;
},{
total_increments += mutex_counters[i].value;
pthread_mutex_destroy(&mutex_counters[i].mutex);
}, 0)
DECLARE_RUN_BENCHMARK(cas_relaxed, atomic_size_t atomic_counters[num_counters], atomic_counters, atomic_cas, {
atomic_init(&atomic_counters[i], 0);
},{
total_increments += atomic_load(&atomic_counters[i]);
}, memory_order_relaxed)
DECLARE_RUN_BENCHMARK(fetch_add_seq_cst, atomic_size_t atomic_counters[num_counters], atomic_counters, atomic_fetch_add, {
atomic_init(&atomic_counters[i], 0);
},{
total_increments += atomic_load(&atomic_counters[i]);
}, memory_order_seq_cst)
DECLARE_RUN_BENCHMARK(fetch_add_acq_rel, atomic_size_t atomic_counters[num_counters], atomic_counters, atomic_fetch_add, {
atomic_init(&atomic_counters[i], 0);
},{
total_increments += atomic_load(&atomic_counters[i]);
}, memory_order_acq_rel)
DECLARE_RUN_BENCHMARK(fetch_add_relaxed, atomic_size_t atomic_counters[num_counters], atomic_counters, atomic_fetch_add, {
atomic_init(&atomic_counters[i], 0);
},{
total_increments += atomic_load(&atomic_counters[i]);
}, memory_order_relaxed)
DECLARE_RUN_BENCHMARK(plain, size_t plain_counters[(size_t)num_threads*(size_t)num_counters], plain_counters, plain, {
(void)0;
},{
total_increments = total_iterations;
}, 0)
DECLARE_RUN_BENCHMARK(noop, size_t *plain_counters = NULL, plain_counters, noop, {
(void)0;
},{
total_increments = total_iterations;
}, 0)
int main(int argc, char *argv[]) {
// Test configurations
const uint16_t thread_counts[] = {1, 10, 100, 1000};
const uint16_t counter_counts[] = {1, 2, 8, 32, 128};
double (*benchmarks[])(uint16_t, uint16_t, uint32_t, uint32_t[]) = {
&run_mutex_counter_benchmark,
&run_cas_relaxed_counter_benchmark,
&run_fetch_add_seq_cst_counter_benchmark,
&run_fetch_add_acq_rel_counter_benchmark,
&run_fetch_add_relaxed_counter_benchmark,
&run_plain_counter_benchmark,
&run_noop_counter_benchmark,
};
const char* benchmark_names[] = { "Mutex", "CAS-Relaxed", "Atomic-SeqCst", "Atomic-AcqRel", "Atomic-Relaxed", "Plain", "NO-OP" };
const size_t num_thread_configs = sizeof(thread_counts) / sizeof(thread_counts[0]);
const size_t num_counter_configs = sizeof(counter_counts) / sizeof(counter_counts[0]);
const size_t num_benchmarks = sizeof(benchmarks) / sizeof(benchmarks[0]);
const size_t num_benchmark_names = sizeof(benchmark_names) / sizeof(benchmark_names[0]);
if (num_benchmarks != num_benchmark_names) abort();
const uint32_t total_iterations = thread_counts[num_thread_configs - 1] * counter_counts[num_counter_configs - 1];
const size_t percentile_denominator = 100000;
const size_t percentile_numerators[] = {50000, 90000, 99000, 99990, 99999};
const size_t num_percentiles = sizeof(percentile_numerators) / sizeof(percentile_numerators[0]);
uint32_t percentiles[num_percentiles];
uint32_t cycles[total_iterations];
printf("Total iterations: %u\n", total_iterations);
printf("%-20s %4s %4s %8s %8s %12s %8s %8s %8s %8s %8s\n",
"Type", "Thrd", "Cntr", "Total", "Time(s)", "Ops/sec", "P50", "P90", "P99", "P99.99", "P99.999");
printf("===================================================================================================================\n");
// Run benchmarks
for (size_t i = 0; i < num_thread_configs; i++) {
for (size_t j = 0; j < num_counter_configs; j++) {
for (size_t k = 0; k < num_benchmarks; k++) {
const double elapsed = benchmarks[k](thread_counts[i], counter_counts[j], total_iterations, cycles);
const double ops_per_sec = total_iterations / elapsed;
calculate_percentiles(cycles, total_iterations,
percentile_denominator, percentile_numerators,
num_percentiles, percentiles);
printf("%-20s %4u %4u %8u %8.3f %12.0f %8u %8u %8u %8u %8u\n",
benchmark_names[k],
thread_counts[i], counter_counts[j], total_iterations, elapsed, ops_per_sec,
percentiles[0], percentiles[1], percentiles[2], percentiles[3], percentiles[4]);
}
printf("\n");
}
}
return 0;
}
@alekswn
Copy link
Author

alekswn commented Jan 5, 2026

Macbook M1 results:

Total iterations: 128000
Type                 Thrd Cntr    Total  Time(s)      Ops/sec      P50      P90      P99   P99.99  P99.999
===================================================================================================================
Mutex                   1    1   128000    0.003     48048048        0        1        1        3     1933
CAS-Relaxed             1    1   128000    0.001    175824176        0        1        1        1        2
Atomic-SeqCst           1    1   128000    0.007     17462483        1        2        3        5      241
Atomic-AcqRel           1    1   128000    0.008     15682431        1        3        4      109      592
Atomic-Relaxed          1    1   128000    0.001    146620848        0        1        1        6        9
Plain                   1    1   128000    0.001    150411281        0        1        1        1        5
NO-OP                   1    1   128000    0.000    695652174        0        0        1        1        1

Mutex                   1    2   128000    0.001    122488038        0        1        1        1        4
CAS-Relaxed             1    2   128000    0.001    160000000        0        1        1        1        5
Atomic-SeqCst           1    2   128000    0.004     34015413        1        1        1       14      206
Atomic-AcqRel           1    2   128000    0.004     35388443        1        1        1        2       98
Atomic-Relaxed          1    2   128000    0.001    176551724        0        1        1        5      107
Plain                   1    2   128000    0.001    183644189        0        0        1        1       77
NO-OP                   1    2   128000    0.000    847682119        0        0        1        1       12

Mutex                   1    8   128000    0.001    136025505        0        1        1        3        5
CAS-Relaxed             1    8   128000    0.001    176308540        0        1        1        1        3
Atomic-SeqCst           1    8   128000    0.005     23809524        1        2        3       72      260
Atomic-AcqRel           1    8   128000    0.003     43331077        1        1        1       14       15
Atomic-Relaxed          1    8   128000    0.001    206451613        0        0        1        1        5
Plain                   1    8   128000    0.001    221837088        0        0        1        1        2
NO-OP                   1    8   128000    0.000   1024000000        0        0        0        1        1

Mutex                   1   32   128000    0.001    167101828        0        1        1        2       55
CAS-Relaxed             1   32   128000    0.001    212624585        0        0        1        1        5
Atomic-SeqCst           1   32   128000    0.003     43581886        1        1        1        2      367
Atomic-AcqRel           1   32   128000    0.003     43775650        1        1        1        7      304
Atomic-Relaxed          1   32   128000    0.001    242424242        0        0        1        1        4
Plain                   1   32   128000    0.001    246628131        0        0        1        1        3
NO-OP                   1   32   128000    0.000   1094017094        0        0        0        1        1

Mutex                   1  128   128000    0.001    185776488        0        1        1        1        3
CAS-Relaxed             1  128   128000    0.001    232727273        0        0        1        1        3
Atomic-SeqCst           1  128   128000    0.003     47530635        0        1        1        2      167
Atomic-AcqRel           1  128   128000    0.003     48084147        0        1        1        2       12
Atomic-Relaxed          1  128   128000    0.001    253465347        0        0        1        1        3
Plain                   1  128   128000    0.001    256000000        0        0        1        1        2
NO-OP                   1  128   128000    0.000   1153153153        0        0        0        1        1

Mutex                  10    1   128000    0.002     52330335        0        1        3     4927    10195
CAS-Relaxed            10    1   128000    0.017      7693232        0       26      204    19866    37808
Atomic-SeqCst          10    1   128000    0.008     16139201       10       30       42      654     2601
Atomic-AcqRel          10    1   128000    0.009     14504249       15       30       31     1056    17738
Atomic-Relaxed         10    1   128000    0.007     19399818       10       29       41      472     1448
Plain                  10    1   128000    0.000    624390244        0        0        1        7       39
NO-OP                  10    1   128000    0.000    820512821        0        0        0        1        1

Mutex                  10    2   128000    0.002     67796610        0        1        7     2095     2557
CAS-Relaxed            10    2   128000    0.013      9635652        0       26      342     9044    36194
Atomic-SeqCst          10    2   128000    0.007     19482496        9       19       30      952    20761
Atomic-AcqRel          10    2   128000    0.006     22686990        9       13       29       55    46099
Atomic-Relaxed         10    2   128000    0.005     24385597        9       14       30      974    11334
Plain                  10    2   128000    0.000    636815920        0        0        1        9       36
NO-OP                  10    2   128000    0.000    739884393        0        0        0        1        1

Mutex                  10    8   128000    0.003     46444122        0        2      124     1419     2269
CAS-Relaxed            10    8   128000    0.006     21599730        0       29       76      324    67341
Atomic-SeqCst          10    8   128000    0.007     17780247       10       23       31     1900    19429
Atomic-AcqRel          10    8   128000    0.007     17812413       10       27       38      877    32169
Atomic-Relaxed         10    8   128000    0.006     20908200        9       27       42      282     3185
Plain                  10    8   128000    0.000    707182320        0        0        1        4       75
NO-OP                  10    8   128000    0.000    888888889        0        0        0        1       35

Mutex                  10   32   128000    0.003     42022324        0        3      129     1449     1909
CAS-Relaxed            10   32   128000    0.003     36623748        0       18       54      985     3740
Atomic-SeqCst          10   32   128000    0.003     39191672        0       19       33       45    14429
Atomic-AcqRel          10   32   128000    0.003     44599303        0       15       33      235    10648
Atomic-Relaxed         10   32   128000    0.003     47814718        0       15       32       45      841
Plain                  10   32   128000    0.000    649746193        0        0        2        5        6
NO-OP                  10   32   128000    0.000    800000000        0        0        0        1        1

Mutex                  10  128   128000    0.002     64289302        0        2       19     1420     2212
CAS-Relaxed            10  128   128000    0.001    180535966        0        1       19      116      609
Atomic-SeqCst          10  128   128000    0.001    170894526        0        2       13       33     1253
Atomic-AcqRel          10  128   128000    0.001    121097446        0        3       19       75      577
Atomic-Relaxed         10  128   128000    0.000    256513026        0        1       11       37     2368
Plain                  10  128   128000    0.000    739884393        0        0        1        3      289
NO-OP                  10  128   128000    0.000    888888889        0        0        0        1        1

Mutex                 100    1   128000    0.003     41197296        0        1       58    22385    30276
CAS-Relaxed           100    1   128000    0.022      5913879        0       37      292   206628   260849
Atomic-SeqCst         100    1   128000    0.009     13999781       15       30       31      956     2676
Atomic-AcqRel         100    1   128000    0.008     16953642       10       29       31      868     3876
Atomic-Relaxed        100    1   128000    0.006     22401120        9       19       31      637     3135
Plain                 100    1   128000    0.001     95451156        0        0        1        3       22
NO-OP                 100    1   128000    0.001     98234843        0        0        0        1        1

Mutex                 100    2   128000    0.002     51675414        0        1       16    11059    19031
CAS-Relaxed           100    2   128000    0.017      7543612        0       23      405   112870   215144
Atomic-SeqCst         100    2   128000    0.008     15550966       12       30       31      980     3948
Atomic-AcqRel         100    2   128000    0.008     16886544       10       30       31      542     2145
Atomic-Relaxed        100    2   128000    0.006     20135284        8       26       31      650     2627
Plain                 100    2   128000    0.001     95522388        0        0        1        6        6
NO-OP                 100    2   128000    0.001     93704246        0        0        0        1       42

Mutex                 100    8   128000    0.003     41884817        0        1      125    14488    24833
CAS-Relaxed           100    8   128000    0.009     14458376        0       42      122     1201    11136
Atomic-SeqCst         100    8   128000    0.008     16725467       10       30       31     1080     3617
Atomic-AcqRel         100    8   128000    0.007     17105439       10       30       31      751     4918
Atomic-Relaxed        100    8   128000    0.005     23673016        7       19       31      371     1513
Plain                 100    8   128000    0.001     91233072        0        0        1        3       71
NO-OP                 100    8   128000    0.001     95025984        0        0        0        1        1

Mutex                 100   32   128000    0.003     37569709        0        4      140    12776    18487
CAS-Relaxed           100   32   128000    0.002     57117358        0       10       29       98      588
Atomic-SeqCst         100   32   128000    0.003     49230769        0       10       18      216     1608
Atomic-AcqRel         100   32   128000    0.003     47832586        0       11       23      464     1759
Atomic-Relaxed        100   32   128000    0.002     62745098        0       10       17       40      647
Plain                 100   32   128000    0.001     86486486        0        0        1        3       27
NO-OP                 100   32   128000    0.001     91690544        0        0        0        1       13

Mutex                 100  128   128000    0.002     63618290        0        2       25     7179     9249
CAS-Relaxed           100  128   128000    0.001     92418773        0        0        1        9       23
Atomic-SeqCst         100  128   128000    0.001     89260809        0        1        4       19      193
Atomic-AcqRel         100  128   128000    0.001     90651558        0        1        3       17      195
Atomic-Relaxed        100  128   128000    0.001     90909091        0        0        1        6       16
Plain                 100  128   128000    0.001     96168295        0        0        1        3       78
NO-OP                 100  128   128000    0.001     91233072        0        0        0        1        2

Mutex                1000    1   128000    0.016      7780209        0        1        2      469      807
CAS-Relaxed          1000    1   128000    0.016      7973091        0        0        3       87      114
Atomic-SeqCst        1000    1   128000    0.015      8677966        0        1        4       24      213
Atomic-AcqRel        1000    1   128000    0.014      8855680        0        1        4       24      373
Atomic-Relaxed       1000    1   128000    0.015      8439375        0        0        2       25      316
Plain                1000    1   128000    0.014      9021073        0        0        1        3       47
NO-OP                1000    1   128000    0.015      8780354        0        0        0        2        3

Mutex                1000    2   128000    0.013      9624784        0        1        1      304      873
CAS-Relaxed          1000    2   128000    0.015      8364920        0        0        2       32      388
Atomic-SeqCst        1000    2   128000    0.015      8413857        0        1        3       40      260
Atomic-AcqRel        1000    2   128000    0.015      8336590        0        1        3       11      132
Atomic-Relaxed       1000    2   128000    0.016      8161704        0        0        2       10      476
Plain                1000    2   128000    0.016      8164827        0        0        1        3       14
NO-OP                1000    2   128000    0.015      8510072        0        0        0        2       75

Mutex                1000    8   128000    0.015      8390142        0        1        4      416     1086
CAS-Relaxed          1000    8   128000    0.015      8524241        0        0        2       26       82
Atomic-SeqCst        1000    8   128000    0.014      9217254        0        0        2        9      139
Atomic-AcqRel        1000    8   128000    0.015      8492006        0        0        2       12       54
Atomic-Relaxed       1000    8   128000    0.015      8575640        0        0        2       12      128
Plain                1000    8   128000    0.015      8350186        0        0        1        3       22
NO-OP                1000    8   128000    0.014      9303002        0        0        0        1        6

Mutex                1000   32   128000    0.015      8365466        0        1        2      254      622
CAS-Relaxed          1000   32   128000    0.014      9054255        0        0        1        9      116
Atomic-SeqCst        1000   32   128000    0.015      8484125        0        0        1       10      133
Atomic-AcqRel        1000   32   128000    0.014      9180234        0        0        1       11       30
Atomic-Relaxed       1000   32   128000    0.014      9332167        0        0        1        7      232
Plain                1000   32   128000    0.015      8402258        0        0        1       21      167
NO-OP                1000   32   128000    0.014      9088327        0        0        0        1        3

Mutex                1000  128   128000    0.015      8702155        0        1        2      203      707
CAS-Relaxed          1000  128   128000    0.015      8730050        0        0        1        9      222
Atomic-SeqCst        1000  128   128000    0.016      7802024        0        0        1        8      151
Atomic-AcqRel        1000  128   128000    0.016      8174213        0        0        1       55      171
Atomic-Relaxed       1000  128   128000    0.016      8101266        0        0        1       58      188
Plain                1000  128   128000    0.016      8052847        0        0        1       97      224
NO-OP                1000  128   128000    0.015      8673850        0        0        0        1       41

@alekswn
Copy link
Author

alekswn commented Jan 5, 2026

AMD:

ubuntu@ip-172-31-52-28:~/24fb2d1892bb0914b34ca9bcf66145f6$ ./counter_benchmark
Total iterations: 128000
Type                 Thrd Cntr    Total  Time(s)      Ops/sec      P50      P90      P99   P99.99  P99.999
===================================================================================================================
Mutex                   1    1   128000    0.004     33613445       26       52      104      117    31304
CAS-Relaxed             1    1   128000    0.004     35001367       26       52       78      104    28743
Atomic-SeqCst           1    1   128000    0.004     36158192       26       52       52       91    17368
Atomic-AcqRel           1    1   128000    0.004     36056338       26       52       52      104    22516
Atomic-Relaxed          1    1   128000    0.002     58049887       26       26       26      129    12349
Plain                   1    1   128000    0.002     57944771       26       26       26       26      195
NO-OP                   1    1   128000    0.003     37813885       26       52       52       52    12259

Mutex                   1    2   128000    0.002     57347670       26       26       26       26    14235
CAS-Relaxed             1    2   128000    0.002     56612119       26       26       26       26    17966
Atomic-SeqCst           1    2   128000    0.002     57709648       26       26       26       26    12727
Atomic-AcqRel           1    2   128000    0.002     57528090       26       26       26       26    10152
Atomic-Relaxed          1    2   128000    0.002     57761733       26       26       26       26    13246
Plain                   1    2   128000    0.003     46630237       26       52      104      104    32708
NO-OP                   1    2   128000    0.002     57918552       26       26       26       26    12844

Mutex                   1    8   128000    0.002     57399103       26       26       26       26    11596
CAS-Relaxed             1    8   128000    0.002     57761733       26       26       26       26    12649
Atomic-SeqCst           1    8   128000    0.002     57892356       26       26       26       26    14196
Atomic-AcqRel           1    8   128000    0.002     55101162       26       26       26       26     8671
Atomic-Relaxed          1    8   128000    0.002     57787810       26       26       26       26    12336
Plain                   1    8   128000    0.002     57683641       26       26       26       26    14131
NO-OP                   1    8   128000    0.002     57761733       26       26       26       26    13935

Mutex                   1   32   128000    0.002     57579847       26       26       26       26    12402
CAS-Relaxed             1   32   128000    0.002     57605761       26       26       26       26    14755
Atomic-SeqCst           1   32   128000    0.002     57579847       26       26       26       26    19214
Atomic-AcqRel           1   32   128000    0.002     57944771       26       26       26       26    11830
Atomic-Relaxed          1   32   128000    0.002     58023572       26       26       26       26    13793
Plain                   1   32   128000    0.002     57168379       26       26       26       26    14664
NO-OP                   1   32   128000    0.002     57605761       26       26       26       26    17458

Mutex                   1  128   128000    0.002     57476426       26       26       26       26     9529
CAS-Relaxed             1  128   128000    0.002     57553957       26       26       26       26    11830
Atomic-SeqCst           1  128   128000    0.002     58128974       26       26       26       91    11492
Atomic-AcqRel           1  128   128000    0.002     57553957       26       26       26       26    17289
Atomic-Relaxed          1  128   128000    0.002     57944771       26       26       26       26    11895
Plain                   1  128   128000    0.002     58023572       26       26       26       26    12883
NO-OP                   1  128   128000    0.002     57347670       26       26       26       26    15587

Mutex                  10    1   128000    0.006     21419009       26     3614     8268   153308   512460
CAS-Relaxed            10    1   128000    0.004     34224599       26       78     7410    27092    45539
Atomic-SeqCst          10    1   128000    0.002     51612903       26     1378     4212    25740    33319
Atomic-AcqRel          10    1   128000    0.002     51261514       26     1170     4186    20305    31369
Atomic-Relaxed         10    1   128000    0.003     50874404       26     1403     4211    22932    29900
Plain                  10    1   128000    0.001     92285508       26      207     2288     6851    22724
NO-OP                  10    1   128000    0.000    266112266       26       26       26     3406    16367

Mutex                  10    2   128000    0.016      8245298       26      702    70304   189085   319371
CAS-Relaxed            10    2   128000    0.004     31143552       26     1508     7383    28925    80730
Atomic-SeqCst          10    2   128000    0.003     46109510       26     2470     4368    24869   119873
Atomic-AcqRel          10    2   128000    0.002     52588332       26     1378     4238    22814    28157
Atomic-Relaxed         10    2   128000    0.002     54122622       26     1300     3978    22736    31291
Plain                  10    2   128000    0.001    124756335       26       52     1482     5070    26090
NO-OP                  10    2   128000    0.000    283185841       26       26       26       26    10075

Mutex                  10    8   128000    0.014      9378664       26     1742    65260   189761   266318
CAS-Relaxed            10    8   128000    0.005     24724744       26     3354     7020    28768    38700
Atomic-SeqCst          10    8   128000    0.004     30798845       26     2990     6682    27222    67964
Atomic-AcqRel          10    8   128000    0.004     30490710       26     2886     6838    26650   139295
Atomic-Relaxed         10    8   128000    0.004     31698861       26     2938     6500    28560    97760
Plain                  10    8   128000    0.001    132917965       26      493      936     1742    17263
NO-OP                  10    8   128000    0.000    270613108       26       26       26       26    18408

Mutex                  10   32   128000    0.007     19643953       26     1325    30888    96290   121368
CAS-Relaxed            10   32   128000    0.002     68157614       26      806     3302    22347    28873
Atomic-SeqCst          10   32   128000    0.002     83714846       26      494     3198    16730    40534
Atomic-AcqRel          10   32   128000    0.001     89635854       26      494     3172    10087    28340
Atomic-Relaxed         10   32   128000    0.001     90909091       26      468     3146     7891    57083
Plain                  10   32   128000    0.001    224168126       26       26      546     1442     9139
NO-OP                  10   32   128000    0.000    270042194       26       26       26       26    24141

Mutex                  10  128   128000    0.003     46817849       26      598    11128    47515    65780
CAS-Relaxed            10  128   128000    0.001    119402985       26       52     1742     7708    26026
Atomic-SeqCst          10  128   128000    0.001    134453782       26      312     1768     5798    25090
Atomic-AcqRel          10  128   128000    0.001    133472367       26      312     1768     5122    19408
Atomic-Relaxed         10  128   128000    0.001    125736739       26      312     1794     9412   119691
Plain                  10  128   128000    0.000    267223382       26       26      312     1196     7852
NO-OP                  10  128   128000    0.000    267782427       26       26       26     6201    19955

Mutex                 100    1   128000    0.008     15816137       26     2574   296010   941122  2061371
CAS-Relaxed           100    1   128000    0.005     27391397       26     7878    22334    83707   116766
Atomic-SeqCst         100    1   128000    0.003     43805613       26       77     1040     8099    20293
Atomic-AcqRel         100    1   128000    0.003     40480708       26       77     3068    14508    24856
Atomic-Relaxed        100    1   128000    0.003     44459882       26       77      754     6227    21242
Plain                 100    1   128000    0.003     42328042       26       26      442     1287     4706
NO-OP                 100    1   128000    0.003     48503221       26       26       26       26     8450

Mutex                 100    2   128000    0.017      7420290     2132    61828   449878  1036385  2904056
CAS-Relaxed           100    2   128000    0.005     27580263       26     8918    22932    63063    82445
Atomic-SeqCst         100    2   128000    0.003     43700922       26       52      702     8008    22165
Atomic-AcqRel         100    2   128000    0.003     41477641       26       52      884     5512   355042
Atomic-Relaxed        100    2   128000    0.003     38870331       26      390     2209    18915    96355
Plain                 100    2   128000    0.003     44786564       26       26      259     1196    12662
NO-OP                 100    2   128000    0.003     42049934       26       26       52       52     9516

Mutex                 100    8   128000    0.016      7848427       26     7098   554970  1496131  2436265
CAS-Relaxed           100    8   128000    0.005     27651761       26    12480    30004    79274   127400
Atomic-SeqCst         100    8   128000    0.003     43925875       26       52      962     3808    19604
Atomic-AcqRel         100    8   128000    0.003     44537230       26      260     2183     9255    23243
Atomic-Relaxed        100    8   128000    0.003     42766455       26       52      832     5342    18876
Plain                 100    8   128000    0.003     45977011       26       26      338     1261     4381
NO-OP                 100    8   128000    0.003     46494733       26       26       26       26     9268

Mutex                 100   32   128000    0.007     18301401       26     3276   199680   736320   919659
CAS-Relaxed           100   32   128000    0.003     44568245       26       26      520     2300    20760
Atomic-SeqCst         100   32   128000    0.003     45022863       26       26      338     1703    20228
Atomic-AcqRel         100   32   128000    0.003     43835616       26       26      338     1703    17797
Atomic-Relaxed        100   32   128000    0.003     45422285       26       26      338     1663    19201
Plain                 100   32   128000    0.003     46242775       26       26       26     1144    15105
NO-OP                 100   32   128000    0.003     46732384       26       26       26       26    16419

Mutex                 100  128   128000    0.003     36592338       26      545     8944    65884   518036
CAS-Relaxed           100  128   128000    0.003     39445300       26       26      311     1910   172107
Atomic-SeqCst         100  128   128000    0.003     45309735       26       26      364     1547    21528
Atomic-AcqRel         100  128   128000    0.003     44153156       26       26      364     1846    22320
Atomic-Relaxed        100  128   128000    0.003     46886447       26       26      442     1885    16652
Plain                 100  128   128000    0.003     46681255       26       26       26     1144     5069
NO-OP                 100  128   128000    0.003     44092318       26       26       26       26    18135

Mutex                1000    1   128000    0.024      5320918       26       26      676     5083    31811
CAS-Relaxed          1000    1   128000    0.025      5164831       26       26       26     1404    19487
Atomic-SeqCst        1000    1   128000    0.024      5254731       26       26      389     1326    11869
Atomic-AcqRel        1000    1   128000    0.026      4961625       26       52      390     1287    12415
Atomic-Relaxed       1000    1   128000    0.025      5045528       26       26      364     1235     9087
Plain                1000    1   128000    0.025      5187857       26       26      260     1196     8424
NO-OP                1000    1   128000    0.026      4885869       26       26       52       52      156

Mutex                1000    2   128000    0.025      5028877       26       26      520     2067    18954
CAS-Relaxed          1000    2   128000    0.025      5211090       26       26       52     1391    16692
Atomic-SeqCst        1000    2   128000    0.025      5114476       26       26      364     1443    49296
Atomic-AcqRel        1000    2   128000    0.026      4872293       26       26      390     1365    18342
Atomic-Relaxed       1000    2   128000    0.025      5141801       26       26      364     1261     3198
Plain                1000    2   128000    0.025      5072119       26       26      260     1339     1599
NO-OP                1000    2   128000    0.026      4995122       26       26       52       52     7618

Mutex                1000    8   128000    0.026      4990253       26       26      520     2041    24479
CAS-Relaxed          1000    8   128000    0.026      5008805       26       26       52     1495    18746
Atomic-SeqCst        1000    8   128000    0.026      4983647       26       26      390     1352     8840
Atomic-AcqRel        1000    8   128000    0.026      4944185       26       26      390     1365     8358
Atomic-Relaxed       1000    8   128000    0.025      5034415       26       52      390     1339    24050
Plain                1000    8   128000    0.025      5066297       26       26      260     1261    25713
NO-OP                1000    8   128000    0.027      4817826       26       26       52       78     3107

Mutex                1000   32   128000    0.026      4960663       26       26      520     3288    27911
CAS-Relaxed          1000   32   128000    0.026      4993173       26       52       52     1365    21566
Atomic-SeqCst        1000   32   128000    0.027      4745838       26       26      390     1521    11504
Atomic-AcqRel        1000   32   128000    0.026      4961625       26       52      390     1391     8073
Atomic-Relaxed       1000   32   128000    0.025      5036792       26       52      390     1391     9138
Plain                1000   32   128000    0.026      4986948       26       26      259     1365     4667
NO-OP                1000   32   128000    0.025      5031051       26       26       52       52    45526

Mutex                1000  128   128000    0.025      5035009       26       52      520     3367    12753
CAS-Relaxed          1000  128   128000    0.026      4906847       26       26       52     1261    16523
Atomic-SeqCst        1000  128   128000    0.025      5052698       26       52      390     1222     9828
Atomic-AcqRel        1000  128   128000    0.025      5070311       26       26      390     1261    19395
Atomic-Relaxed       1000  128   128000    0.026      4870809       26       26      390     1339    30888
Plain                1000  128   128000    0.025      5038378       26       26      312     1365     9203
NO-OP                1000  128   128000    0.026      4998633       26       26       26       26     3354

ubuntu@ip-172-31-52-28:~/24fb2d1892bb0914b34ca9bcf66145f6$ cat /proc/cpuinfo | head
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 26
model           : 2
model name      : AMD EPYC 9R45
stepping        : 1
microcode       : 0xb00215a
cpu MHz         : 2600.000
cache size      : 1024 KB
physical id     : 0

@alekswn
Copy link
Author

alekswn commented Jan 5, 2026

c8g.48xlarge:

Total iterations: 128000
Type                 Thrd Cntr    Total  Time(s)      Ops/sec      P50      P90      P99   P99.99  P99.999
===================================================================================================================
Mutex                   1    1   128000    0.004     35774176       12       13       14       66    11349
CAS-Relaxed             1    1   128000    0.003     39131764       12       13       13       15     1744
Atomic-SeqCst           1    1   128000    0.003     38893953       12       13       14       15     3654
Atomic-AcqRel           1    1   128000    0.003     39167687       13       13       13       15     1262
Atomic-Relaxed          1    1   128000    0.003     38941284       12       13       14       15     4936
Plain                   1    1   128000    0.003     37903465       12       13       13       15     8888
NO-OP                   1    1   128000    0.003     39396737       13       13       14       15     3587

Mutex                   1    2   128000    0.003     38140644       13       13       22       73     7636
CAS-Relaxed             1    2   128000    0.003     38461538       12       13       13       15    20500
Atomic-SeqCst           1    2   128000    0.003     39036292       13       13       13       15     1916
Atomic-AcqRel           1    2   128000    0.003     39167687       13       13       14       14     2524
Atomic-Relaxed          1    2   128000    0.003     39348294       12       13       13       14     1416
Plain                   1    2   128000    0.003     39167687       12       13       14       14     5071
NO-OP                   1    2   128000    0.003     39143731       13       13       14       14       19

Mutex                   1    8   128000    0.003     38729198       13       13       19       68     4557
CAS-Relaxed             1    8   128000    0.003     39251763       12       13       13       15      111
Atomic-SeqCst           1    8   128000    0.003     39275851       13       13       14       14     6110
Atomic-AcqRel           1    8   128000    0.003     39215686       12       13       14       14     1309
Atomic-Relaxed          1    8   128000    0.003     38220364       12       13       14      150     5851
Plain                   1    8   128000    0.003     39072039       13       13       14       15     1714
NO-OP                   1    8   128000    0.003     39179676       12       13       14       14     1388

Mutex                   1   32   128000    0.003     38764385       13       13       19       70     4695
CAS-Relaxed             1   32   128000    0.003     39083969       13       13       14       15     2139
Atomic-SeqCst           1   32   128000    0.003     39360394       13       13       13       15     2364
Atomic-AcqRel           1   32   128000    0.003     38988730       12       13       14       15     4646
Atomic-Relaxed          1   32   128000    0.003     38976857       12       13       13       15     2099
Plain                   1   32   128000    0.003     39215686       12       13       14       15     2615
NO-OP                   1   32   128000    0.003     39203675       12       13       14       14     3684

Mutex                   1  128   128000    0.003     38670695       13       13       20       74     4473
CAS-Relaxed             1  128   128000    0.003     39227705       13       13       14       16     3984
Atomic-SeqCst           1  128   128000    0.003     38208955       12       13       14      128     2842
Atomic-AcqRel           1  128   128000    0.003     38964992       12       13       14       18     2830
Atomic-Relaxed          1  128   128000    0.003     39179676       12       13       14       18       52
Plain                   1  128   128000    0.003     39312039       12       13       13       14     4270
NO-OP                   1  128   128000    0.003     39119804       12       13       13       14     2462

Mutex                  10    1   128000    0.014      9369739       13      558    19657    57959    76119
CAS-Relaxed            10    1   128000    0.007     17169685       13     1599     4330    18163    25744
Atomic-SeqCst          10    1   128000    0.002     58688675       13       13      457     4674     8861
Atomic-AcqRel          10    1   128000    0.002     57476426       13       13      674     7385    11488
Atomic-Relaxed         10    1   128000    0.002     53985660       13       13      468     6105    11873
Plain                  10    1   128000    0.001    195121951       12       13       14      936     1153
NO-OP                  10    1   128000    0.001    200000000       12       13       13       14       18

Mutex                  10    2   128000    0.019      6909209      145     4679    15776    39060    54510
CAS-Relaxed            10    2   128000    0.011     11838698      347     1835     5837     8943    23807
Atomic-SeqCst          10    2   128000    0.002     57683641       13       13      598     6348    11033
Atomic-AcqRel          10    2   128000    0.002     58823529       13       13      538     7667    10579
Atomic-Relaxed         10    2   128000    0.002     52053680       13       13      605     5967    11390
Plain                  10    2   128000    0.001    189910979       12       13       14      302     3452
NO-OP                  10    2   128000    0.001    208809135       13       13       13       14       18

Mutex                  10    8   128000    0.014      8917375      225     2079    15883    47484    60490
CAS-Relaxed            10    8   128000    0.009     14575268      427     1208     4128    16560    21924
Atomic-SeqCst          10    8   128000    0.002     52523595       13       13      744     8077    17443
Atomic-AcqRel          10    8   128000    0.002     53917439       13       13      684     7067    66143
Atomic-Relaxed         10    8   128000    0.002     53556485       13       13      701     4627     8570
Plain                  10    8   128000    0.001    204146730       13       13       14      250      417
NO-OP                  10    8   128000    0.001    204800000       12       13       13       14       18

Mutex                  10   32   128000    0.004     30188679      216      684     1930    17656    31143
CAS-Relaxed            10   32   128000    0.004     32686415       13      701     2591    14372    22113
Atomic-SeqCst          10   32   128000    0.001    105960265       13       13      207     1251    14356
Atomic-AcqRel          10   32   128000    0.001    106400665       13       13      211     5946    11812
Atomic-Relaxed         10   32   128000    0.001    105610561       13       13      213     1260     6752
Plain                  10   32   128000    0.001    211221122       12       13       14      184     7914
NO-OP                  10   32   128000    0.001    197836167       12       13       14       14     2629

Mutex                  10  128   128000    0.004     36519258      216      493     1375    12188    18459
CAS-Relaxed            10  128   128000    0.001     91168091       13      145     1075     7699    12997
Atomic-SeqCst          10  128   128000    0.001    135593220       13       13      153      450      993
Atomic-AcqRel          10  128   128000    0.001    129685917       13       13      155      439     6071
Atomic-Relaxed         10  128   128000    0.001    136898396       13       13      144      920     6887
Plain                  10  128   128000    0.001    202531646       13       13       13       21     6830
NO-OP                  10  128   128000    0.001    205457464       12       13       13       16     6146

Mutex                 100    1   128000    0.023      5538728       13    56119   227998   606686   879215
CAS-Relaxed           100    1   128000    0.007     17657608      343     3373    32624   357968   615749
Atomic-SeqCst         100    1   128000    0.004     35874439       12       13       43      336     7824
Atomic-AcqRel         100    1   128000    0.003     36676218       12       13       27      251     5697
Atomic-Relaxed        100    1   128000    0.003     37198489       12       13       18      274     7595
Plain                 100    1   128000    0.003     37047757       12       13       14       20     5392
NO-OP                 100    1   128000    0.004     33988317       12       13       13       14    24154

Mutex                 100    2   128000    0.020      6403522       13    45399   205357   594489   922517
CAS-Relaxed           100    2   128000    0.011     12030075      654     3804    26359    87472   208899
Atomic-SeqCst         100    2   128000    0.004     34051609       13       13      220      884    10533
Atomic-AcqRel         100    2   128000    0.004     33755274       13       13      489     8156    49609
Atomic-Relaxed        100    2   128000    0.004     34905918       13       13      561     7273    11293
Plain                 100    2   128000    0.003     38038633       12       13       13       57      158
NO-OP                 100    2   128000    0.003     37780401       12       13       14       14     8449

Mutex                 100    8   128000    0.013      9484292      236     7768   163867   491059   733041
CAS-Relaxed           100    8   128000    0.010     13075902      754     4370    29982   109670   163075
Atomic-SeqCst         100    8   128000    0.004     34390113       13       13      673    10238    16761
Atomic-AcqRel         100    8   128000    0.004     34261242       13       13      567     9246    17051
Atomic-Relaxed        100    8   128000    0.004     35106967       13       13      471     7418    17895
Plain                 100    8   128000    0.003     36728838       12       13       14       20     5175
NO-OP                 100    8   128000    0.003     38243203       12       13       13       14       18

Mutex                 100   32   128000    0.005     25356577      233     1098    25414   132821   302516
CAS-Relaxed           100   32   128000    0.005     25271471       13     1285     8982    46973   170471
Atomic-SeqCst         100   32   128000    0.003     36940837       13       13       37      759     9590
Atomic-AcqRel         100   32   128000    0.003     37746977       12       13       17      507    32408
Atomic-Relaxed        100   32   128000    0.004     36373970       13       13       19      384     4012
Plain                 100   32   128000    0.004     36025894       12       13       14       21    10259
NO-OP                 100   32   128000    0.004     36312057       12       13       13       14     5719

Mutex                 100  128   128000    0.004     32512065      217      469     1497    77769   123414
CAS-Relaxed           100  128   128000    0.003     39179676       13       13      324     1920     8616
Atomic-SeqCst         100  128   128000    0.003     37026323       13       13       17      340    61452
Atomic-AcqRel         100  128   128000    0.003     40137974       13       13       40      321     2463
Atomic-Relaxed        100  128   128000    0.003     37791556       13       13       28      356     6091
Plain                 100  128   128000    0.004     34417854       12       13       14     3098     7576
NO-OP                 100  128   128000    0.003     37813885       12       13       13       15     4679

Mutex                1000    1   128000    0.029      4453723       13       13       64      624     8943
CAS-Relaxed          1000    1   128000    0.029      4360713       12       13       14      264     3619
Atomic-SeqCst        1000    1   128000    0.029      4363983       12       13       17      226     3849
Atomic-AcqRel        1000    1   128000    0.029      4489180       12       13       17      219      288
Atomic-Relaxed       1000    1   128000    0.029      4370838       12       13       17      202     3684
Plain                1000    1   128000    0.030      4265245       12       13       14       19    21586
NO-OP                1000    1   128000    0.029      4453568       12       13       13       14     2946

Mutex                1000    2   128000    0.029      4419127       13       13      106      615    18761
CAS-Relaxed          1000    2   128000    0.029      4468650       12       13       14      254     4211
Atomic-SeqCst        1000    2   128000    0.029      4427687       12       13       14      221     4692
Atomic-AcqRel        1000    2   128000    0.029      4397265       12       13       14      194     3643
Atomic-Relaxed       1000    2   128000    0.029      4373975       12       13       14      236    13434
Plain                1000    2   128000    0.031      4192872       12       13       13       20     5834
NO-OP                1000    2   128000    0.029      4364728       12       13       13       16    10254

Mutex                1000    8   128000    0.030      4306429       13       13      126      676    13810
CAS-Relaxed          1000    8   128000    0.028      4498647       12       13       14      224      569
Atomic-SeqCst        1000    8   128000    0.030      4304547       12       13       14      243     4225
Atomic-AcqRel        1000    8   128000    0.029      4363388       12       13       14      186      251
Atomic-Relaxed       1000    8   128000    0.028      4515469       12       13       14      235      403
Plain                1000    8   128000    0.029      4478030       12       13       14       20    11600
NO-OP                1000    8   128000    0.029      4437511       12       13       14       14     5461

Mutex                1000   32   128000    0.030      4338248       13       57      226      747     7541
CAS-Relaxed          1000   32   128000    0.030      4230426       12       13       15      386     9838
Atomic-SeqCst        1000   32   128000    0.029      4383562       12       13       14      237     3048
Atomic-AcqRel        1000   32   128000    0.030      4278504       12       13       14      260     4622
Atomic-Relaxed       1000   32   128000    0.029      4398474       12       13       14      222     3471
Plain                1000   32   128000    0.030      4255178       12       13       14     3052    12191
NO-OP                1000   32   128000    0.029      4397114       12       13       14       14     3093

Mutex                1000  128   128000    0.031      4190950       56      159      256     6439    12395
CAS-Relaxed          1000  128   128000    0.029      4444907       12       13       14      297     2948
Atomic-SeqCst        1000  128   128000    0.030      4296167       12       13       14      242     4543
Atomic-AcqRel        1000  128   128000    0.029      4349008       12       13       14      227     4033
Atomic-Relaxed       1000  128   128000    0.030      4260418       12       13       14      263     4064
Plain                1000  128   128000    0.030      4333401       12       13       14     3152    11148
NO-OP                1000  128   128000    0.029      4339424       12       13       14       16     6698

ubuntu@ip-172-31-37-184:~/24fb2d1892bb0914b34ca9bcf66145f6$ head /proc/cpuinfo
processor       : 0
BogoMIPS        : 2000.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd4f
CPU revision    : 1

processor       : 1

@alekswn
Copy link
Author

alekswn commented Jan 5, 2026

c7i.48xlarge

Total iterations: 128000
Type                 Thrd Cntr    Total  Time(s)      Ops/sec      P50      P90      P99   P99.99  P99.999
===================================================================================================================
Mutex                   1    1   128000    0.007     19190405       76       88       94      929    27093
CAS-Relaxed             1    1   128000    0.005     25884732       58       60       70      490    28663
Atomic-SeqCst           1    1   128000    0.005     25723473       54       56       64      866    23339
Atomic-AcqRel           1    1   128000    0.005     26688907       54       62       66      387    23506
Atomic-Relaxed          1    1   128000    0.005     26370004       54       56       66      245    18338
Plain                   1    1   128000    0.004     33298647       32       38       40      175    20615
NO-OP                   1    1   128000    0.003     36613272       30       30       36      114    12999

Mutex                   1    2   128000    0.006     21052632       76       78       92      259    20308
CAS-Relaxed             1    2   128000    0.005     24502297       58       66       70      410    36700
Atomic-SeqCst           1    2   128000    0.005     26186579       54       56       66      470    42319
Atomic-AcqRel           1    2   128000    0.005     25281454       54       62       66      244     4619
Atomic-Relaxed          1    2   128000    0.005     26451746       54       56       66      243    10861
Plain                   1    2   128000    0.004     33083484       34       38       40      192    33256
NO-OP                   1    2   128000    0.004     36127576       30       34       36      192    16970

Mutex                   1    8   128000    0.006     20529270       76       90       94      772    41085
CAS-Relaxed             1    8   128000    0.005     24839899       58       66       70      510    35648
Atomic-SeqCst           1    8   128000    0.005     26042726       54       56       66      251    25173
Atomic-AcqRel           1    8   128000    0.005     26337449       54       56       66      229    30345
Atomic-Relaxed          1    8   128000    0.005     26528497       54       56       66      248    16663
Plain                   1    8   128000    0.004     33281331       34       38       40      192    16094
NO-OP                   1    8   128000    0.004     34867883       30       30       32       91    27887

Mutex                   1   32   128000    0.006     21056095       76       78       92      275    45185
CAS-Relaxed             1   32   128000    0.005     24568138       58       68       72      328    31830
Atomic-SeqCst           1   32   128000    0.005     26117119       54       62       66      248    45827
Atomic-AcqRel           1   32   128000    0.005     25661588       54       58       66      257    41060
Atomic-Relaxed          1   32   128000    0.005     25432148       54       56       66      251    39065
Plain                   1   32   128000    0.004     34858388       32       34       40      157    29890
NO-OP                   1   32   128000    0.004     35884497       30       34       36      192    27079

Mutex                   1  128   128000    0.006     20618557       76       78       92      954    32904
CAS-Relaxed             1  128   128000    0.005     24413504       58       66       70      281   118160
Atomic-SeqCst           1  128   128000    0.005     25702811       54       62       66      438    24564
Atomic-AcqRel           1  128   128000    0.005     26229508       54       62       66      278    30978
Atomic-Relaxed          1  128   128000    0.005     26294166       54       58       66      249    29847
Plain                   1  128   128000    0.004     32703117       32       38       40      192    16511
NO-OP                   1  128   128000    0.004     36281179       30       30       36      112    12147

Mutex                  10    1   128000    0.018      6947083      520     8466    46018   128787   161812
CAS-Relaxed            10    1   128000    0.010     12342108     1236     3490     7216    46709    86757
Atomic-SeqCst          10    1   128000    0.009     13500686     1122     3070     6456    38333    73604
Atomic-AcqRel          10    1   128000    0.010     13418597     1106     3042     6556    33399    63412
Atomic-Relaxed         10    1   128000    0.010     13223140     1186     3158     6458    32148    73457
Plain                  10    1   128000    0.002     63586687       32       34       42     4275    56476
NO-OP                  10    1   128000    0.001    134878820       30       34       36      648    19016

Mutex                  10    2   128000    0.029      4373526       90    15420    77274   214273   463800
CAS-Relaxed            10    2   128000    0.011     11958146     1222     3672     7888    36440    57286
Atomic-SeqCst          10    2   128000    0.010     12327844     1238     3432     7308    57211    93246
Atomic-AcqRel          10    2   128000    0.010     12602146     1218     3358     7258    32903    69196
Atomic-Relaxed         10    2   128000    0.010     12643224     1220     3386     7260    40118    92638
Plain                  10    2   128000    0.003     42077581       32       34       40    30274    89488
NO-OP                  10    2   128000    0.001    146620848       30       34       36      716    39562

Mutex                  10    8   128000    0.017      7702955      306     6262    47734   129176   321762
CAS-Relaxed            10    8   128000    0.008     15936255      904     2956     6496    37724    70223
Atomic-SeqCst          10    8   128000    0.008     16978379      690     2518     6896    35699    57451
Atomic-AcqRel          10    8   128000    0.007     17114588      774     2540     6178    32751   115373
Atomic-Relaxed         10    8   128000    0.008     16946909      796     2616     6068    53538    80883
Plain                  10    8   128000    0.001     94885100       32       34       40     1191    40594
NO-OP                  10    8   128000    0.001    155151515       30       36       36      737     4162

Mutex                  10   32   128000    0.008     15892724      270     2336    23324    74672   260960
CAS-Relaxed            10   32   128000    0.004     31651830      318     1400     4168    37482    47125
Atomic-SeqCst          10   32   128000    0.004     36168409      316     1090     3168    37237    74021
Atomic-AcqRel          10   32   128000    0.004     34848897      308     1016     2992    32915    51717
Atomic-Relaxed         10   32   128000    0.004     35995501      320     1036     3152    31359    58442
Plain                  10   32   128000    0.001    143982002       32       34       40      614    28550
NO-OP                  10   32   128000    0.001    161209068       30       30       36      772    23920

Mutex                  10  128   128000    0.005     27485506      110     1118    13900    61637    99586
CAS-Relaxed            10  128   128000    0.002     55291577      220      692     1832    31424    45492
Atomic-SeqCst          10  128   128000    0.002     61805891      224      610     1238    31930    67079
Atomic-AcqRel          10  128   128000    0.002     63713290      226      586     1176    28096    63936
Atomic-Relaxed         10  128   128000    0.002     60663507      230      616     1296    14518    38024
Plain                  10  128   128000    0.001    131416838       32       34       40      859    32167
NO-OP                  10  128   128000    0.001    166233766       30       34       36      817    35611

Mutex                 100    1   128000    0.019      6780738       90      650   807386  4834457  6794460
CAS-Relaxed           100    1   128000    0.011     12109745     5298    21276    51508   155459   289425
Atomic-SeqCst         100    1   128000    0.010     12255841     5066    20448    50732   209100   327963
Atomic-AcqRel         100    1   128000    0.010     12829508     3866    18924    48924   136071   298818
Atomic-Relaxed        100    1   128000    0.011     11759302     4724    20304    52618   159233   261687
Plain                 100    1   128000    0.005     26970080       36       38       42     8198    53671
NO-OP                 100    1   128000    0.004     29110757       32       34       36      827    20504

Mutex                 100    2   128000    0.016      7782101       96     1334   675568  4897769  7736744
CAS-Relaxed           100    2   128000    0.011     12115476     5312    21210    52660   207331   447459
Atomic-SeqCst         100    2   128000    0.010     12479282     3992    18534    49228   117267   156784
Atomic-AcqRel         100    2   128000    0.010     12462272     4760    19710    50536   137459   234919
Atomic-Relaxed        100    2   128000    0.011     12091442     5092    21262    54110   145610   183528
Plain                 100    2   128000    0.006     23017443       36       38       40     7307    93053
NO-OP                 100    2   128000    0.005     27777778       32       34       36      890    21656

Mutex                 100    8   128000    0.014      8889506      192     1414   440190  5450065  7055383
CAS-Relaxed           100    8   128000    0.010     12209081     5036    21056    57280   230848   311123
Atomic-SeqCst         100    8   128000    0.010     12679544     4420    19946    48820   221404   527319
Atomic-AcqRel         100    8   128000    0.010     12685828     5180    20428    48706   191758   258429
Atomic-Relaxed        100    8   128000    0.011     12174244     3386    18630    50778   217544   504424
Plain                 100    8   128000    0.004     28783450       36       38       40      957   196347
NO-OP                 100    8   128000    0.005     26310380       30       32       34      842    21127

Mutex                 100   32   128000    0.007     19101627      366     3932    88480   963953  1295006
CAS-Relaxed           100   32   128000    0.005     27765727      396     1576     4814    48727    67100
Atomic-SeqCst         100   32   128000    0.005     25979298      266      752     1798    33856    73468
Atomic-AcqRel         100   32   128000    0.005     27503223      258      788     2158    30726    56968
Atomic-Relaxed        100   32   128000    0.006     22800143      254      750     1914    29025    72471
Plain                 100   32   128000    0.004     28913485       34       36       40      985    28447
NO-OP                 100   32   128000    0.005     27084215       30       32       34      811    27828

Mutex                 100  128   128000    0.006     20075282      208      904    13166    83822   688412
CAS-Relaxed           100  128   128000    0.006     21680217       64      558     1248    46932   290142
Atomic-SeqCst         100  128   128000    0.004     30865686       56      462      772     5060    56685
Atomic-AcqRel         100  128   128000    0.005     24591739       56      430      740    23280    42370
Atomic-Relaxed        100  128   128000    0.004     29767442       58      474      774     4047    49157
Plain                 100  128   128000    0.004     31022782       34       38       40      858    28269
NO-OP                 100  128   128000    0.005     27009918       30       34       36      730   188831

Mutex                1000    1   128000    0.041      3088952       80       92     1700    74179   100791
CAS-Relaxed          1000    1   128000    0.043      2985562       62      260      828     4750    30915
Atomic-SeqCst        1000    1   128000    0.040      3236901       62       76      656     2540   192160
Atomic-AcqRel        1000    1   128000    0.043      3003990       60      268      744     2833    43712
Atomic-Relaxed       1000    1   128000    0.043      3003355       62      140      744     2907    40960
Plain                1000    1   128000    0.040      3190906       36       40      102     1032     4140
NO-OP                1000    1   128000    0.042      3069103       32       34      102      944     8606

Mutex                1000    2   128000    0.044      2942326       82      136     1268    53526    76698
CAS-Relaxed          1000    2   128000    0.042      3032457       66      128      738     3537    38346
Atomic-SeqCst        1000    2   128000    0.043      2948969       62      254      752     2936    43995
Atomic-AcqRel        1000    2   128000    0.044      2941852       62      264      752     2977    36149
Atomic-Relaxed       1000    2   128000    0.043      3008155       58      234      828     4830    47923
Plain                1000    2   128000    0.042      3064400       36       40      102     1027    43904
NO-OP                1000    2   128000    0.042      3039658       34       36      102      997   132405

Mutex                1000    8   128000    0.043      2961797       82      292     1254    43203   122786
CAS-Relaxed          1000    8   128000    0.044      2925848       64      136      746     4945   153891
Atomic-SeqCst        1000    8   128000    0.043      2976675       62       96      646     1769    47251
Atomic-AcqRel        1000    8   128000    0.044      2922575       62      102      676     1764    42471
Atomic-Relaxed       1000    8   128000    0.046      2784970       60      202      712     2010    29823
Plain                1000    8   128000    0.043      2950669       38       40      102     1026    24536
NO-OP                1000    8   128000    0.040      3165026       32       36       94     1005    28606

Mutex                1000   32   128000    0.043      2979446       88      172      894    37253    49850
CAS-Relaxed          1000   32   128000    0.042      3061908       66       88      700     2139    47612
Atomic-SeqCst        1000   32   128000    0.045      2846848       60       98      672     1525    40810
Atomic-AcqRel        1000   32   128000    0.046      2792321       60       96      684     1691    29755
Atomic-Relaxed       1000   32   128000    0.043      2990025       62       88      652     1655    23391
Plain                1000   32   128000    0.043      2957486       36       40       96     1056   314588
NO-OP                1000   32   128000    0.043      2983544       32       34      102      961    45061

Mutex                1000  128   128000    0.044      2888021       88      254      916    28456    94522
CAS-Relaxed          1000  128   128000    0.044      2907373       66       84      768     1829    42714
Atomic-SeqCst        1000  128   128000    0.043      2943002       60       74      726     1657    31082
Atomic-AcqRel        1000  128   128000    0.045      2859441       60       86      734     2497    63193
Atomic-Relaxed       1000  128   128000    0.043      3011765       62       74      744     1594    34283
Plain                1000  128   128000    0.042      3022789       38       40       56     1258    43201
NO-OP                1000  128   128000    0.040      3192975       32       36      104      938     1116

ubuntu@ip-172-31-40-71:~/24fb2d1892bb0914b34ca9bcf66145f6$ head /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 143
model name      : Intel(R) Xeon(R) Platinum 8488C
stepping        : 8
microcode       : 0x2b000643
cpu MHz         : 3200.948
cache size      : 107520 KB
physical id     : 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment