From 5678e0ba37ce2c5c8161f0d48505e7993967e30c Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 20 Aug 2026 03:38:10 +0800 Subject: feat: add dispatch strategy features with auto-selection and benchmark support Add `dispatch_linear`, `dispatch_tree`, and `dispatch_phf` as mutually exclusive features for selecting the command dispatch strategy. When no strategy feature is enabled, an auto-selection heuristic picks the optimal strategy based on command table characteristics (size, name length, nesting depth). Add the `bench_support` feature to compile all three generators for the benchmark harness, and introduce `bench_cell!` to generate benchmark cells comparing strategies. The PHF generator uses a CHD minimal perfect hash for O(1) lookup independent of table size, while the trie generator was refactored to use a shared fallback method, keeping code size linear in table size. --- mingling_core/src/program/collection.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mingling_core/src') diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs index c571887..3ff065a 100644 --- a/mingling_core/src/program/collection.rs +++ b/mingling_core/src/program/collection.rs @@ -35,8 +35,10 @@ pub trait ProgramCollect { /// Dispatch the raw user arguments to an Entry. /// - /// The concrete matching strategy (trie or linear list) is generated by - /// `gen_program!` and selected by the `dispatch_tree` feature. + /// The concrete matching strategy (perfect hash, trie, or linear list) is + /// generated by `gen_program!` and selected by the `dispatch_phf` / + /// `dispatch_tree` / `dispatch_linear` features (mutually exclusive; + /// none = "auto", which picks the best strategy from the command table). /// /// # Errors /// -- cgit