feat(benchmarks): add exporter benchmarks and compare them in CI #35

Merged
Superkooka merged 5 commits from benchmark into main 2026-10-09 06:07:40 +00:00
Owner
No description provided.
feat(benchmarks): add exporter benchmarks and compare them in CI
All checks were successful
/ docs (push) Successful in 5s
/ format (push) Successful in 1m24s
/ test (push) Successful in 1m30s
Benchmarks / compare (pull_request) Successful in 5m15s
0a1382dcf0

Benchmarks

Base 807ef2ab against head 3d9dc970, one after the other on the same runner.
Times are per operation. A change within the error margins of both runs is marked as noise.
A shared runner is noisy: trust the allocations more than the times, and confirm a time on an idle machine.

Benchmark Parameters Base Head Change Base allocated Head allocated
LandscapeRasterizerBenchmarks.Draw Kernel=bicubic - 30.57 ns new - 1 B
LandscapeRasterizerBenchmarks.Draw Kernel=bilinear - 27.49 ns new - 1 B
ObjectRasterizerBenchmarks.Draw - 26.32 ns new - 0 B
ObjectTextureBenchmarks.Sample Kernel=bicubic - 97.5 ns new - 0 B
ObjectTextureBenchmarks.Sample Kernel=bilinear - 47.93 ns new - 0 B
PngEncoderBenchmarks.Encode - 94.58 ns new - 8 B
All benchmarks (6)
Benchmark Parameters Base Head Change Base allocated Head allocated
LandscapeRasterizerBenchmarks.Draw Kernel=bicubic - 30.57 ns new - 1 B
LandscapeRasterizerBenchmarks.Draw Kernel=bilinear - 27.49 ns new - 1 B
ObjectRasterizerBenchmarks.Draw - 26.32 ns new - 0 B
ObjectTextureBenchmarks.Sample Kernel=bicubic - 97.5 ns new - 0 B
ObjectTextureBenchmarks.Sample Kernel=bilinear - 47.93 ns new - 0 B
PngEncoderBenchmarks.Encode - 94.58 ns new - 8 B
<!-- benchmark-report --> ### Benchmarks Base `807ef2ab` against head `3d9dc970`, one after the other on the same runner. Times are per operation. A change within the error margins of both runs is marked as noise. A shared runner is noisy: trust the allocations more than the times, and confirm a time on an idle machine. | Benchmark | Parameters | Base | Head | Change | Base allocated | Head allocated | |---|---|---|---|---|---|---| | `LandscapeRasterizerBenchmarks.Draw` | Kernel=bicubic | - | 30.57 ns | new | - | 1 B | | `LandscapeRasterizerBenchmarks.Draw` | Kernel=bilinear | - | 27.49 ns | new | - | 1 B | | `ObjectRasterizerBenchmarks.Draw` | | - | 26.32 ns | new | - | 0 B | | `ObjectTextureBenchmarks.Sample` | Kernel=bicubic | - | 97.5 ns | new | - | 0 B | | `ObjectTextureBenchmarks.Sample` | Kernel=bilinear | - | 47.93 ns | new | - | 0 B | | `PngEncoderBenchmarks.Encode` | | - | 94.58 ns | new | - | 8 B | <details> <summary>All benchmarks (6)</summary> | Benchmark | Parameters | Base | Head | Change | Base allocated | Head allocated | |---|---|---|---|---|---|---| | `LandscapeRasterizerBenchmarks.Draw` | Kernel=bicubic | - | 30.57 ns | new | - | 1 B | | `LandscapeRasterizerBenchmarks.Draw` | Kernel=bilinear | - | 27.49 ns | new | - | 1 B | | `ObjectRasterizerBenchmarks.Draw` | | - | 26.32 ns | new | - | 0 B | | `ObjectTextureBenchmarks.Sample` | Kernel=bicubic | - | 97.5 ns | new | - | 0 B | | `ObjectTextureBenchmarks.Sample` | Kernel=bilinear | - | 47.93 ns | new | - | 0 B | | `PngEncoderBenchmarks.Encode` | | - | 94.58 ns | new | - | 8 B | </details>
perf(exporter): no struct copies in the per-pixel sampling paths
All checks were successful
/ docs (push) Successful in 3s
/ format (push) Successful in 1m20s
/ test (push) Successful in 1m24s
Benchmarks / compare (pull_request) Successful in 4m58s
f5d67ea9e2
Small spans and struct copies on the per-pixel paths were zeroed or copied
on every pixel and texture. Replace the stackalloc'd channel buffers with
locals and tuples, reuse one buffer per thread for the texture weights,
read LandscapeSwatch.Axis taps by reference, and wrap texel coordinates an
int holds without a double remainder. The arithmetic order is unchanged:
an export gives the same tiles.

LandscapeRasterizer.Draw: bicubic 19.2 -> 11.3 ns, bilinear 16.4 -> 8.8 ns
per pixel. ObjectTexture.Sample: bicubic 57.8 -> 54.4 ns. WhiterunWorld at
4096 pixels per cell with textures, AOT: 12.8 -> 11.3 s.
Every benchmark moves to a collapsed section. A benchmark whose allocations
differ counts as changed, whatever its time.
feat(benchmarks): cover the object rasterizer and grid tile encoding
All checks were successful
/ docs (push) Successful in 5s
/ format (push) Successful in 1m20s
/ test (push) Successful in 1m23s
Benchmarks / compare (pull_request) Successful in 6m25s
fd995dec37
A profile of a full textured export puts the object rasterizer (16 %) and
PNG encoding (8.7 %) next to the landscape rasterizer as the hot paths.
Benchmark ObjectRasterizer.Draw on a cell of overlapping textured models,
and PngEncoder.Write on one 256x256 grid tile at the default level.
ci(benchmarks): run a shorter job than BenchmarkDotNet's default
All checks were successful
/ format (push) Successful in 4s
/ docs (push) Successful in 5s
/ test (push) Successful in 1m5s
Benchmarks / compare (pull_request) Successful in 1m40s
3d9dc97022
Superkooka deleted branch benchmark 2026-10-09 06:07:41 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Superkooka/SkyrimSourceExporter!35
No description provided.