In recent conversation I learned that some developers avoid and discourage the use of satisfies?
because of performance concerns. I was told to "just look at the implementation, you will sweat bullets".
The implementation in this case is in find-protocol-impl
which has to check metadata, traverse the inheritance chain as well as implemented interfaces.
The part of finding a protocol implementation for a specific class seems emminently cacheable, except for the fact that one can extend the protocol later on.
Would it make sense to cache this, and have extend-*
invalidate the cache? Or alternatively to have a flag (e.g. -J-Dclojure.cache-protocols=true
) for use in production where you know all protocol implementations will be loaded before lookups happen?