Skip to content

lv2, qualcost: a repeat lookup reads one manifest and lists no directory again - #359

Merged
linuxnow merged 1 commit into
mainfrom
perf/locate-cache
Nov 1, 2026
Merged

linuxnow merged 1 commit into
mainfrom
perf/locate-cache

Conversation

@linuxnow

@linuxnow linuxnow commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

The daemon's share of an own LV2 add on the Pi (job 11, add cut a). Strace of three own adds of ZamComp on the real world showed, per add:

  • up to three walks of the LV2 path's manifests, in directory order: about 1.4 ms for a plugin found early, much more for one found late (gx_reverb's own add 96 ms against about 72 for the others);
  • a listing of the qualification directory (3664 files) and a JSON parse of the plugin's records: about 3 ms.

Now a bundle that holds the plugin's binary is remembered and checked with its one manifest on each lookup. A bundle that moved or no longer holds the plugin is walked for again. A bundle that only names the plugin (a GUI bundle) is never remembered, so a binary installed later still wins. Records are remembered with the directory's time and each file's time and size.

Red first, locally in the worker image: test-proc failed 'found again with one manifest read' (1 failed), qualcost-test failed 'a repeat read lists and parses once' (1 of 14). Both are green with the change.

Sabotage, each guard broken alone:

  • the memo's manifest check removed: 3 proc checks red (moved bundle, bundle no longer naming the plugin, read count);
  • the record file-time check removed: 'rewritten in place' red;
  • the directory-time check removed: 'a record added' red.

Pi before/after numbers follow in a comment. Console gain: the console's daemon adds LV2 plugins through the same lookup, and its scene loads add many at once.

@linuxnow

linuxnow commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Pi 5, Zynthian vangelis, real LV2 world (1336 plugins), private dummy JACK server at 48000/256. Own LV2 adds through the daemon: a fresh daemon per run, four adds (the first, then three more), three runs, medians in ms. Installed 0.15.7 against this branch built on the Pi.

plugin 0.15.7 first 0.15.7 next this branch first this branch next
ZamComp 53 69 53 59
ZamEQ2 53 69 53 59
MVerb 62 75 58 64
Invada compressor stereo 64 75 58 64
x42 fil4 stereo (found late in the walk) 78 91 70 59

On 0.15.7 the later adds cost more than the first: from the second add the daemon also lists the qualification directory and parses the records. That is gone, and a plugin found late in the walk no longer pays the walk on each add.

…ory again

The daemon looks a plugin's bundle up on every add, up to three times, by
walking the search path's manifests in directory order; on a Zynthian that is
hundreds of manifests for a plugin found late. A bundle found holding the
binary is remembered and checked again with its one manifest; a bundle that
moved or no longer holds the plugin is looked for again, and a bundle that only
names it is never remembered, so a binary installed later still wins.

Its qualification records were found by listing the directory (thousands of
files on a Zynthian) and parsed on every read. They are remembered with the
directory's time and each file's time and size: a record replaced, rewritten in
place or added is read as before.

Red first: proc_test and qualcost_test counted the manifests read and the
directory listings and parses of a repeat lookup, and failed on the walk.
@linuxnow
linuxnow merged commit 609bdec into main Nov 1, 2026
26 of 30 checks passed
@linuxnow
linuxnow deleted the perf/locate-cache branch November 1, 2026 02:50
@linuxnow linuxnow mentioned this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant