* types/Coin: compile and reuse Regexps to reduce massive RAM+CPU burn
Fixes a resource (CPU+RAM) burn from recompiling Regexps which would
consume 1.2+MiB of RAM and 1.1ms per ParseCoin invocation, which means
that 1,000 invocations would consume 1.2GiB of RAM and >1second.
With the change, ParseCoin now takes 3.2us down from 1.1ms, with
dramatic results:
name old time/op new time/op delta
ParseCoin-8 1.04ms ± 4% 0.00ms ± 1% -99.69% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
ParseCoin-8 1.20MB ± 0% 0.00MB ± 0% -99.94% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ParseCoin-8 17.8k ± 0% 0.0k ± 0% -99.89% (p=0.000 n=10+10)
Fixes#7986.
* replace the CoinDenomRegex variable with SetCoinDenomRegex() (#7998)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>