From 3da1d08cb86bc9ce59f3a644b3f1a1dcf7e676cf Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 02:55:26 +0530 Subject: [PATCH 1/6] chore(benchmark): Samsung SM-E146B results with the GPU cache floor Before and after, interleaved by view. tgfx at 10,000 paths goes from 8.8 to 21.8 FPS on SurfaceView and from 4.8 to 20.4 on TextureView; no other row moved beyond noise. The performance page gets the SM-E146B table under the S25 Edge one, which is kept, with a note that it predates the fix. --- ...11-samsung-90hz-skia310-cache-floor-raw.md | 135 ++++++++++++++++++ ...-11-11-samsung-90hz-skia310-cache-floor.md | 56 ++++++++ docs/content/docs/performance.mdx | 30 ++++ 3 files changed, 221 insertions(+) create mode 100644 apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md create mode 100644 apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md diff --git a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md new file mode 100644 index 0000000..7f78435 --- /dev/null +++ b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md @@ -0,0 +1,135 @@ +# Raw: Samsung SM-E146B, 90 Hz, react-native-skia 3.10.0, GPU cache floor + +`node bench/run.mjs --order alternate --reps 2 --gap 10 --cool 0.95 --cool-timeout 240 --skip tgfx:anim-imp --views `, once per view. + +## SurfaceView + +| engine · scene · view | Present FPS | UI FPS | JS FPS | CPU % (1 core = 100) | PSS MB | thermal | CPU cap % | ticks | +|---|---|---|---|---|---|---|---|---| +| tgfx · shapes · surface | 64.3 | 91 | 90 | 179 | 390.2 | 0 | 98 | 53 | +| skia · shapes · surface | 89.3 | 91 | 91 | 68 | 320.1 | 0 | 100 | 53 | +| tgfx · shapes-nodes · surface | 62.8 | 91 | 90 | 188 | 388.7 | 0 | 100 | 53 | +| skia · shapes-nodes · surface | 25.9 | 91 | 90 | 95 | 465.7 | 0 | 100 | 52 | +| tgfx · shapes-atlas · surface | 89.9 | 91 | 91 | 48 | 368.3 | 0 | 100 | 53 | +| skia · shapes-atlas · surface | 89.5 | 91 | 91 | 67 | 321.3 | 0 | 100 | 53 | +| tgfx · images · surface | 90.1 | 91 | 91 | 80 | 334.5 | 0 | 100 | 53 | +| skia · images · surface | 88.4 | 91 | 90 | 111 | 344.0 | 0 | 100 | 53 | +| tgfx · shader · surface | 15.1 | 91 | 91 | 25 | 329.0 | 0 | 100 | 53 | +| skia · shader · surface | 14.8 | 91 | 91 | 27 | 303.3 | 0 | 100 | 53 | +| tgfx · pattern · surface | 90.2 | 91 | 91 | 48 | 324.8 | 0 | 100 | 53 | +| skia · pattern · surface | 89.5 | 91 | 91 | 61 | 299.6 | 0 | 100 | 53 | +| tgfx · paths900 · surface | 90.1 | 91 | 91 | 75 | 344.1 | 0 | 100 | 53 | +| skia · paths900 · surface | 27.3 | 91 | 91 | 50 | 403.0 | 0 | 100 | 53 | +| tgfx · paths2500 · surface | 83.7 | 91 | 91 | 113 | 446.7 | 0 | 100 | 53 | +| skia · paths2500 · surface | 27.0 | 91 | 90 | 59 | 411.9 | 0 | 100 | 53 | +| tgfx · paths5000 · surface | 44.0 | 91 | 91 | 111 | 482.8 | 0 | 100 | 53 | +| skia · paths5000 · surface | 17.9 | 91 | 90 | 51 | 424.1 | 0 | 100 | 53 | +| tgfx · paths · surface | 21.8 | 91 | 90 | 110 | 657.1 | 0 | 100 | 53 | +| skia · paths · surface | 10.3 | 91 | 91 | 47 | 455.1 | 0 | 100 | 53 | +| tgfx · text · surface | 73.1 | 91 | 90 | 129 | 360.8 | 0 | 98 | 53 | +| skia · text · surface | 32.2 | 91 | 90 | 121 | 399.6 | 0 | 100 | 53 | +| tgfx · anim-decl · surface | 24.3 | 32 | 17 | 218 | 499.7 | 0 | 95 | 51 | +| skia · anim-decl · surface | 31.4 | 31 | 16 | 144 | 489.1 | 0 | 95 | 51 | +| skia · anim-imp · surface | 53.2 | 78 | 39 | 162 | 358.0 | 0 | 92 | 52 | +| tgfx · shapes-picture · surface | 79.1 | 91 | 90 | 150 | 390.5 | 0 | 100 | 53 | +| skia · shapes-picture · surface | 26.0 | 91 | 90 | 84 | 425.4 | 0 | 100 | 53 | + +`thermal` is the highest Android thermal status (0 none … 3 severe) seen at the start of the combo's runs. `CPU cap %` is the lowest scaling_max_freq / cpuinfo_max_freq seen during them: below 100 the kernel was throttling, whatever the status says. + +### Where the CPU and memory go + +| engine · scene · view | UI thread % | JS thread % | busiest other threads % | Graphics MB | Native MB | Java MB | +|---|---|---|---|---|---|---| +| tgfx · shapes · surface | 7 | 2 | TgfxRender 146, nitro-thread 18, binder 6 | 161.1 | 143.7 | 4.4 | +| skia · shapes · surface | 8 | 2 | RNSkia Present 23, RNSkia Render 16, mali-cmar-backe 7 | 134.9 | 106.6 | 4.8 | +| tgfx · shapes-nodes · surface | 7 | 2 | TgfxRender 152, nitro-thread 19, binder 6 | 161.1 | 141.5 | 4.4 | +| skia · shapes-nodes · surface | 7 | 1 | RNSkia Render 58, RNSkia Present 23, mali-cmar-backe 3 | 250.8 | 119.3 | 4.5 | +| tgfx · shapes-atlas · surface | 10 | 2 | TgfxRender 17, binder 7, mali-cmar-backe 7 | 149.5 | 124.7 | 4.4 | +| skia · shapes-atlas · surface | 8 | 2 | RNSkia Present 23, RNSkia Render 16, mali-cmar-backe 7 | 134.9 | 106.7 | 4.8 | +| tgfx · images · surface | 7 | 1 | TgfxRender 50, binder 5, mali-cmar-backe 5 | 143.5 | 111.9 | 4.4 | +| skia · images · surface | 6 | 1 | RNSkia Render 59, RNSkia Present 37, binder 5 | 150.4 | 110.8 | 4.7 | +| tgfx · shader · surface | 12 | 3 | binder 4, TgfxRender 4, mali-cmar-backe 2 | 145.1 | 105.2 | 4.4 | +| skia · shader · surface | 12 | 3 | RNSkia Present 5, binder 3, mali-cmar-backe 1 | 119.9 | 103.1 | 4.5 | +| tgfx · pattern · surface | 11 | 2 | TgfxRender 18, mali-cmar-backe 8, binder 8 | 143.3 | 104.7 | 4.4 | +| skia · pattern · surface | 9 | 2 | RNSkia Present 24, mali-cmar-backe 7, binder 7 | 118.1 | 102.1 | 4.7 | +| tgfx · paths900 · surface | 7 | 1 | TgfxRender 54, binder 5, mali-cmar-backe 4 | 158.0 | 112.0 | 4.4 | +| skia · paths900 · surface | 12 | 3 | RNSkia Render 12, RNSkia Present 11, mali-cmar-backe 4 | 219.4 | 103.1 | 4.5 | +| tgfx · paths2500 · surface | 6 | 1 | TgfxRender 96, binder 6, mali-cmar-backe 4 | 242.1 | 123.6 | 4.4 | +| skia · paths2500 · surface | 11 | 3 | RNSkia Render 27, RNSkia Present 9, mali-cmar-backe 4 | 224.4 | 104.4 | 4.5 | +| tgfx · paths5000 · surface | 7 | 1 | TgfxRender 96, binder 4, mali-cmar-backe 2 | 257.5 | 142.4 | 4.4 | +| skia · paths5000 · surface | 10 | 3 | RNSkia Render 25, RNSkia Present 6, mali-cmar-backe 4 | 230.5 | 109.2 | 4.5 | +| tgfx · paths · surface | 6 | 1 | TgfxRender 96, binder 3, mali-cmar-backe 1 | 377.1 | 173.7 | 4.4 | +| skia · paths · surface | 11 | 3 | RNSkia Render 22, mali-cmar-backe 4, RNSkia Present 3 | 253.1 | 109.7 | 4.4 | +| tgfx · text · surface | 6 | 1 | TgfxRender 108, nitro-thread 8, binder 6 | 151.6 | 128.6 | 4.4 | +| skia · text · surface | 6 | 1 | RNSkia Render 93, RNSkia Present 17, binder 4 | 197.2 | 117.5 | 4.5 | +| tgfx · anim-decl · surface | 96 | 0 | TgfxRender 99, nitro-thread 13, binder 6 | 152.6 | 189.0 | 4.4 | +| skia · anim-decl · surface | 98 | 0 | RNSkia Render 24, RNSkia Present 14, binder 4 | 152.8 | 177.4 | 4.5 | +| skia · anim-imp · surface | 97 | 1 | RNSkia Render 35, RNSkia Present 26, binder 6 | 153.9 | 123.3 | 4.6 | +| tgfx · shapes-picture · surface | 7 | 2 | TgfxRender 124, nitro-thread 14, binder 6 | 161.1 | 143.9 | 4.4 | +| skia · shapes-picture · surface | 7 | 2 | RNSkia Render 43, RNSkia Present 24, binder 3 | 233.0 | 113.1 | 4.5 | + +## TextureView + +| engine · scene · view | Present FPS | UI FPS | JS FPS | CPU % (1 core = 100) | PSS MB | thermal | CPU cap % | ticks | +|---|---|---|---|---|---|---|---|---| +| tgfx · shapes · texture | 60.1 | 90 | 90 | 201 | 423.1 | 1 | 84 | 53 | +| skia · shapes · texture | 89.0 | 91 | 91 | 87 | 341.0 | 1 | 100 | 53 | +| tgfx · shapes-nodes · texture | 59.1 | 90 | 90 | 202 | 423.0 | 1 | 80 | 53 | +| skia · shapes-nodes · texture | 25.3 | 90 | 90 | 102 | 496.9 | 1 | 100 | 53 | +| tgfx · shapes-atlas · texture | 88.9 | 91 | 91 | 77 | 398.9 | 1 | 100 | 53 | +| skia · shapes-atlas · texture | 89.2 | 91 | 91 | 88 | 341.1 | 1 | 98 | 53 | +| tgfx · images · texture | 88.7 | 91 | 91 | 99 | 369.3 | 1 | 98 | 53 | +| skia · images · texture | 86.1 | 91 | 90 | 127 | 363.6 | 1 | 92 | 53 | +| tgfx · shader · texture | 12.9 | 45 | 45 | 22 | 366.6 | 1 | 100 | 51 | +| skia · shader · texture | 14.3 | 33 | 31 | 24 | 327.2 | 1 | 100 | 51 | +| tgfx · pattern · texture | 88.9 | 91 | 91 | 74 | 360.3 | 1 | 100 | 53 | +| skia · pattern · texture | 89.3 | 91 | 91 | 86 | 320.5 | 1 | 100 | 53 | +| tgfx · paths900 · texture | 88.4 | 91 | 91 | 95 | 381.9 | 1 | 98 | 53 | +| skia · paths900 · texture | 26.5 | 67 | 65 | 52 | 428.8 | 1 | 100 | 51 | +| tgfx · paths2500 · texture | 71.9 | 91 | 90 | 133 | 481.1 | 1 | 88 | 53 | +| skia · paths2500 · texture | 26.2 | 67 | 66 | 62 | 437.3 | 1 | 100 | 51 | +| tgfx · paths5000 · texture | 40.9 | 91 | 90 | 121 | 515.2 | 1 | 84 | 53 | +| skia · paths5000 · texture | 17.6 | 72 | 70 | 55 | 450.3 | 1 | 100 | 52 | +| tgfx · paths · texture | 20.4 | 91 | 90 | 115 | 605.1 | 1 | 88 | 53 | +| skia · paths · texture | 10.1 | 79 | 77 | 45 | 477.0 | 1 | 100 | 52 | +| tgfx · text · texture | 66.0 | 90 | 90 | 147 | 394.6 | 1 | 80 | 53 | +| skia · text · texture | 30.4 | 86 | 85 | 129 | 425.4 | 1 | 95 | 52 | +| tgfx · anim-decl · texture | 11.9 | 30 | 16 | 217 | 532.8 | 1 | 84 | 51 | +| skia · anim-decl · texture | 9.8 | 32 | 16 | 117 | 485.8 | 1 | 92 | 51 | +| skia · anim-imp · texture | 23.2 | 77 | 39 | 129 | 375.0 | 1 | 88 | 53 | +| tgfx · shapes-picture · texture | 70.4 | 91 | 90 | 171 | 427.1 | 1 | 92 | 53 | +| skia · shapes-picture · texture | 25.3 | 90 | 90 | 91 | 462.8 | 2 | 100 | 52 | + +`thermal` is the highest Android thermal status (0 none … 3 severe) seen at the start of the combo's runs. `CPU cap %` is the lowest scaling_max_freq / cpuinfo_max_freq seen during them: below 100 the kernel was throttling, whatever the status says. + +### Where the CPU and memory go + +| engine · scene · view | UI thread % | JS thread % | busiest other threads % | Graphics MB | Native MB | Java MB | +|---|---|---|---|---|---|---| +| tgfx · shapes · texture | 10 | 2 | TgfxRender 147, nitro-thread 19, RenderThread 11 | 195.2 | 141.8 | 4.4 | +| skia · shapes · texture | 11 | 2 | RenderThread 20, RNSkia Present 18, RNSkia Render 16 | 155.9 | 106.4 | 4.7 | +| tgfx · shapes-nodes · texture | 10 | 2 | TgfxRender 151, nitro-thread 14, RenderThread 11 | 195.3 | 142.2 | 4.4 | +| skia · shapes-nodes · texture | 8 | 1 | RNSkia Render 57, RNSkia Present 23, mali-cmar-backe 4 | 281.3 | 120.3 | 4.5 | +| tgfx · shapes-atlas · texture | 13 | 2 | RenderThread 23, TgfxRender 15, mali-cmar-backe 13 | 177.6 | 125.5 | 4.4 | +| skia · shapes-atlas · texture | 11 | 2 | RenderThread 20, RNSkia Present 17, RNSkia Render 15 | 155.9 | 106.6 | 4.7 | +| tgfx · images · texture | 10 | 1 | TgfxRender 46, RenderThread 19, mali-cmar-backe 10 | 177.5 | 112.5 | 4.4 | +| skia · images · texture | 9 | 1 | RNSkia Render 59, RNSkia Present 39, RenderThread 14 | 168.2 | 111.4 | 4.7 | +| tgfx · shader · texture | 6 | 2 | RenderThread 4, TgfxRender 4, binder 3 | 183.2 | 105.6 | 4.4 | +| skia · shader · texture | 4 | 1 | RenderThread 4, RNSkia Present 4, mali-cmar-backe 3 | 144.8 | 103.3 | 4.4 | +| tgfx · pattern · texture | 12 | 2 | RenderThread 23, TgfxRender 15, mali-cmar-backe 14 | 177.4 | 105.5 | 4.4 | +| skia · pattern · texture | 13 | 2 | RenderThread 22, RNSkia Present 19, mali-cmar-backe 13 | 139.0 | 102.2 | 4.7 | +| tgfx · paths900 · texture | 10 | 2 | TgfxRender 53, RenderThread 17, mali-cmar-backe 9 | 191.2 | 112.8 | 4.4 | +| skia · paths900 · texture | 9 | 2 | RNSkia Render 12, RNSkia Present 8, RenderThread 8 | 244.8 | 103.7 | 4.5 | +| tgfx · paths2500 · texture | 10 | 2 | TgfxRender 95, RenderThread 14, mali-cmar-backe 7 | 275.2 | 123.7 | 4.4 | +| skia · paths2500 · texture | 8 | 2 | RNSkia Render 25, RNSkia Present 7, RenderThread 7 | 249.5 | 105.5 | 4.5 | +| tgfx · paths5000 · texture | 8 | 1 | TgfxRender 97, RenderThread 6, binder 5 | 290.4 | 142.8 | 4.4 | +| skia · paths5000 · texture | 8 | 2 | RNSkia Render 25, mali-cmar-backe 5, RNSkia Present 5 | 255.8 | 110.0 | 4.5 | +| tgfx · paths · texture | 7 | 1 | TgfxRender 101, binder 4, RenderThread 3 | 335.7 | 175.2 | 4.4 | +| skia · paths · texture | 10 | 2 | RNSkia Render 21, mali-cmar-backe 4, binder 3 | 276.5 | 110.6 | 4.4 | +| tgfx · text · texture | 9 | 1 | TgfxRender 108, RenderThread 11, nitro-thread 9 | 185.7 | 129.2 | 4.4 | +| skia · text · texture | 6 | 1 | RNSkia Render 93, RNSkia Present 16, RenderThread 5 | 223.0 | 118.3 | 4.5 | +| tgfx · anim-decl · texture | 94 | 0 | TgfxRender 96, nitro-thread 10, binder 5 | 186.6 | 189.4 | 4.4 | +| skia · anim-decl · texture | 98 | 0 | RNSkia Render 8, RNSkia Present 4, binder 3 | 148.7 | 177.9 | 4.4 | +| skia · anim-imp · texture | 96 | 1 | RNSkia Render 12, RNSkia Present 9, RenderThread 4 | 173.4 | 123.2 | 4.5 | +| tgfx · shapes-picture · texture | 10 | 2 | TgfxRender 123, nitro-thread 15, RenderThread 12 | 195.4 | 144.2 | 4.4 | +| skia · shapes-picture · texture | 8 | 2 | RNSkia Render 43, RNSkia Present 25, mali-cmar-backe 5 | 271.5 | 113.4 | 4.5 | diff --git a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md new file mode 100644 index 0000000..326d82b --- /dev/null +++ b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md @@ -0,0 +1,56 @@ +# GPU cache floor: before and after on a mid-range phone + +Same phone, build setup, scenes and runner as +`results-2026-11-11-samsung-90hz-skia310.md` (the "before" build). The only +change is the 256 MB floor on a canvas's GPU cache. The two builds ran +interleaved by view, before surface, after surface, after texture, before +texture, so neither got the cooler phone. Raw output: +`results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md`. + +## What moved + +| tgfx, 10,000 paths | before | after | +|---|---|---| +| surface, present FPS | 8.8 | **21.8** | +| texture, present FPS | 4.8 | **20.4** | +| surface, CPU | 167 % | 110 % | +| texture, CPU | 204 % | 115 % | +| surface, Graphics MB | 242 | 377 | +| texture, Graphics MB | 269 | 336 | + +The geometry now stays in the cache: `TgfxRender` drops from 144-151 % to +96-101 % and is the limit, as at 5,000 paths, and the runs are steady (22.1 +and 20.0 surface, 20.1 and 20.4 texture, against 9.7 and 8.2, 10.7 and 4.3 +before). tgfx now draws 2x skia at 10,000 paths. The cost is the cached +geometry: 135 MB more Graphics memory on SurfaceView, 67 MB on TextureView. + +No other row moved beyond run-to-run noise. The largest other differences +are on CPU-bound tgfx shapes rows, in both directions: shapes +5 % surface +and +7 % texture, shapes-nodes +8 % texture, shapes-picture -5 % surface. +Those rows vary that much between runs at a different CPU cap or thermal +status (the before TextureView half ran at thermal status 2, the after one +at 1). skia's static rows are within 1.2 %, its animated rows within 6 %. + +## Present FPS, after + +| scene | tgfx surface | skia surface | tgfx texture | skia texture | +|---|---|---|---|---| +| shapes, 20k (tgfx nodes, skia ShapeBlob) | 64.3 | **89.3** | 60.1 | **89.0** | +| shapes-nodes, 20k nodes on both | **62.8** | 25.9 | **59.1** | 25.3 | +| shapes-atlas, one atlas on both | 89.9 | 89.5 | 88.9 | 89.2 | +| shapes-picture, 20k draws recorded once | **79.1** | 26.0 | **70.4** | 25.3 | +| images, 3,600 | 90.1 | 88.4 | 88.7 | 86.1 | +| shader | 15.1 | 14.8 | 12.9 | 14.3 | +| pattern | 90.2 | 89.5 | 88.9 | 89.3 | +| paths, 900 | **90.1** | 27.3 | **88.4** | 26.5 | +| paths, 2,500 | **83.7** | 27.0 | **71.9** | 26.2 | +| paths, 5,000 | **44.0** | 17.9 | **40.9** | 17.6 | +| paths, 10,000 | **21.8** | 10.3 | **20.4** | 10.1 | +| text, 6,000 (skia `deviceIndependentFonts`) | **73.1** | 32.2 | **66.0** | 30.4 | +| anim-decl, 5k shapes, two derived values each | 24.3 | **31.4** | 11.9 | 9.8 | +| anim-imp, 5k shapes, one worklet | ~17 by hand | 53.2 | ~6 by hand | 23.2 | + +## Conditions + +As in the before file. Thermal status 0 for the after SurfaceView half, 1 +for the after TextureView half. diff --git a/docs/content/docs/performance.mdx b/docs/content/docs/performance.mdx index c704eb8..be7349a 100644 --- a/docs/content/docs/performance.mdx +++ b/docs/content/docs/performance.mdx @@ -32,6 +32,8 @@ How each row is drawn: individual draws in `` (tgfx) or a `` (skia). - **Paths.** Cubic paths, half stroked. Both engines hold about 119 FPS up to 2,500 paths; tgfx falls to 80 at 5,000 and to the figure above at 10,000. + This table was measured before the GPU cache floor, which took tgfx at + 10,000 paths from 9 to 22 FPS on the phone below. - **Texts.** skia runs with `deviceIndependentFonts`. - **Each animated.** Every shape moves on its own phase, so no transform is shared. Declarative binds two derived values per shape. Imperative writes @@ -49,6 +51,34 @@ under about 15% between rows below 120 FPS as noise. The harness, raw runs and method are in [`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark). +### A mid-range phone + +The same scenes on a Samsung SM-E146B (Exynos 1330, Mali-G68, Android 15, +90 Hz), two runs per scene. Two more shapes rows hold the technique equal: +20,000 declarative nodes on both engines, or one atlas on both (tgfx draws +20,000 tinted quads in one ``; skia's shape blob does the same +internally). + +| scene | tgfx surface | skia surface | tgfx texture | skia texture | +|---|---|---|---|---| +| 20,000 shapes | 64.3 | **89.3** | 60.1 | **89.0** | +| 20,000 shapes, nodes on both | **62.8** | 25.9 | **59.1** | 25.3 | +| 20,000 shapes, one atlas on both | 89.9 | 89.5 | 88.9 | 89.2 | +| 20,000 shapes, recorded once | **79.1** | 26.0 | **70.4** | 25.3 | +| 3,600 images | 90.1 | 88.4 | 88.7 | 86.1 | +| 40-octave shader | 15.1 | 14.8 | 12.9 | 14.3 | +| image pattern | 90.2 | 89.5 | 88.9 | 89.3 | +| 900 paths | **90.1** | 27.3 | **88.4** | 26.5 | +| 2,500 paths | **83.7** | 27.0 | **71.9** | 26.2 | +| 5,000 paths | **44.0** | 17.9 | **40.9** | 17.6 | +| 10,000 paths | **21.8** | 10.3 | **20.4** | 10.1 | +| 6,000 texts | **73.1** | 32.2 | **66.0** | 30.4 | +| 5,000 shapes, each animated (declarative) | 24.3 | **31.4** | 11.9 | 9.8 | +| 5,000 shapes, each animated (imperative) | not measured | 53.2 | not measured | 23.2 | + +skia is GPU-bound on paths here from 900 on. tgfx holds the refresh rate at +900 paths and is limited by its render thread from 2,500. + Think a number is off? [Open an issue](https://github.com/margelo/react-native-tgfx/issues). From 8619172fa9a6c6dae8421c280231d4e4aa68a928 Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 03:21:40 +0530 Subject: [PATCH 2/6] docs(performance): trim the SM-E146B section to its table Drops the note under the S25 Edge table and the prose around the new table. --- docs/content/docs/performance.mdx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/docs/content/docs/performance.mdx b/docs/content/docs/performance.mdx index be7349a..bb8e1bb 100644 --- a/docs/content/docs/performance.mdx +++ b/docs/content/docs/performance.mdx @@ -32,8 +32,6 @@ How each row is drawn: individual draws in `` (tgfx) or a `` (skia). - **Paths.** Cubic paths, half stroked. Both engines hold about 119 FPS up to 2,500 paths; tgfx falls to 80 at 5,000 and to the figure above at 10,000. - This table was measured before the GPU cache floor, which took tgfx at - 10,000 paths from 9 to 22 FPS on the phone below. - **Texts.** skia runs with `deviceIndependentFonts`. - **Each animated.** Every shape moves on its own phase, so no transform is shared. Declarative binds two derived values per shape. Imperative writes @@ -53,11 +51,7 @@ method are in ### A mid-range phone -The same scenes on a Samsung SM-E146B (Exynos 1330, Mali-G68, Android 15, -90 Hz), two runs per scene. Two more shapes rows hold the technique equal: -20,000 declarative nodes on both engines, or one atlas on both (tgfx draws -20,000 tinted quads in one ``; skia's shape blob does the same -internally). +Samsung SM-E146B (Exynos 1330, Android 15, 90 Hz), same scenes, two runs each. | scene | tgfx surface | skia surface | tgfx texture | skia texture | |---|---|---|---|---| @@ -76,9 +70,6 @@ internally). | 5,000 shapes, each animated (declarative) | 24.3 | **31.4** | 11.9 | 9.8 | | 5,000 shapes, each animated (imperative) | not measured | 53.2 | not measured | 23.2 | -skia is GPU-bound on paths here from 900 on. tgfx holds the refresh rate at -900 paths and is limited by its render thread from 2,500. - Think a number is off? [Open an issue](https://github.com/margelo/react-native-tgfx/issues). From 4a1837932082474debe1464af33ae389e4e6c336 Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 03:26:31 +0530 Subject: [PATCH 3/6] docs(performance): one phone, the SM-E146B, and a pointer to the method The S25 Edge table and the notes around it move out of the docs; its result files stay in apps/benchmark/bench. --- docs/content/docs/performance.mdx | 52 ++++--------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/docs/content/docs/performance.mdx b/docs/content/docs/performance.mdx index bb8e1bb..edbc218 100644 --- a/docs/content/docs/performance.mdx +++ b/docs/content/docs/performance.mdx @@ -6,52 +6,8 @@ icon: Gauge ## Benchmark -Against react-native-skia 3.10.0 on a Samsung Galaxy S25 Edge (SM-S937B, -Android 16, 120 Hz), release builds, on both Android view kinds: a -`SurfaceView` (`composite="layer"`, the default) and a `TextureView` -(`composite="texture"`). Present FPS is frames that reached the screen. One -run, each scene in a fresh process, mean of two 8 s windows. - -| scene | tgfx surface | skia surface | tgfx texture | skia texture | -|---|---|---|---|---| -| 20,000 shapes | 89.9 | **119.4** | 86.9 | **119.3** | -| 20,000 shapes, recorded once | 114.4 | 104.6 | 110.9 | 108.8 | -| 3,600 images | 119.4 | 119.0 | 118.8 | 118.8 | -| 40-octave shader | 119.6 | 119.3 | 119.0 | 119.0 | -| image pattern | 119.6 | 119.3 | 118.8 | 119.4 | -| 10,000 paths | 11.6 | **115.2** | 17.1 | **116.8** | -| 6,000 texts | **117.1** | 92.8 | **112.6** | 83.4 | -| 5,000 shapes, each animated (declarative) | 35.2 | **75.4** | 22.1 | 21.5 | -| 5,000 shapes, each animated (imperative) | not measured | 118.6 | not measured | 55.1 | - -How each row is drawn: - -- **Shapes.** Rects and circles interleaved, under one animated rotation. tgfx - draws plain `` and `` nodes and batches them itself; skia uses - its batched shape API (`Skia.ShapeBlob`). "Recorded once" is the same 20,000 - individual draws in `` (tgfx) or a `` (skia). -- **Paths.** Cubic paths, half stroked. Both engines hold about 119 FPS up to - 2,500 paths; tgfx falls to 80 at 5,000 and to the figure above at 10,000. -- **Texts.** skia runs with `deviceIndependentFonts`. -- **Each animated.** Every shape moves on its own phase, so no transform is - shared. Declarative binds two derived values per shape. Imperative writes - every shape from one worklet per frame: skia records a picture per frame; - tgfx's per-node handles stall at this count, so the row is not measured. For - thousands of independent sprites in tgfx, use a - [sprite buffer](#keep-it-cheap). -- Both animated rows are limited by the UI thread, not the GPU, on either - engine. - -This phone caps its CPU clocks within seconds of a heavy scene while still -reporting a normal thermal status, and CPU-bound rows follow the cap. The -runner waits for the cap to lift before each scene, but treat differences -under about 15% between rows below 120 FPS as noise. The harness, raw runs and -method are in -[`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark). - -### A mid-range phone - -Samsung SM-E146B (Exynos 1330, Android 15, 90 Hz), same scenes, two runs each. +Against react-native-skia 3.10.0 on a Samsung SM-E146B (Exynos 1330, Android +15, 90 Hz), release builds, two runs per scene. | scene | tgfx surface | skia surface | tgfx texture | skia texture | |---|---|---|---|---| @@ -70,6 +26,10 @@ Samsung SM-E146B (Exynos 1330, Android 15, 90 Hz), same scenes, two runs each. | 5,000 shapes, each animated (declarative) | 24.3 | **31.4** | 11.9 | 9.8 | | 5,000 shapes, each animated (imperative) | not measured | 53.2 | not measured | 23.2 | +The method and raw runs are in +[`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark); +ask your AI agent to review it. + Think a number is off? [Open an issue](https://github.com/margelo/react-native-tgfx/issues). From 22c79decadc312c78a05c0e9f4258a0d6a83a7f6 Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 03:30:53 +0530 Subject: [PATCH 4/6] docs(performance): reword the pointer to the benchmark method --- docs/content/docs/performance.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/docs/performance.mdx b/docs/content/docs/performance.mdx index edbc218..1f202a7 100644 --- a/docs/content/docs/performance.mdx +++ b/docs/content/docs/performance.mdx @@ -27,8 +27,8 @@ Against react-native-skia 3.10.0 on a Samsung SM-E146B (Exynos 1330, Android | 5,000 shapes, each animated (imperative) | not measured | 53.2 | not measured | 23.2 | The method and raw runs are in -[`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark); -ask your AI agent to review it. +[`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark). +You can ask your agent to review it and correct :) Think a number is off? [Open an issue](https://github.com/margelo/react-native-tgfx/issues). From 32b81e58efcb085f4b85b3ec1bade49ed91d9358 Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 14:00:01 +0530 Subject: [PATCH 5/6] fix(benchmark): start tgfx anim-imp's clock once its scene is attached Creating the 5,000 handles and attaching the scene takes 12-20 s on the SM-E146B, so the combo's 28 s clock and the runner's windows landed on setup. The clock and the parity pose now wait for the attach; every other combo starts as before. --- apps/benchmark/AnimScenes.tsx | 15 ++++++++++++++- apps/benchmark/App.tsx | 20 +++++++++++++++----- apps/benchmark/README.md | 2 +- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/apps/benchmark/AnimScenes.tsx b/apps/benchmark/AnimScenes.tsx index d7cca53..ed2e086 100644 --- a/apps/benchmark/AnimScenes.tsx +++ b/apps/benchmark/AnimScenes.tsx @@ -110,7 +110,17 @@ export function TgfxAnimScene({ scene, t }: { scene: string; t: T }) { * React never sees the nodes, and one worklet per frame writing every * handle. `inHierarchy` is what `` sets. */ -export function TgfxImperativeView({ t, view, driver }: { t: T; view: View; driver: 'ui' | 'js' }) { +export function TgfxImperativeView({ + t, + view, + driver, + onAttached, +}: { + t: T; + view: View; + driver: 'ui' | 'js'; + onAttached?: () => void; +}) { const built = useRef<{ scene: Scene; handles: ReturnType[] } | null>(null); if (built.current == null) { const t0 = Date.now(); @@ -138,11 +148,14 @@ export function TgfxImperativeView({ t, view, driver }: { t: T; view: View; driv } const { scene, handles } = built.current; const detach = useRef<(() => void) | null>(null); + const attached = useRef(onAttached); + attached.current = onAttached; const hybrid = useRef void>> | null>(null); if (hybrid.current == null) { hybrid.current = callback((ref: TgfxViewRef) => { detach.current?.(); detach.current = scene.attach(ref); + attached.current?.(); }); } useEffect( diff --git a/apps/benchmark/App.tsx b/apps/benchmark/App.tsx index 27228b5..4188471 100644 --- a/apps/benchmark/App.tsx +++ b/apps/benchmark/App.tsx @@ -453,6 +453,10 @@ export default function App() { const engine = plan == null || done ? 'done' : plan[combo][0]; const scene = plan == null || done ? '' : plan[combo][1]; const view: BackingView = plan == null || done ? 'surface' : plan[combo][2]; + // tgfx anim-imp builds 5,000 handles and its scene on the JS thread before it + // can draw; its clock and pose start once that scene is attached to the view. + const [attachedCombo, setAttachedCombo] = useState(-1); + const sceneReady = !(engine === 'tgfx' && scene === 'anim-imp') || attachedCombo === combo; const t = useSharedValue(0); const uiFrames = useSharedValue(0); @@ -484,7 +488,7 @@ export default function App() { // Each combo opens with t frozen at 0: the runner screencaps both engines in // the same pose (parity stills), then the rotation starts. useEffect(() => { - if (done) return; + if (done || !sceneReady) return; cancelAnimation(t); t.value = 0; const poseTimer = setTimeout( @@ -503,7 +507,7 @@ export default function App() { clearTimeout(animTimer); cancelAnimation(t); }; - }, [combo, done, engine, scene, view, t]); + }, [combo, done, sceneReady, engine, scene, view, t]); // UI-thread frames: a Reanimated frame callback rides the UI vsync. useFrameCallback(() => { @@ -540,14 +544,14 @@ export default function App() { const ready = tgfxImages.length === 8 && tgfxTile != null && plan != null; const last = plan != null && combo >= plan.length - 1; useEffect(() => { - if (!ready || done || cooling) return; + if (!ready || !sceneReady || done || cooling) return; console.log(`[bench] start engine=${engine} scene=${scene} view=${view}`); const timer = setTimeout( () => (gapMs > 0 && !last ? setCooling(true) : setCombo(c => c + 1)), COMBO_MS ); return () => clearTimeout(timer); - }, [ready, combo, done, cooling, gapMs, last, engine, scene, view]); + }, [ready, sceneReady, combo, done, cooling, gapMs, last, engine, scene, view]); // The gap: the canvas unmounts and the phone idles, the same for every engine. useEffect(() => { @@ -583,7 +587,13 @@ export default function App() { {engine === 'tgfx' ? ( scene === 'anim-imp' ? ( - + setAttachedCombo(combo)} + /> ) : ( ` | +| `anim-imp` | 5,000 | `Scene` + node handles on a raw `TgfxNativeView`, one worklet writes every handle; the 5,000 handles take a few seconds to create, so the combo's clock starts once the scene is attached | one worklet records an `SkPicture` per frame into `` | | `shapes-picture` | 20,000 | the static shapes in `` under the rotation | the static shapes recorded once, `` under the rotation | `anim-decl` stops at 5,000: at 20,000 the 40,000 mappers measure Reanimated, From 70df1a583029fe1844df305f4fb1dc1b5c893092 Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Wed, 11 Nov 2026 14:00:01 +0530 Subject: [PATCH 6/6] docs(performance): tgfx anim-imp on the SM-E146B 13.6 fps on SurfaceView and 5.0 on TextureView, against skia's 53.2 and 23.2. UI-thread bound at 98 %; the run and its raw output are in the cache-floor results. --- ...11-samsung-90hz-skia310-cache-floor-raw.md | 22 ++++++++++++++++ ...-11-11-samsung-90hz-skia310-cache-floor.md | 26 ++++++++++++++++++- docs/content/docs/performance.mdx | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md index 7f78435..eb2a0b6 100644 --- a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md +++ b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor-raw.md @@ -133,3 +133,25 @@ | skia · anim-imp · texture | 96 | 1 | RNSkia Render 12, RNSkia Present 9, RenderThread 4 | 173.4 | 123.2 | 4.5 | | tgfx · shapes-picture · texture | 10 | 2 | TgfxRender 123, nitro-thread 15, RenderThread 12 | 195.4 | 144.2 | 4.4 | | skia · shapes-picture · texture | 8 | 2 | RNSkia Render 43, RNSkia Present 25, mali-cmar-backe 5 | 271.5 | 113.4 | 4.5 | + +## tgfx anim-imp, clock from scene attach + +`node bench/run.mjs --engines tgfx,skia --scenes anim-imp --order alternate --reps 2 --gap 10 --cool 0.95 --cool-timeout 240` + +Per-window present FPS: tgfx surface 13.9, 12.5, 14.1, 13.4; skia surface 64.3, 54.6; tgfx texture 4.8, 4.5, 5.3, 6.8; skia texture 24.6, 20.0, 24.0, 20.6. + +| engine · scene · view | Present FPS | UI FPS | JS FPS | CPU % (1 core = 100) | PSS MB | thermal | CPU cap % | ticks | +|---|---|---|---|---|---|---|---|---| +| tgfx · anim-imp · surface | 13.6 | 14 | 7 | 176 | 1118.8 | 1 | 68 | 69 | +| skia · anim-imp · surface | 59.4 | 74 | 37 | 158 | 344.9 | 1 | 72 | 52 | +| tgfx · anim-imp · texture | 5.0 | 15 | 7 | 172 | 1146.6 | 1 | 72 | 66 | +| skia · anim-imp · texture | 22.3 | 77 | 39 | 129 | 387.9 | 2 | 84 | 52 | + +### Where the CPU and memory go + +| engine · scene · view | UI thread % | JS thread % | busiest other threads % | Graphics MB | Native MB | Java MB | +|---|---|---|---|---|---|---| +| tgfx · anim-imp · surface | 98 | 0 | TgfxRender 66, nitro-thread 8, binder 5 | 159.2 | 565.3 | 6.2 | +| skia · anim-imp · surface | 95 | 1 | RNSkia Render 29, RNSkia Present 25, binder 5 | 134.7 | 123.0 | 6.9 | +| tgfx · anim-imp · texture | 98 | 0 | TgfxRender 61, nitro-thread 5, binder 4 | 186.6 | 565.1 | 6.7 | +| skia · anim-imp · texture | 97 | 1 | RNSkia Render 12, RNSkia Present 9, RenderThread 4 | 173.4 | 124.3 | 6.8 | diff --git a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md index 326d82b..6072a2d 100644 --- a/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md +++ b/apps/benchmark/bench/results-2026-11-11-samsung-90hz-skia310-cache-floor.md @@ -48,7 +48,31 @@ at 1). skia's static rows are within 1.2 %, its animated rows within 6 %. | paths, 10,000 | **21.8** | 10.3 | **20.4** | 10.1 | | text, 6,000 (skia `deviceIndependentFonts`) | **73.1** | 32.2 | **66.0** | 30.4 | | anim-decl, 5k shapes, two derived values each | 24.3 | **31.4** | 11.9 | 9.8 | -| anim-imp, 5k shapes, one worklet | ~17 by hand | 53.2 | ~6 by hand | 23.2 | +| anim-imp, 5k shapes, one worklet | 13.6 | **53.2** | 5.0 | **23.2** | + +## tgfx anim-imp + +The matrix skips tgfx `anim-imp`: its 5,000 handles take about 4.3 s to +create on the JS thread, and the scene attaches 12-20 s after launch, so the +combo's 28 s clock ran out on setup. The app now starts that combo's clock +and pose once the scene is attached; every other combo starts as before. +A separate run on the after build with that change, skia alternating: + +`node bench/run.mjs --engines tgfx,skia --scenes anim-imp --order alternate --reps 2 --gap 10 --cool 0.95 --cool-timeout 240` + +| | tgfx | skia | +|---|---|---| +| surface, present FPS | 13.6 (13.9, 12.5, 14.1, 13.4) | 59.4 (64.3, 54.6) | +| texture, present FPS | 5.0 (4.8, 4.5, 5.3, 6.8) | 22.3 (24.6, 20.0, 24.0, 20.6) | +| UI thread | 98 % | 95-97 % | +| PSS | 1119 / 1147 MB | 345 / 388 MB | +| Native | 565 MB | 123 MB | + +Both engines are UI-thread bound; tgfx's one worklet writing 5,000 handles +per frame is 4.4x slower than skia recording a picture. `TgfxRender` sits at +61-66 %. skia's SurfaceView combo logged one window per run; the table above +keeps the matrix's 53.2 and 23.2 for skia. The tgfx combos ran at thermal +status 1 with the CPU cap at 68-72 %. Raw output in the raw file. ## Conditions diff --git a/docs/content/docs/performance.mdx b/docs/content/docs/performance.mdx index 1f202a7..2df9af7 100644 --- a/docs/content/docs/performance.mdx +++ b/docs/content/docs/performance.mdx @@ -24,7 +24,7 @@ Against react-native-skia 3.10.0 on a Samsung SM-E146B (Exynos 1330, Android | 10,000 paths | **21.8** | 10.3 | **20.4** | 10.1 | | 6,000 texts | **73.1** | 32.2 | **66.0** | 30.4 | | 5,000 shapes, each animated (declarative) | 24.3 | **31.4** | 11.9 | 9.8 | -| 5,000 shapes, each animated (imperative) | not measured | 53.2 | not measured | 23.2 | +| 5,000 shapes, each animated (imperative) | 13.6 | **53.2** | 5.0 | **23.2** | The method and raw runs are in [`apps/benchmark`](https://github.com/margelo/react-native-tgfx/tree/main/apps/benchmark).