infix
A JIT-Powered FFI Library for C
|
A microbenchmark for FFI trampoline generation time. More...
Macros | |
#define | DBLTAP_IMPLEMENTATION |
#define | BENCHMARK_ITERATIONS 10000 |
Functions | |
void | benchmark_handler (Point p) |
diag ("Trampoline Generation Benchmark") | |
diag ("Iterations: %d", BENCHMARK_ITERATIONS) | |
diag ("Target: infix_reverse_create_callback_manual for Point(Point) using arena API") | |
for (int i=0;i< BENCHMARK_ITERATIONS;++i) | |
diag ("Total time: %.4f s", total_time) | |
diag ("Average generation time: %.2f us/op", time_per_generation_us) | |
pass ("Benchmark completed successfully.") | |
Variables | |
TEST | |
clock_t | start = clock() |
clock_t | end = clock() |
double | total_time = ((double)(end - start)) / CLOCKS_PER_SEC |
double | time_per_generation_us = (total_time / BENCHMARK_ITERATIONS) * 1e6 |
A microbenchmark for FFI trampoline generation time.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This test measures the performance of the trampoline creation process, which was the target of the arena allocator optimization. It should not be run as part of the regular test suite.
It repeatedly generates and destroys a reverse trampoline for a complex function signature using the manual, arena-based API. This measures the full setup cost and quantifies the performance of the type system and JIT generator.
#define BENCHMARK_ITERATIONS 10000 |
#define DBLTAP_IMPLEMENTATION |
void benchmark_handler | ( | Point | p | ) |
diag | ( | "Average generation time: %.2f us/op" | , |
time_per_generation_us | |||
) |
diag | ( | "Iterations: %d" | , |
BENCHMARK_ITERATIONS | |||
) |
diag | ( | "Target: infix_reverse_create_callback_manual for Point(Point) using arena API" | ) |
diag | ( | "Total time: %.4f s" | , |
total_time | |||
) |
diag | ( | "Trampoline Generation Benchmark" | ) |
for | ( | ) |
pass | ( | "Benchmark completed successfully." | ) |
clock_t end = clock() |
clock_t start = clock() |
double time_per_generation_us = (total_time / BENCHMARK_ITERATIONS) * 1e6 |