Lilv “Object Index” Option Revised
Posted on in Hacking, LAD, LV2, Lilv, RDFMy previous post, “Improving LV2 Discovery Performance”, described adding an option to lilv that controls whether an additional index is maintained for loaded LV2 data. While testing those changes for release, I discovered a few things (like lv2lint) that break without the index, which convinced me that disabling it by default wasn't the right decision.
So, I'm instead enabling it by default, which avoids this “break by default” situation.
The downside is that hosts will need to add code in order to enjoy the performance improvements.
To make this change as simple as possible, I also made lilv_world_set_option accept a null value to disable boolean options, so most hosts can simply add this line:
lilv_world_set_option(world, LILV_OPTION_OBJECT_INDEX, NULL);
This requires the new version, but the same change can be made without bumping the required version by avoiding the niceties:
LilvNode* false_node = lilv_new_bool(world, false);
lilv_world_set_option(
world,
"http://drobilla.net/ns/lilv#object-index",
false_node);
lilv_node_free(false_node);
This will log a warning about the unsupported option on older versions, but otherwise have no effect.