You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
routerA.attach(/foo, routerB);
routerB.add('/bar', o);
routerA.lookup('/foo/bar'); // <-- should this be possible?
This is very easy to support for dynamic routes due to shared trie nodes (and kind of difficult to avoid). I wonder if the static route optimization carry its weight enough to complicate this scenario.
I'll rework the logic so that all routes are maintained in the trie (making attach easy).
Static routes will still benefit from lookup in a HashMap, but this will now be constructed lazily on lookup, so that it will be correctly populated after an attach operation. This means that the first lookup will always hit the trie.
Activity
nielsenko commentedon May 9, 2025
I'll rework the logic so that all routes are maintained in the trie (making attach easy).
Static routes will still benefit from lookup in a HashMap, but this will now be constructed lazily on lookup, so that it will be correctly populated after an attach operation. This means that the first lookup will always hit the trie.