|
infix
A JIT-Powered FFI Library for C
|
Measures the performance of infix_register_types with many definitions. More...
#include "common/compat_c23.h"#include "common/double_tap.h"#include <infix/infix.h>#include <stdio.h>#include <stdlib.h>#include <time.h>Macros | |
| #define | DBLTAP_IMPLEMENTATION |
| #define | BENCHMARK_ITERATIONS 100 |
| #define | TYPES_PER_ITERATION 1000 |
Functions | |
| diag ("Type Registry Registration Benchmark") | |
| diag ("Iterations: %d", BENCHMARK_ITERATIONS) | |
| diag ("Types per iteration: %d", TYPES_PER_ITERATION) | |
| for (int i=0;i< TYPES_PER_ITERATION;++i) | |
| free (defs) | |
| diag ("Total time: %.4f s", total_time) | |
| diag ("Average registration time (%d types): %.2f ms", TYPES_PER_ITERATION, time_per_op_ms) | |
| pass ("Benchmark completed successfully.") | |
Variables | |
| TEST | |
| size_t | buf_size = TYPES_PER_ITERATION * 32 |
| char * | defs = malloc(buf_size) |
| char * | p = defs |
| clock_t | start = clock() |
| clock_t | end = clock() |
| double | total_time = ((double)(end - start)) / CLOCKS_PER_SEC |
| double | time_per_op_ms = (total_time / BENCHMARK_ITERATIONS) * 1e3 |
Measures the performance of infix_register_types with many definitions.
| #define BENCHMARK_ITERATIONS 100 |
| #define DBLTAP_IMPLEMENTATION |
| #define TYPES_PER_ITERATION 1000 |
| diag | ( | "Average registration time (%d types): %.2f ms" | , |
| TYPES_PER_ITERATION | , | ||
| time_per_op_ms | |||
| ) |
| diag | ( | "Iterations: %d" | , |
| BENCHMARK_ITERATIONS | |||
| ) |
| diag | ( | "Total time: %.4f s" | , |
| total_time | |||
| ) |
| diag | ( | "Type Registry Registration Benchmark" | ) |
| diag | ( | "Types per iteration: %d" | , |
| TYPES_PER_ITERATION | |||
| ) |
| for | ( | ) |
| free | ( | defs | ) |
| pass | ( | "Benchmark completed successfully." | ) |
| size_t buf_size = TYPES_PER_ITERATION * 32 |
| char* defs = malloc(buf_size) |
| clock_t end = clock() |
| char* p = defs |
| clock_t start = clock() |
| double time_per_op_ms = (total_time / BENCHMARK_ITERATIONS) * 1e3 |