Esia against Dear ImGui: a month of benchmarks that kept correcting me
Esia is my rendering library: a painter, a text stack and a set of GPU backends for drawing an interface inside a frame that somebody else owns. In October I gave it a goal that sounded simple. For the same picture it should cost at least 20 percent less than Dear ImGui. The first honest benchmark said I was three times slower in the scenes I cared about most.
This is a log of that month. It has some wins in it. Mostly it is a list of the ways a benchmark can be right and still mislead the person who wrote it.
The benchmark came first
I did not want an argument about methodology after the fact, so the harness was written before any optimization. Both libraries draw the same scenes into the same offscreen target, 1600 by 1000, on one device per API: Direct3D 11, Direct3D 12, Vulkan 1.3 and OpenGL 3.3 core. Both are hosted inside a foreign frame, with the surrounding state saved and restored around them. Timestamps sit around the render call and the GPU is waited on every frame. There are nineteen scenes: lines, boxes, fills, rounded rectangles, circles, a page of text, three thousand labels, a panel of widgets, and a few dense scenes with a thousand small items each.
Dear ImGui is unpatched 1.92.9b, and later 1.93.0. Runs alternate between the two libraries and I report medians. Dear ImGui is the library I learned from and the bar everybody measures against, and nothing here is a claim about its design. It is a comparison of draw cost on these scenes, on my machines.
The first table hurt
On Direct3D 11 the first run gave these CPU ratios, my time divided by Dear ImGui's. Below one means Esia is cheaper.
| Scene | First run | After round one |
|---|---|---|
| Page of text | 1.19 | 0.46 |
| Widgets | 0.51 | 0.41 |
| Rounded shapes, circles | about 0.27 | about 0.27 |
| 3,000 labels | 2.51 | 1.67 |
| 1,000 markers | 3.03 | 1.70 |
The round shapes were ahead from the start, for a structural reason. Dear ImGui turns a rounded rectangle into triangles on the CPU and uploads them, more than 12 MB for that one scene. Esia sends a small record per shape and lets the pixel shader find the edge.
The GPU side was worse than the CPU side. The marker scene cost 24 times Dear ImGui's GPU time. A scene of long diagonal lines cost 108 times.
That last number had exactly one cause. Each line segment was drawn as an effect quad, and the quad was the segment's axis-aligned bounding box. For a long diagonal, the bounding box is most of the screen. I was shading about a million pixels to draw a hairline. Turning the quad so it lies along the segment took that scene from 108 times to 3 times. Together with the other fixes of that round, the markers went from 24 times to 1.14.
Small records, one draw call
The next step moved plain shapes and polylines onto the same path as text: a 32-byte record per quad, batched together. A scene with a thousand overlapping items went from 948 draw calls to one. GPU time for the line scene dropped from 0.231 ms to 0.033 ms. After that, Esia was ahead on CPU everywhere except labels and polylines.
Then the target moved
By then Dear ImGui 1.93.0 was out with a new draw list, and I had not measured against it yet. In it, thin lines got about twice as fast on both CPU and GPU, because each one is now a single textured quad. Fills got 3.8 times slower in my scenes, since fractional coordinates are now antialiased, and boxes, rounded shapes and circles lost 10 to 20 percent.
So I was behind again where it mattered to me: 1.60 times on lines, 1.48 on long lines, 1.96 on polylines.
The third round was a day spent looking at one loop. The line code computed everything for a segment in a single long pass, and the profile showed it was bound by latency, around 120 micro-operations an iteration with each step waiting on the one before. Splitting the normals into their own loop let the processor overlap them. The direction of a joint became a diamond angle, which is one division and no branch. Pieces longer than about one line width along an axis skip the overlap check completely.
| Scene, D3D11 CPU | Esia before | Esia after | ImGui 1.92.9b | ImGui 1.93.0 |
|---|---|---|---|---|
| Lines | 0.294 ms | 0.137 ms | 0.338 ms | 0.176 ms |
| Long lines | 0.031 ms | 0.015 ms | 0.033 ms | 0.021 ms |
| Polylines | 0.189 ms | 0.087 ms | 0.079 ms | 0.100 ms |
That put Esia ahead of 1.93 in every line scene on Direct3D 11, Direct3D 12 and Vulkan. Polylines were still a few percent behind the older release, which was the reason for the next round.
SIMD that has to agree with itself
The line kernels now exist in scalar, SSE2, AVX2, AVX-512 and NEON versions, chosen at run time. I set one condition before writing any of them: every level has to produce the same bits. That means exact square roots and divisions, and no fused multiply-add, which is switched off per file for each compiler. A test draws the same polylines at every level and compares the output.
The first wide versions lost to SSE2. They paid a fixed cost per call, because I was folding the leftover lanes by storing them to the stack and reading them back one at a time. Folding with shuffles fixed that. The chart scene had a different problem. It spent 80 percent of its time in a scalar check that runs once per short segment, and nothing got faster until that check was vectorized too.
| Scene, D3D11 CPU | Scalar | SSE2 | AVX2 | AVX-512 | ImGui 1.92.9b | ImGui 1.93.0 |
|---|---|---|---|---|---|---|
| Polylines, 200 of 64 points | 0.082 ms | 0.046 ms | 0.043 ms | 0.043 ms | 0.085 ms | 0.100 ms |
| Charts, 8 of 1,601 points | 0.150 ms | 0.054 ms | 0.040 ms | 0.039 ms | 0.084 ms | 0.099 ms |
AVX-512 bought nothing over AVX2 on my processor. It is a Zen 4, which runs 512-bit operations as two 256-bit halves.
The rule that cost me the easy wins
An optimization may change the speed. It may not change the picture. Not by one level of one channel on one antialiased edge.
That rule is expensive. Drawing shadows, arcs and rings as plain quads took the regular widget look from 66 draw calls to one, and from 0.0407 ms to 0.0244 ms. It also moved some edge pixels by one to three levels out of 255. I dropped all of it, because "close enough" is how a renderer drifts, one harmless change at a time.
Enforcing it is mechanical. Every scene is rendered by the published build and by the new one, and the two images are compared byte for byte: 22 painter scenes plus the widget scene in both looks. The SVG rasterizer is hashed over a corpus of 70,128 rendered images. A cache that replays earlier output has a verify mode that redraws from scratch and compares.
Right in the benchmark, wrong in the app
After one text change the harness showed the text scenes 60 percent faster. Before believing it I asked the obvious question. Had the real applications been measured against the build from before that day's work? They had not.
Once they were, the two demo apps turned out 1 to 13 percent slower per frame. The text features had gone into the shader that every effect shares. Its temporaries went from 23 to 25 and its instruction slots from about 3,400 to about 4,600, so every pixel of every effect paid for glyph code that only text needed. Moving those features into their own variant brought the apps back.
The rule since then: a speed claim is measured against the build from before the work, on real applications as well as the harness, with runs alternated for at least ten rounds. Ten is not a superstition. A five-round run showed one app 12 percent slower, and the ten-round rerun turned that into 5 percent faster. The same old binary was 23 percent slower in the afternoon than it had been in the morning, because other things were using the machine.
A fast GPU measures the wrong thing
All of this ran on a desktop with an RTX 4080 SUPER. Then the same harness ran on a laptop with Intel integrated graphics, and the picture changed.
On the CPU side Esia still won 11 of the 19 scenes, by a lot in some: 0.16 on rounded shapes, 0.18 on circles, 0.40 on text and widgets. On the GPU side it lost consistently on boxes, rings and bars, anywhere from 1.2 to 8.6 times, in scenes it wins on the desktop card.
The explanation embarrassed me a little. On the desktop, the GPU time of both libraries was almost exactly the size of the frame's upload divided by the speed of the bus. Dear ImGui's rounded scene uploads 12.5 MB and took 0.72 ms. Its circle scene uploads 7 MB and took 0.41 ms. My "GPU comparison" on that machine had been measuring how many bytes each library sends, and Esia sends very few.
An integrated GPU shares memory with the CPU, so the upload is nearly free and the drawing itself is what costs. There the per-pixel work shows. My quad shader reads 16 floats for every pixel where Dear ImGui's reads 6, it branches, and it computes an edge fade. A hollow shape still shades its whole quad and throws most of it away.
I have ideas for that, such as drawing a hollow shape as its band only. They have to pass the byte-for-byte rule first.
Where it stands
At the widget level, on Direct3D 11, Dear ImGui 1.92.9b takes 0.0312 ms of CPU for my test panel. Esia's flat look went from 0.0387 ms to 0.0244 ms, which is 0.78 of Dear ImGui and meets the goal. The regular look, with shadows and glass, went from 0.0546 ms to 0.0407 ms and is still at 1.30, because its 66 draw calls cannot be merged without touching pixels.
Labels at fresh sub-pixel positions were the last large gap. A placement cache took them from 0.421 ms to 0.280 ms, 1.11 times Dear ImGui. Text-heavy scenes still lose on the laptop, at 1.36 for the label scene.
So the answer to "is it 20 percent cheaper" is: for flat interfaces, yes. For the look I actually like, not yet. I know which 66 draw calls are in the way.
Evidence note: numbers are from my own benchmark runs in October and November 2026 on one desktop (RTX 4080 SUPER) and one laptop on Intel integrated graphics. They are medians of alternated runs and they are not a general ranking of the two libraries. Nothing was rerun for this article. Esia is open source at github.com/0xDEADBEEFC0DEBABE/Esia.