der: add `EncodeValueLenCached` wrapper
Sometimes, when encoding big DER structures, value_len gets called many times.
In order to limit amount of recursive calls, this wrapper caches the computed length, until the value gets encoded.
Using a newtype for this seems pretty heavy-handed. Perhaps there's an alternative solution that can reduce the number of calls?
Do you have a specific example of where this is problematic? Could those types handle caching the length themselves?
I don't have an example. This just seems to be reasonable, where PKCS#15 nests objects recursively (example) Actually, this newtype can be in a separate crate.
Closing as stale