Description
There are a lot of things we can do in the longer term to help this. We can split out the crates into multiple separate crates like psbt
, interpreter
, descriptor
and policy
. This would reduce the compilation time and memory usage by offering flexibility.
As pointed by benma , this is because we use a lot of generics. In particular, almost every single function is being monomorphized for each Ctx
.
There are 4 types of Contexts (Bare, Legacyp2sh, Segwitv0, Taproot) that are compiled for each descriptor method. One idea might be to define Terminal
without the Context. Guard Miniscript
with appropriate Context while in the constructor Miniscript::from_ast
. This should significantly reduce the code duplication and have a good impact on binary sizes.
Originally posted by @sanket1729 in #584 (comment)