diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2022-02-06 10:24:39 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2022-02-06 11:02:39 +0200 |
commit | 0197729949491a65c4c10dba673dbb9c8af04c67 (patch) | |
tree | 52cf6db100ca580e9f9e82378bc211d4dc6edfeb /options/parse_configfile.h | |
parent | 7849a36beb458985d1e8b15bd2706a6e084a5f33 (diff) | |
download | mpv-0197729949491a65c4c10dba673dbb9c8af04c67.tar.bz2 mpv-0197729949491a65c4c10dba673dbb9c8af04c67.tar.xz |
osc.lua: seekbar hover: speed-up chapter access
This speeds up chapter name access while hovering the seekbar:
- Fetch the chapter-list property using observation rather than on
every render while hovering the bar. Property access, especially
with potentially lots of values (chapters), can be expensive-ish,
and can involve locking, so the less per-render the better.
- Sort the list once (on change) to simplify the iteration logic when
searching the chapter which matches the mouse position. It's still
O(N) (no binary search currently), but with less work.
The cached sorted list is stored at the state. While there are other
places which access this property and could use this cache, for now we
don't touch them, because they're not performance-critical (on init
for the chapter markers, on ch_{prev,next} button click for OSD).
Caching properties using observation instead of using mp.get_property
can indeed speedup other places too, but it should be part of a system
rather than implemented per-property. Maybe some day.
Diffstat (limited to 'options/parse_configfile.h')
0 files changed, 0 insertions, 0 deletions