Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / benchmark_example/main.cpp

sdl_runtime_compiler git · main

SDL3 game for running and compiling code at runtime

sdl3 c++ compiler dlopen cmake · first commit 2026-04-19 · last commit 2026-07-03 (3 months ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-runtime-compiler

C++ 72.3% C 26.2%
git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gz
benchmark_example/main.cpp 616 B · 33 lines raw
#include <benchmark/benchmark.h>
#include <SDL3/SDL.h>

static void BM_SDL_CreateDestroyWindow(benchmark::State& state)
{
    if (!SDL_Init(SDL_INIT_VIDEO))
    {
        state.SkipWithError(SDL_GetError());
        return;
    }

    for (auto _ : state)
    {
        SDL_Window* win = SDL_CreateWindow(
            "bench",
            640, 480,
            SDL_WINDOW_RESIZABLE
        );

        if (!win)
        {
            state.SkipWithError(SDL_GetError());
            break;
        }

        SDL_DestroyWindow(win);
    }

    SDL_Quit();
}

BENCHMARK(BM_SDL_CreateDestroyWindow);
BENCHMARK_MAIN();