Refactor FlowEpoch.getEpochMetadata
to avoid the dictionary-copy
#384
Labels
Improvement
Performance
SC-Eng
Issues that we want to see surfaced in SC-Eng ZH Board
Technical Debt
Issue To Be Solved
As mentioned in https://github.com/onflow/flow-core-contracts/pull/382/files/4aea8aa7057c43f7eaf4c8fdf1b08a50db7736b4#r1326279483, in the
getEpochMetadata
method, the reading of the metadata map from storage was changed from:To
Because, accessing the inner-object form the "borrow"ed map now returns a reference, where as the rest of the code-base has been written to work the dereferenced-object.
Suggest A Solution
However, this makes this operation very expensive, as it copies the entire map. To avoid this, we would need to either:
It would be good to go with the second option if possible, since that way we don't need to copy anything from the storage (not even the inner
EpochMetadata
object)The text was updated successfully, but these errors were encountered: