Project's home: https://www.hexstreamsoft.com/libraries/trivial-jumptables/
trivial-jumptables provides efficient O(1) jump tables on supported
Common Lisp implementations and falls back to O(log(n)) on others.
Important optimizations are performed even on unsupported implementations,
notably "vectorization" which allows O(1) dispatch if all cases are constant.
This library is in the Public Domain.
See the UNLICENSE file for details.
If all branches can be determined to be constants at compile-time, then we can just eval all of them into a static simple-vector at compile-time, thus getting O(1) dispatch on all implementations.
There should also be a way to use a similar strategy if not all the branches are constant, but a certain threshold of the branches are (75%?). In that case, we do the O(1) dispatch into the simple-vector, and we get a distinguished value (e.g. a special private symbol) if that branch is not a constant, and then we proceed to distinguish among the non-constant cases with the main strategy.