Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate loaded value iterator for values loaded from storage #2707

Open
SupunS opened this issue Aug 9, 2023 · 1 comment
Open

Investigate loaded value iterator for values loaded from storage #2707

SupunS opened this issue Aug 9, 2023 · 1 comment

Comments

@SupunS
Copy link
Member

SupunS commented Aug 9, 2023

Current Behavior

As mentioned in the #2460 (comment), when a resource array is loaded from storage, all elements seem to be also 'loaded' every time.

Expected Behavior

It should not load the elements, unless elements are accessed explicitly.

Steps To Reproduce

Debug the IterateLoaded when running BenchmarkRuntimeResourceTracking test case.

Environment

- Cadence version: Stable cadence
@fxamacker
Copy link
Member

@SupunS

On a side note, I noticed that when the resource array is loaded from storage, all elements seem to be also 'loaded' every time (so they get iterated every time, during resource tracking). Not sure if it is due to the mocked 'test ledger' we are using for unit tests, or the expected behavior. cc: @fxamacker

It seems BenchmarkRuntimeResourceTracking uses testLedger for storage. And testLedger uses local map for data storage and retrieval.

Is it possible this might be a reason for elements being loaded every time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants