You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the profile, it pointed straight at the problem. Merged in #635 (875acefc) on main, not in a release yet.
Your reading was right: bitmap decoding ran on the main thread. Two parts to the change:
The decode is off the MainActor now. The overlay drainer plans and applies its results on the main thread and decodes in between on a background task. The PiP/AirPlay OCR worker was decoding the same packets a second time on the main thread; it now decodes off it too. The biggest batch came right after a subtitle selection or a seek, when the drainer backfills roughly 75 s of content in one go.
The bitmap conversion is about 4x cheaper.imageForSubtitleRect walked the full 1920x1080 plane pixel by pixel twice (crop bounds, then RGBA). It now resolves the palette once into a lookup table. Output is byte-identical.
Measured on an M1 with a full-canvas 1080p PGS set (the Blu-ray remux shape):
build
before
after
release
5.1 ms
1.3 ms
debug
215 ms
52 ms
One question: was the Time Profiler run on a Debug build of your app? Xcode builds Swift packages unoptimized in Debug, and that is roughly 40x slower on this loop. A Debug build fits your numbers much better than a Release one.
If you can re-run the same file against main, a before/after from your side would be great.
Released in 7.17.0 (875acefc). Bitmap subtitle display sets are now expanded off the main thread, both in the overlay drain and in the PiP/AirPlay OCR worker, and each bitmap is about 4x cheaper to convert. A retest on the title that showed the high CPU would settle it.
Activity
ijuniorfu commentedon Sep 25, 2026
Wouldn't it be better if PGS decoding didn't run on the main thread?
superuser404notfound commentedon Sep 25, 2026
Thanks for the profile, it pointed straight at the problem. Merged in #635 (
875acefc) onmain, not in a release yet.Your reading was right: bitmap decoding ran on the main thread. Two parts to the change:
imageForSubtitleRectwalked the full 1920x1080 plane pixel by pixel twice (crop bounds, then RGBA). It now resolves the palette once into a lookup table. Output is byte-identical.Measured on an M1 with a full-canvas 1080p PGS set (the Blu-ray remux shape):
One question: was the Time Profiler run on a Debug build of your app? Xcode builds Swift packages unoptimized in Debug, and that is roughly 40x slower on this loop. A Debug build fits your numbers much better than a Release one.
If you can re-run the same file against
main, a before/after from your side would be great.superuser404notfound commentedon Sep 25, 2026
Released in 7.17.0 (
875acefc). Bitmap subtitle display sets are now expanded off the main thread, both in the overlay drain and in the PiP/AirPlay OCR worker, and each bitmap is about 4x cheaper to convert. A retest on the title that showed the high CPU would settle it.ijuniorfu commentedon Sep 25, 2026
Thank you very much; it seems to be resolved. I'll let you know once I'm able to test it.
perf(subtitles): bound retained bitmap cue history by bytes (#879)