This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Avoid some clone when creating keys to use in StorageMap methods #1876
Labels
I9-optimisation
An enhancement to provide better overall performance in terms of time-to-completion for a task.
Milestone
When we create a StorageMap with a tuple for example
(T::AccountId, u64)
here in substrate kitties then to use it we often need to clone AccountId (it doesn't implements Copy) like hereIn this example it is not an issue as AccountId is meant to be an integer such as u64 and clone it is probably same cost as referencing it.
But in other situation it could be an issue. I don't know if such situations exist though (long key that shouldn't be cloned, (caching there encoding, I don't know)).
A solution I have in mind for that is using a trait SameEncodingAs as such:
a partial implement is then (based on ebe4c97):
The text was updated successfully, but these errors were encountered: