#include "mat.h" #include "Timer/timer.h" /* TODO: Doesn't work, clang optimizes it away. We need RNG here. */ void com_mat_run_bench(void) { uint64_t start = com_timer_count_ns(); for (int i = 5000000; i--;) { com_mat_t a = com_mat_identity(); com_mat_t b = com_mat_identity(); a.a[3] = i * COM_FIX_FRACUNIT; b.a[9] = i * COM_FIX_FRACUNIT; COM_MAT_PROFILE_SINK(a); COM_MAT_PROFILE_SINK(b); com_mat_t mul = com_mat_mul(a, b); COM_MAT_PROFILE_SINK(mul); } com_timer_profile(start, "mat: mul"); }