mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 16:37:32 +00:00
Session::execute asked about a command's params description several times per command (the key check, whether `id` stands for `ids`, whether it takes `ids`), and each question parsed the description again, with a command lookup for each word after the first of each `…` entry. The engine now reads every built-in description, and the ones its `…` entries name, once into a table keyed by the description's address and length, and answers accepted_keys, takes_key, id_stands_for_ids and check_keys from it. A plug-in command's description, and a built-in description whose `…` entries name a plug-in command, are still parsed where they are used, since plug-ins change while the app runs. The keys, answers and error messages are the same; tests::params_cache compares them for every built-in command against a fresh parse. In a release build on a one-object document, object.move with ids and dx takes 48 us of thread CPU time per command instead of 61 us, and select.set with ids 2.3 us instead of 3.2 us (medians of 7 alternating runs of 20,000 commands in one process, while other builds were running; tests::params_cache::bench_params_keys_once). The time is saved per command, in scripts, batches and MCP or plug-in call loops, and does not grow with the size of the document.