Firstly, change add_definition function to return whether the
definition has been added or it already existed in the map. This
avoids double map lookup in places which conditionally add component
definitions.
Secondly, use the check consistently in all places so that component
definitions aren’t processed unnecessarily.
NOTE: formally, this is a breaking change, as borsh-derive with this change of version, say, 1.2.0 won't be compatible with borsh1.1.0. Hopefully, tilde version requirement adresses this problem.
Firstly, change add_definition function to return whether the definition has been added or it already existed in the map. This avoids double map lookup in places which conditionally add component definitions.
Secondly, use the check consistently in all places so that component definitions aren’t processed unnecessarily.
NOTE: formally, this is a breaking change, as
borsh-derive
with this change of version, say,1.2.0
won't be compatible withborsh
1.1.0
. Hopefully, tilde version requirement adresses this problem.