8 Commits
Author SHA1 Message Date
admin 7ba9cbc08a Merge pull request #113 from Alpaq92/release-0.10.0
Reaktor 0.10.0
2026-11-07 13:54:54 +01:00
Roman ChojnackiandClaude Opus 5.5 721b848e8b Reaktor 0.10.0
find_package asks for 0.10, and the benchmark rows are 0.10.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 13:52:24 +01:00
admin 75191ab62b Merge pull request #112 from Alpaq92/perf-frame-split
Timing that names the rasterizing, and skipped frames that stay clean and paced
2026-11-07 13:49:46 +01:00
Roman ChojnackiandClaude Opus 5.5 5d83c7e8e4 Performance: Reaktor's arms re-measured on 2026-11-07
Two passes of ten runs on the documented builds, the default one for
software, direct3d11 and direct3d12 and the OpenGL one for opengl, taken
in turn with master's: the two read the same. The chart, the alt texts
and the manual's memory line follow; older figures beside them carry
their dates. Started through Git Bash, the runner reads about 3 MB less
private memory, so the doc says to run it from PowerShell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 13:38:44 +01:00
Roman ChojnackiandClaude Opus 5.5 25e22230ca Skip pacing leaves print passes alone and waits for every window's drag
A print page's build-only frames set the callback rate and never ran
the countdown that puts it back, so an idle app kept iterating at the
display's refresh. And a skipped tween frame in one window restored the
rate while another window still held a button. Build-only frames no
longer pace, and the rate comes back only when no window drags or
flings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 13:38:43 +01:00
Roman ChojnackiandClaude Opus 5.5 6066f21306 Timing that names the rasterizing, and skipped frames that stay clean and paced
SDL only queues draw calls, so a software frame's rasterizing was booked
as present. The runtime now flushes before the present timer, and the
docs and Diagnostics say what each number holds.

A skipped frame never reached nk_clear, so the next build's popups and
overlay never joined the list and combos stopped answering; it clears
now. Skipped frames also had no present to wait on, so a tween that
changed no pixel spun a core at about 390,000 frames a second. They now
follow the display's refresh, as a held mouse button does.

A software frame that opens by filling the whole window drops the clear
under it. A theme change forces the next frame to draw.

tests/skiptest.c covers both skip faults and runs in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:21:55 +01:00
admin 5f8fceaf52 Merge pull request #111 from Alpaq92/fix-rpm-artifact-layout
Release: the .rpm artifact holds its files at the top
2026-11-05 15:03:15 +01:00
Roman ChojnackiandClaude Fable 5.1 154ffdcc80 Release: the .rpm artifact holds its files at the top
The rpm job uploaded dist-pkg/*.rpm and dist-pkg-shared/*.rpm as two
paths, so upload-artifact kept both folders and the publish step found
two directories among the downloads: sha256sum refused them and 0.9.0
never published. The shared packages now move into dist-pkg before the
upload, which is one path and lands flat like the .deb artifacts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-04 19:45:17 +01:00
19 changed files with 258 additions and 91 deletions
+4 -3
View File
@@ -417,14 +417,15 @@ jobs:
cmake --build build-pkg-shared </dev/null
rpm -e libreaktor-shared
build-pkg-shared/simple --theme light --video dummy --shot check-shared.bmp </dev/null
mv dist-pkg-shared/*.rpm dist-pkg/
EOF
# One folder: two paths would keep dist-pkg/ and dist-pkg-shared/ in the
# artifact, and the release expects every package at the top.
- name: Upload the .rpm
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: package-rpm-linux-${{ matrix.arch }}
path: |
dist-pkg/*.rpm
dist-pkg-shared/*.rpm
path: dist-pkg/*.rpm
if-no-files-found: error
retention-days: 14
+6 -4
View File
@@ -156,10 +156,12 @@ jobs:
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
New-Item -ItemType Directory -Force smoke | Out-Null
$p = Start-Process "./${{ matrix.out }}/uitest.exe" -ArgumentList '--log', 'smoke/uitest.log' -PassThru
if (-not $p.WaitForExit(120000)) { $p.Kill(); throw "uitest did not finish" }
Select-String -Path smoke/uitest.log -Pattern 'test:' | ForEach-Object { $_.Line }
if ($p.ExitCode -ne 0) { throw "uitest exited with $($p.ExitCode)" }
foreach ($name in 'uitest', 'skiptest') {
$p = Start-Process "./${{ matrix.out }}/$name.exe" -ArgumentList '--log', "smoke/$name.log" -PassThru
if (-not $p.WaitForExit(120000)) { $p.Kill(); throw "$name did not finish" }
Select-String -Path "smoke/$name.log" -Pattern 'test:' | ForEach-Object { $_.Line }
if ($p.ExitCode -ne 0) { throw "$name exited with $($p.ExitCode)" }
}
- name: Package
id: package
+6 -2
View File
@@ -57,8 +57,12 @@ on every run.
renderer, so `reaktor_render` swaps each rounded fill for
`reaktor_fill_round`, relinking the command list (it ends where a `next`
reaches `ctx->memory.allocated`).
- **Measure the present, not the draw.** Without a GPU most of a frame is
`SDL_RenderPresent`; the Diagnostics page and `bench --no-vsync` split it.
- **SDL draws when it flushes, not when it is asked.** Its calls only queue, so
without a GPU most of a frame is the flush the runtime makes before timing
the present; the Diagnostics page and `bench --no-vsync` split them. Vsync
sits in the present, so a total that matches the refresh rate measures it.
- **`--shot` never skips a frame.** It and a capture force the draw, so a pixel
diff cannot see what `.skip_same_frames` breaks; `tests/skiptest.c` can.
- **Text the atlas lacks is not Nuklear's.** Strings with Japanese, Arabic and
the like are measured and drawn by `core/text/text.c` through a custom
command. mojibake 0.5.0 records `byte_offset` at a character's last byte.
+2 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(reaktor VERSION 0.9.0 LANGUAGES C CXX)
project(reaktor VERSION 0.10.0 LANGUAGES C CXX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(_reaktor_top ON)
@@ -859,6 +859,7 @@ if(NOT EMSCRIPTEN)
reaktor_add_app(bench MODULES none SOURCES samples/bench/bench.c)
reaktor_add_app(launchtest STATIC MODULES settings popups print SOURCES tests/launchtest.c)
reaktor_add_app(uitest MODULES none SOURCES tests/uitest.c)
reaktor_add_app(skiptest MODULES none SOURCES tests/skiptest.c)
set_target_properties(launchtest PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
+1 -1
View File
@@ -23,7 +23,7 @@ yourself.
> ⚠️ **Reaktor is in active development**, and breaking changes might occur.
<p align="center">
<a href="docs/PERFORMANCE.md"><img src="docs/benchmark.svg" alt="Two bar charts of drawing 64 rotating boxes at 60 fps in an 800x600 window. Memory: Reaktor 9.1 MB, the same binary on D3D12 120.8 MB and on OpenGL 69.0 MB, Flutter 132.7 MB, Electron 156.3 MB, Kotlin Multiplatform 668.7 MB. Steady-state CPU as a percent of one core: Reaktor 7.1%, D3D12 4.1%, OpenGL 6.4%, Flutter 15.3%, Electron 19.6%, Kotlin Multiplatform 29.4%"></a>
<a href="docs/PERFORMANCE.md"><img src="docs/benchmark.svg" alt="Two bar charts of drawing 64 rotating boxes at 60 fps in an 800x600 window. Memory: Reaktor 8.9 MB, the same program on D3D12 120.5 MB and on OpenGL 69.2 MB, Flutter 132.7 MB, Electron 156.3 MB, Kotlin Multiplatform 668.7 MB. Steady-state CPU as a percent of one core: Reaktor 6.3%, D3D12 4.1%, OpenGL 5.5%, Flutter 15.3%, Electron 19.6%, Kotlin Multiplatform 29.4%"></a>
</p>
How, and on what, is in [PERFORMANCE.md](docs/PERFORMANCE.md).
+2 -1
View File
@@ -35,7 +35,8 @@ the GPU, so those three are the like-for-like comparison. SDL's OpenGL driver
is built only when `REAKTOR_RENDERERS` names it, which the `reaktor-opengl`
arm's build does. An arm whose renderer would not start is skipped, not measured
under another renderer's name. The chart dates its arms: Reaktor's three are
re-measured for a release, the others last on 2026-10-24.
re-measured when the runtime changes in a way that could move them, the
others last on 2026-10-24.
## What every arm draws
+1
View File
@@ -427,6 +427,7 @@ void reaktor_windows_take(App *app, const SDL_Event *event);
int reaktor_windows_retitle(App *app, const char *title);
void reaktor_windows_draw(void);
void reaktor_windows_restyle(void);
int reaktor_windows_holding(void);
void reaktor_windows_dirty(void);
void reaktor_windows_rescale(void);
void reaktor_windows_close_all(void);
+39 -3
View File
@@ -419,6 +419,40 @@ mask_rounded_fills(App *app)
ctx->memory.allocated;
}
/* A software frame that opens by filling the whole window has no use for the
clear. A GPU keeps it, as SDL asks; so does a feathered fill, whose edge
blends with what is under it. */
static int
first_fill_covers(App *app)
{
struct nk_context *ctx = app->ctx;
const struct nk_command *c;
float sx = 1.0f, sy = 1.0f;
int ow = 0, oh = 0, clipped = 0;
if (!SDL_GetCurrentRenderOutputSize(app->ren, &ow, &oh) ||
!SDL_GetRenderScale(app->ren, &sx, &sy))
return 0;
nk_foreach(c, ctx) {
if (c->type == NK_COMMAND_SCISSOR) {
const struct nk_command_scissor *s =
(const struct nk_command_scissor *)c;
clipped = s->x > 0 || s->y > 0 || (s->x + s->w) * sx < (float)ow ||
(s->y + s->h) * sy < (float)oh;
} else if (c->type != NK_COMMAND_NOP) {
const struct nk_command_rect_filled *f =
(const struct nk_command_rect_filled *)c;
return !clipped && c->type == NK_COMMAND_RECT_FILLED &&
!f->rounding && f->color.a == 255 && f->x <= 0 && f->y <= 0 &&
(f->x + f->w) * sx >= (float)ow &&
(f->y + f->h) * sy >= (float)oh;
}
}
return 0;
}
int
reaktor_aa_lines(const App *app)
{
@@ -436,9 +470,11 @@ reaktor_aa_fills(const App *app)
void
reaktor_render(App *app)
{
SDL_SetRenderDrawColor(app->ren, app->clear.r, app->clear.g, app->clear.b,
app->clear.a);
SDL_RenderClear(app->ren);
if (!app->renderer_is_sw || reaktor_aa_fills(app) || !first_fill_covers(app)) {
SDL_SetRenderDrawColor(app->ren, app->clear.r, app->clear.g, app->clear.b,
app->clear.a);
SDL_RenderClear(app->ren);
}
mask_rounded_fills(app);
nk_sdl_render_ex(app->ctx,
reaktor_aa_fills(app) ? NK_ANTI_ALIASING_ON : NK_ANTI_ALIASING_OFF,
+9 -9
View File
@@ -76,15 +76,15 @@ seconds flat out, on the Windows machine that
```
size 800x600
frames 4290
fps 715.0
ms_build 0.03
ms_render 0.07
ms_present 1.27
ms_per_frame 1.37
cpu_at_60fps 8.2
cpu_percent 97.4
private_mb 7.1
frames 8095
fps 1349.2
ms_build 0.00
ms_render 0.43
ms_present 0.28
ms_per_frame 0.72
cpu_at_60fps 4.3
cpu_percent 97.1
private_mb 6.0
```
With `--no-vsync`, read `cpu_at_60fps`, not `cpu_percent`. On vsync,
+9 -8
View File
@@ -73,7 +73,7 @@ errors, so an internal function cannot slip back in.
| `reaktor_lang_pref(app)` | The language `--lang` asked for, or `NULL` |
| `reaktor_set_borderless(app, on)`, `reaktor_borderless(app)` | Switch the main window's frame off for a titlebar of your own, drawn with `.window.hit_test` |
| `reaktor_set_visible(app, on)` | Show or hide that App's window; with `.window.hidden`, the main window waits for it |
| `reaktor_version()` | Reaktor's version, such as `"0.9.0"` |
| `reaktor_version()` | Reaktor's version, such as `"0.10.0"` |
The `set` calls are for the main thread, take effect at the next frame, and do
nothing when nothing changes.
@@ -1001,7 +1001,8 @@ commands are hashed field by field, and one that matches the last presented
frame is neither rendered nor presented. A key nothing takes, or a focus
change that moves no ring, then costs the build and nothing more. A window
uncovered, shown, resized, restored or moved to another scale is always drawn,
and so is a frame a `--shot` or a capture waits for. It is off by default; the
and so is a frame a `--shot` or a capture waits for. A tween that changes
nothing on screen follows the display's refresh. It is off by default; the
showcase turns it on, and its Diagnostics page counts the frames drawn and
skipped.
@@ -1106,7 +1107,7 @@ mojibake, kb_text_shape and toml-c, merged with `lib.exe`, Apple's `libtool` or
and SDL's, a CMake package, a pkg-config file and `share/reaktor/licenses`:
```cmake
find_package(reaktor 0.9 REQUIRED)
find_package(reaktor 0.10 REQUIRED)
add_executable(app WIN32 main.c)
target_link_libraries(app PRIVATE reaktor::reaktor)
```
@@ -1356,7 +1357,7 @@ command line names one, and `--new-instance` is passed for it.
- **It needs no GPU.** Without one, Direct3D falls back to Microsoft's WARP
emulation: drawing `bench` flat out, SDL's software renderer took 0.75 ms
of CPU a frame where Direct3D on WARP took 1.78.
- **It uses the least memory**, 9.1 MB in `bench` against 57–121 MB on a GPU
- **It uses the least memory**, 8.9 MB in `bench` against 58–121 MB on a GPU
renderer, most of that the graphics driver's.
- **It starts fastest, and its cost does not depend on other programs** using
the GPU.
@@ -1392,10 +1393,10 @@ the system's HDR on or off takes effect at the next launch. On an SDR display a
GPU renderer other than `sdl-gpu` keeps the linear output, which blends in
linear light: edges and text come out slightly different from an SDR renderer.
**Prefer `directx` or `direct3d12` to `direct3d11`.** Once running,
`direct3d11` took 13.4% of a core where `direct3d12` and `opengl` took 5.6%,
and turning vsync off did not change it: the cost is in SDL's Direct3D 11
renderer or the driver, not in Reaktor's frame. Pick it only where Direct3D 12
**Prefer `directx` or `direct3d12` to `direct3d11`.** Once running, on
2026-10-24, `direct3d11` took 13.4% of a core where `direct3d12` and `opengl`
took 5.6%, and turning vsync off did not change it: the cost is in SDL's
Direct3D 11 renderer or the driver, not in Reaktor's frame. Pick it only where Direct3D 12
will not start; `directx` does that by itself.
A GPU renderer smooths the edges of fills unless `.anti_aliasing` says
+5 -4
View File
@@ -207,7 +207,7 @@ the module drew. CMake keeps the option until you pass `=ON`. See
### How do I install libreaktor and link against it?
Take the release's archive or the `.deb` or `.rpm`, or run
`sh tools/libreaktor-pkg.sh -i`. Then `find_package(reaktor 0.9 REQUIRED)`
`sh tools/libreaktor-pkg.sh -i`. Then `find_package(reaktor 0.10 REQUIRED)`
and link `reaktor::reaktor`, or use `pkg-config --cflags --libs reaktor`. To
build it into your tree instead, `add_subdirectory` the checkout and call
`reaktor_add_app`. See [In your own project](DOCUMENTATION.md#in-your-own-project).
@@ -250,9 +250,10 @@ to thirteen times the memory. See
### Why is the frame time high on a machine with no GPU?
Most of it is usually `SDL_RenderPresent`, copying the frame to the screen,
not drawing it. The Diagnostics page and `bench --no-vsync` split build,
render and present. See [The renderer](DOCUMENTATION.md#the-renderer).
Most of it is usually rasterizing: SDL queues what it is asked to draw and fills the
pixels when that queue is flushed. The rest is mostly copying the frame to the
window. The Diagnostics page and `bench --no-vsync` split build, render and
present. See [The renderer](DOCUMENTATION.md#the-renderer).
### Why does Japanese or Arabic text draw differently from Latin?
+38 -28
View File
@@ -23,10 +23,10 @@ the one all four programs share.
## Against the others
![Two bar charts of drawing 64 rotating boxes at 60 fps in an 800x600 window.
Memory: Reaktor 9.1 MB, the same binary on D3D12 120.8 MB and on OpenGL
69.0 MB, Flutter 132.7 MB, Electron 156.3 MB, Kotlin
Memory: Reaktor 8.9 MB, the same program on D3D12 120.5 MB and on OpenGL
69.2 MB, Flutter 132.7 MB, Electron 156.3 MB, Kotlin
Multiplatform 668.7 MB. Steady-state CPU as a percent of one core: Reaktor
7.1%, D3D12 4.1%, OpenGL 6.4%, Flutter 15.3%, Electron 19.6%,
6.3%, D3D12 4.1%, OpenGL 5.5%, Flutter 15.3%, Electron 19.6%,
Kotlin Multiplatform 29.4%](benchmark.svg)
The workload is [ShaftUI/Shaft](https://github.com/ShaftUI/Shaft)'s: 64 boxes
@@ -36,15 +36,15 @@ Lenovo laptop with a 6-core Ryzen 5 4600H, a GeForce RTX 2060 and a 1920×1080
framework's toolchain; one script launches it and samples its whole process
tree from outside. [`benchmarks/`](../benchmarks/BENCHMARKS.md) has the
projects and the runner. Reaktor appears once per `--renderer`; its arms are
0.9.0, measured on 2026-11-04, the others from the pass of 2026-10-24. Shaft
0.10.0, measured on 2026-11-07, the others from the pass of 2026-10-24. Shaft
is not plotted: it does not link on Windows.
| Arm | Memory | CPU, with startup | CPU, steady state |
| --- | --- | --- | --- |
| **Reaktor**, `software` | 9.1 MB | 8.1% | 7.1% |
| **Reaktor**, `direct3d11` | 57.3 MB | 13.3% | 11.4% |
| **Reaktor**, `direct3d12` | 120.8 MB | 8.5% | 4.1% |
| **Reaktor**, `opengl` | 69.0 MB | 10.2% | 6.4% |
| **Reaktor**, `software` | 8.9 MB | 7.9% | 6.3% |
| **Reaktor**, `direct3d11` | 57.7 MB | 13.5% | 9.1% |
| **Reaktor**, `direct3d12` | 120.5 MB | 11.1% | 4.1% |
| **Reaktor**, `opengl` | 69.2 MB | 11.2% | 5.5% |
| Flutter | 132.7 MB | 38.8% | 15.3% |
| Electron | 156.3 MB | 36.5% | 19.6% |
| Kotlin Multiplatform | 668.7 MB | 51.5% | 29.4% |
@@ -53,16 +53,17 @@ is not plotted: it does not link on Windows.
startup or without, and about a seventy-fifth of Kotlin Multiplatform's
memory.
- **Every Reaktor renderer takes less CPU than every other framework.** On a
GPU renderer its memory is mostly the graphics driver's: 57–121 MB, below
GPU renderer its memory is mostly the graphics driver's: 58–121 MB, below
Flutter's 133.
- **Startup counts.** A run that draws for only 0.2 s takes 0.16 s of CPU on
`software` and 0.41–0.47 s on a GPU renderer (medians of five runs). Once running, `direct3d12`
takes three points less than `software`, `opengl` under one.
- **About 2.2 MB of Reaktor's 9.1 is the antivirus.** Bitdefender puts two
`software` and 0.41–0.47 s on a GPU renderer (medians of five runs, on
2026-10-24). Once running, `direct3d12` takes two points less than
`software`, `opengl` under one.
- **About 2.2 MB of Reaktor's 8.9 is the antivirus.** Bitdefender puts two
components into every process on this machine, so every arm carries them.
Walked with VirtualQueryEx and a heap ledger on `bench`, they come to two
private heaps of 776 KB each (one the hook module's, one holding a 642 KB
table of the other's), 74 code pages patched with hooks (303 KB) and 56
Walked with VirtualQueryEx and a heap ledger on `bench` on 2026-11-04, they
come to two private heaps of 776 KB each (one the hook module's, one holding
a 642 KB table of the other's), 74 code pages patched with hooks (303 KB) and 56
more copied unchanged (229 KB), 53 KB of trampolines and about 180 KB of
pages beside. Subtract that to compare with a machine without it. The rest
of the 9.3 MB walked is 1.9 MB of window framebuffer, 1.75 MB of system DLL
@@ -87,17 +88,21 @@ from 11.48 ms to 2.12 ms, with the same pixels.
CPU is a percent of one core: with startup over the whole 6-second run, steady
from 3 s to 8 s of a 9-second run. Every arm is held to 60 fps and sleeps out
the rest of each frame; Kotlin Multiplatform held 59. Each figure is the
median of ten runs, the steady-state ones taken in turn across arms; passes
differ by up to three points of CPU. Memory is peak private bytes, and CPU the
median of ten runs, the steady-state ones taken in turn across arms, and
Reaktor's the mean of two such medians; passes differ by up to three points of
CPU. Memory is peak private bytes, and CPU the
sum, across each app's process tree. `-PinClock` runs on a copy of the power
plan that holds the processor at full speed, and restores the plan after.
Every row was measured on 2026-10-24 with the GPU idle, the other frameworks in
one pass and Reaktor's again later that day: Flutter
The other frameworks were measured in one pass on 2026-10-24 and Reaktor's rows
on 2026-11-07, all with the GPU idle: Flutter
3.47.8, Electron 44.3.0, and Kotlin 2.4.20 with Compose 1.12.0 on JDK 21. The
Flutter arm took 91 MB and 19% of a core with startup on the Flutter release
used before; 3.47.8 takes more of both. The sampler counts what an app's own timers miss: `bench` times
0.07 ms of work per `direct3d11` frame, where the sampler charged over 10%.
`vulkan` falls back to `direct3d11` in this SDL build.
0.07 ms of work per `direct3d11` frame on 2026-10-22, where the sampler charges
9% once running.
`vulkan` falls back to `direct3d11` in this SDL build. Run the script from
PowerShell: started through Git Bash, the same `bench` reads 5.9–6.2 MB of
private bytes against 8.2–8.7 MB, three runs each.
## Size
@@ -303,22 +308,27 @@ Redrawing continuously at 960×680, p10–p90 of 31 samples:
| Buttons (the busiest) | 11.5–12.2 ms/frame | 11.7–13.0 ms/frame | 29.6–30.2 ms/frame | 13.4–15.3 ms/frame |
The same rasterizer runs on all four. macOS also uploads the bitmap to a
Metal texture to present it. On GhostBSD most of a frame is the present, a
software blit into VMware's framebuffer: 6.7 ms of Login's 7.1 ms, 11.1 ms of
Buttons' 14.8.
Metal texture to present it. On GhostBSD the timers put 6.7 ms of Login's
7.1 ms and 11.1 ms of Buttons' 14.8 in the present, but those timers counted
SDL's rasterizing as present too, so that is the raster and the blit into
VMware's framebuffer together.
The Windows build of 2026-10-24, at its default 1100×680, redrawing
continuously with vsync off, build, render and present, p10–p90 of 31 frames after 9 to warm up,
over three launches: Login takes **1.3–1.8 ms** a frame and Buttons
**2.7–3.4 ms**; `direct3d11` takes 0.4–0.8 ms and 0.8–1.3 ms. In software the
present is most of it: 1.08 ms of Login's frame.
**2.7–3.4 ms**; `direct3d11` takes 0.4–0.8 ms and 0.8–1.3 ms. Rasterizing is
most of a software frame. SDL does it when its queue is flushed, which then
happened inside the present; flushing first, on 0.9.0 over three launches, it
takes 1.07–1.23 ms of Login's 1.34–1.55 ms and 1.60–1.73 ms of Buttons'
2.45–2.68 ms, and the copy to the window 14–22 µs and 18–65 µs.
Without a GPU, `direct3d11` falls back to WARP, which rasterizes on threads of
its own: drawing `bench` flat out, the process spends **1.78 ms** of CPU a
frame on WARP against 0.75 ms on `software` (medians of five runs), which
made software the default.
The accessibility tree adds **3.3 µs** to a drawn frame (82 nodes). With a
GPU, `direct3d12` and `opengl` take less CPU; see **Against the others**.
The accessibility tree adds **3.3 µs** to a drawn frame (82 nodes). Once
running, `direct3d12` and `opengl` take less CPU, though more with startup; see
**Against the others**.
## What it needs to run
+11 -11
View File
@@ -3,14 +3,14 @@
<rect x="30" y="30" width="715" height="500" rx="14" fill="#353535"/>
<text x="70" y="90" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="31" font-weight="600" fill="#ffffff">Memory</text>
<text x="70" y="116" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="14" fill="#8e8e8e">private bytes, peak, whole process tree</text>
<rect x="99.5" y="448.761" width="46" height="3.23882" fill="#56c7ff"/>
<text x="122.5" y="418.761" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">9.1 MB</text>
<rect x="99.5" y="448.832" width="46" height="3.16764" fill="#56c7ff"/>
<text x="122.5" y="418.832" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">8.9 MB</text>
<text x="122.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">Software</text>
<path d="M205.5 452 v-36.9945 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v36.9945 z" fill="#56c7ff"/>
<text x="228.5" y="379.006" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">120.8 MB</text>
<path d="M205.5 452 v-36.8877 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v36.8877 z" fill="#56c7ff"/>
<text x="228.5" y="379.112" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">120.5 MB</text>
<text x="228.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">D3D12</text>
<path d="M311.5 452 v-18.5581 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v18.5581 z" fill="#56c7ff"/>
<text x="334.5" y="397.442" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">69.0 MB</text>
<path d="M311.5 452 v-18.6293 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v18.6293 z" fill="#56c7ff"/>
<text x="334.5" y="397.371" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">69.2 MB</text>
<text x="334.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">OpenGL</text>
<path d="M417.5 452 v-41.2298 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v41.2298 z" fill="#6e7a82"/>
<text x="440.5" y="374.77" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">132.7 MB</text>
@@ -25,14 +25,14 @@
<rect x="755" y="30" width="715" height="500" rx="14" fill="#353535"/>
<text x="795" y="90" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="31" font-weight="600" fill="#ffffff">CPU at 60 fps</text>
<text x="795" y="116" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="14" fill="#8e8e8e">percent of one core, steady state (3 s to 8 s)</text>
<path d="M824.5 452 v-51.4762 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v51.4762 z" fill="#56c7ff"/>
<text x="847.5" y="364.524" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">7.1%</text>
<path d="M824.5 452 v-45 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v45 z" fill="#56c7ff"/>
<text x="847.5" y="371" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">6.3%</text>
<text x="847.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">Software</text>
<path d="M930.5 452 v-27.1905 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v27.1905 z" fill="#56c7ff"/>
<text x="953.5" y="388.81" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">4.1%</text>
<text x="953.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">D3D12</text>
<path d="M1036.5 452 v-45.8095 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v45.8095 z" fill="#56c7ff"/>
<text x="1059.5" y="370.19" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">6.4%</text>
<path d="M1036.5 452 v-38.5238 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v38.5238 z" fill="#56c7ff"/>
<text x="1059.5" y="377.476" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">5.5%</text>
<text x="1059.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="600" fill="#ffffff">OpenGL</text>
<path d="M1142.5 452 v-117.857 a6 6 0 0 1 6 -6 h34 a6 6 0 0 1 6 6 v117.857 z" fill="#6e7a82"/>
<text x="1165.5" y="298.143" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="18" font-weight="600" fill="#ffffff">15.3%</text>
@@ -45,5 +45,5 @@
<text x="1377.5" y="478" text-anchor="middle" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" font-weight="400" fill="#b9b9b9">KMP</text>
<line x1="785" y1="452.5" x2="1440" y2="452.5" stroke="#4a4a4a" stroke-width="1"/>
<text x="40" y="562" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="15" fill="#b9b9b9">Drawing 64 rotating boxes at 60 fps in an 800×600 window. Lower is better in both panels.</text>
<text x="40" y="586" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="13" fill="#8e8e8e">Three Reaktor renderers (0.9.0, measured 2026-11-04) against the alternatives from other tech stacks (2026-10-24), on the same machine — details in benchmarks/BENCHMARKS.md.</text>
<text x="40" y="586" font-family="Segoe UI, -apple-system, Helvetica Neue, Arial, sans-serif" font-size="13" fill="#8e8e8e">Three Reaktor renderers (measured 2026-11-07) against the alternatives from other tech stacks (2026-10-24), on the same machine — details in benchmarks/BENCHMARKS.md.</text>
</svg>

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

+1 -1
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(consumer C)
find_package(reaktor 0.9 REQUIRED)
find_package(reaktor 0.10 REQUIRED)
add_executable(simple WIN32 ../../samples/simple/simple.c)
option(CONSUMER_SHARED "Link libreaktor.so instead of libreaktor.a" OFF)
+16 -3
View File
@@ -568,8 +568,9 @@ load_theme(App *app)
img_cache_clear(app);
apply_widget_style(app);
app->clear = app->page;
app->dirty = 1;
app->clear = app->page;
app->dirty = 1;
app->must_draw = 1;
reaktor_windows_restyle();
}
@@ -1574,6 +1575,7 @@ reaktor_app_frame(App *app, int win_w, int win_h, const char *title,
struct nk_rect area = nk_rect(0, 0, (float)win_w, (float)win_h);
int is_main = !app->secondary, shot = 0, shown;
Uint64 now = SDL_GetTicks(), t_build0, t_render0, t_present0, t_end;
int busy;
app->laid_w = win_w;
app->laid_h = win_h;
@@ -1668,7 +1670,8 @@ reaktor_app_frame(App *app, int win_w, int win_h, const char *title,
reader_activate, reader_focus, app);
}
if (app->anim && reaktor_anim_settle()) {
busy = app->anim && reaktor_anim_settle();
if (busy) {
app->dirty = 1;
reaktor_app_wake(app);
}
@@ -1686,12 +1689,22 @@ reaktor_app_frame(App *app, int win_w, int win_h, const char *title,
t_render0 = SDL_GetPerformanceCounter();
if (app->build_only || same_frame(app, ctx)) {
/* A drawn frame clears in nk_sdl_render_ex; kept, the next build's
popups and overlay never join the list. */
nk_clear(ctx);
t_present0 = t_end = t_render0;
app->frames_skipped++;
/* No present to wait on, so a tween that changes nothing would spin. */
if (busy && !app->build_only) {
reaktor_hint(SDL_HINT_MAIN_CALLBACK_RATE, app->drag_rate);
if (!reaktor_windows_holding()) app->restore_rate = 2;
}
} else {
app->frames_drawn++;
if (is_main) reaktor_text_prepare(ctx, app->ren);
reaktor_render(app);
/* SDL rasterizes its queue here, or inside the present. */
SDL_FlushRenderer(app->ren);
t_present0 = SDL_GetPerformanceCounter();
if (is_main) shot = take_shot(app);
if (app->want_capture) {
+19 -1
View File
@@ -371,10 +371,28 @@ reaktor_windows_restyle(void)
img_cache_clear(a);
apply_widget_style(a);
reaktor_window_set_dark(a->win, a->dark);
a->dirty = 1;
a->dirty = 1;
a->must_draw = 1;
}
}
/* The callback rate is the process's: a held button or a fling in any window
keeps it. */
int
reaktor_windows_holding(void)
{
App *m = reaktor_main_app();
int i;
if (m && (m->dragging || m->fling_v != 0.0f)) return 1;
for (i = 0; i < g_win_n; i++) {
const App *a = g_win[i].app;
if (!g_win[i].closing && (a->dragging || a->fling_v != 0.0f)) return 1;
}
return 0;
}
void
reaktor_windows_dirty(void)
{
+3 -3
View File
@@ -139,9 +139,9 @@ page_diagnostics(App *app, struct reaktor_context *ctx, showcase_state *st)
section(app, ctx, "Where a frame goes",
"Split three ways because guessing which one dominates has been "
"wrong more than once. Building the UI and converting it to "
"geometry are both fractions of a millisecond; the wait on "
"present is the whole frame.");
"wrong more than once. Render holds the rasterizing on the "
"software renderer; present is the copy to the window, or the "
"wait for the display.");
SDL_snprintf(v, sizeof(v), "%.2f ms", (double)d.build_ms);
DIAG_ROWS(ctx) {
+71
View File
@@ -0,0 +1,71 @@
#include "reaktor/reaktor.h"
#include "reaktor/main.h"
static int g_frames, g_stale;
static size_t g_most;
static SDL_AtomicInt g_play;
static void
page(App *app, struct reaktor_context *ctx, int win_w, int win_h)
{
struct reaktor_anim_context *a = reaktor_anim(app);
reaktor_hash clip = reaktor_anim_id("hold"), channel = reaktor_anim_id("value");
(void)win_h;
g_frames++;
if (ctx->build) g_stale++;
if (ctx->memory.allocated > g_most) g_most = ctx->memory.allocated;
if (!reaktor_anim_clip_exists(a, clip)) {
reaktor_anim_clip_begin(a, clip);
reaktor_anim_clip_key_float(a, channel, 0.0f, 0.0f, REAKTOR_ANIM_EASE_LINEAR, NULL);
reaktor_anim_clip_key_float(a, channel, 0.1f, 1.0f, REAKTOR_ANIM_EASE_LINEAR, NULL);
reaktor_anim_clip_end(a);
}
if (SDL_SetAtomicInt(&g_play, 0))
reaktor_anim_play_with_delay(a, clip, reaktor_anim_id("tile"), 1.0f);
REAKTOR_COLUMN(.w = (float)win_w, .gap = 8.0f) {
REAKTOR_COMBO(.label = "Fruit", .name = "Fruit", .body_h = 120.0f,
.box = { .w = 240.0f }) {
reaktor_combo_item("Apple", 0);
}
}
}
static void
script(reaktor_test *t, void *user)
{
reaktor_diag d;
size_t most;
int i, frames;
Uint64 t0;
(void)user;
reaktor_test_click(t, "Fruit");
reaktor_test_settle(t);
most = g_most;
for (i = 0; i < 40; i++) reaktor_test_key(t, "F9");
reaktor_test_settle(t);
reaktor_diagnostics(reaktor_test_app_of(t), &d);
reaktor_test_check(t, d.frames_skipped > 0, "a frame that repeats the last is skipped");
reaktor_test_check(t, g_stale == 0, "every frame starts from a cleared context");
reaktor_test_check(t, g_most == most, "skipped frames leave no commands behind");
/* A tween that changes no pixel skips every frame, with no present to pace them. */
frames = g_frames;
t0 = SDL_GetTicks();
SDL_SetAtomicInt(&g_play, 1);
reaktor_test_key(t, "F9");
SDL_Delay(500);
reaktor_test_check(t, g_frames - frames < (int)(SDL_GetTicks() - t0), "a busy tween stays paced");
}
int
main(int argc, char **argv)
{
return reaktor_test_app(argc, argv, &(reaktor_launch){
.name = "Skiptest",
.window = { .w = 400, .h = 300 },
.console = REAKTOR_CONSOLE_PARENT,
.skip_same_frames = 1,
.page = page }, script, NULL);
}
+15 -8
View File
@@ -1,6 +1,7 @@
#!/bin/sh
# The scripted UI test: tests/uitest.c drives its own window through the
# accessibility tree and SDL's events, and exits 0 when every check passed.
# The scripted UI tests: tests/uitest.c and tests/skiptest.c drive their own
# windows through the accessibility tree and SDL's events, and exit 0 when
# every check passed.
# uitest.sh [-w WRAP] BUILD
set -u
@@ -15,9 +16,15 @@ shift $((OPTIND - 1))
build=$1
mkdir -p smoke
rm -f smoke/uitest.log
$wrap "$build/uitest" --log smoke/uitest.log </dev/null >/dev/null 2>&1
rc=$?
grep "test:" smoke/uitest.log 2>/dev/null || cat smoke/uitest.log 2>/dev/null || :
[ "$rc" = 0 ] || echo "uitest: exit status $rc"
exit "$rc"
status=0
for name in uitest skiptest; do
rm -f "smoke/$name.log"
$wrap "$build/$name" --log "smoke/$name.log" </dev/null >/dev/null 2>&1
rc=$?
grep "test:" "smoke/$name.log" 2>/dev/null || cat "smoke/$name.log" 2>/dev/null || :
if [ "$rc" != 0 ]; then
echo "$name: exit status $rc"
status=$rc
fi
done
exit "$status"