Skip to content

Improve LedgerSnapshot lookup and update efficiency #1781

Description

@mootz12

What problem does your feature solve?

LedgerSnapshot is used extensively in contract testing. Currently, entries are accessed and updated linearly. This is particularly expensive when a large set of entries is being updated in a large snapshot using update_entries.

  • Slow CI — integration test suites that call env.ledger().snapshot() / update() across many contract invocations with large snapshots degrade non-linearly.
  • Developer experience — no indication of why tests slow down as snapshot size grows.
  • Fuzz / property testing — fuzzing harnesses that feed large generated snapshots can experience CPU saturation.

What would you like to see?

Accessing and updating ledger entries via a snapshot does not depend on the size of the snapshot, using something like HashMap or IndexMap.

What alternatives are there?

Leave it as-is. As long as snapshots remain reasonable in size, this is not really an issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions