Host-value protocol dispatch (a protocol extended to Number/String/… called on a host value) recomputed the candidate type-tag list and walked the registry — up to ~15 map lookups plus an array alloc — on every call. It now caches (most-specific-host-tag, protocol, method) -> fn, guarded by a registry generation that bumps in register-protocol-method; re-extending a protocol invalidates the cache. The single-lookup fast paths (deftype protocol dispatch, direct multimethod dispatch) are untouched — they're already cheap, so no cache overhead there. The multimethod hierarchy-fallback cache (narrower: only derive-based dispatch) is deferred. Test in test/integration/dispatch-cache-test.janet covers correctness under re-extension in all three modes. Conformance 218/218; battery 3916. |
||
|---|---|---|
| .. | ||
| integration | ||
| spec | ||
| support | ||
| unit | ||