summaryrefslogtreecommitdiff
path: root/scripts/cli
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-08-29 09:04:05 +0000
committerChristian Breunig <christian@breunig.cc>2026-08-30 13:40:44 +0200
commitde81311ce99e1ce8776ac809c336726ad68d6751 (patch)
tree9ff0e209dc773f1e624ff134a27e63ef8d07f942 /scripts/cli
parent6c80440b0711b8f1e0a713df4f097ab1902163cd (diff)
downloadvyos-1x-de81311ce99e1ce8776ac809c336726ad68d6751.tar.gz
vyos-1x-de81311ce99e1ce8776ac809c336726ad68d6751.zip
configtree: T9261: bind libvyosconfig once instead of per ConfigTree
Every ConfigTree re-opened libvyosconfig with cdll.LoadLibrary and re-declared all 31 function prototypes inline in __init__. DiffTree and the twelve module-level helpers repeated the pattern per call, and since a DiffTree builds six further trees internally, a single one performed seven dlopens and roughly 200 argtypes/restype assignments. referencetree.py had its own copy. Declare the prototypes once in a _PROTOTYPES table and hand out an lru_cache'd wrapper keyed on libpath. Symbols are resolved on first use rather than up front, because not every build of the library exports every entry point and the previous code only failed on symbols actually called. referencetree.py shares the cache and picks up LIBPATH from configtree, so it now honours the /tmp/libvyosconfig/_build development path instead of hardcoding the install path. ConfigTree() 72.3 -> 6.3 us (-91%, 11.5x) DiffTree() 397.3 -> 34.7 us (-91%, 11.4x) Two prototypes were wrong and are fixed by declaring them in one place. validate_tree_filter had no restype, so ctypes defaulted to c_int and truncated the returned tree pointer to 32 bits before ConfigTree(address=...) saw it; harmless while the heap stays below 4 GB, corrupt above it. get_subtree declared two argtypes but is called with three, leaving with_node unchecked.
Diffstat (limited to 'scripts/cli')
0 files changed, 0 insertions, 0 deletions