0xMiden / 0xMiden/protocol

Optimize AccountCode equality comparison performance

Offen
#2,429 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
132
Forks
167
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
110

Beschreibung

The PartialEq implementation for AccountCode compares the entire MastForest, which is slow for large code structures.

Since commitment uniquely identifies the account code (and is already used for Ord), we should use it for equality checks instead of comparing the full MastForest.

Current code:

`self.mast == other.mast && self.procedures == other.procedures`

Expected change:

Compare by commitment and procedures instead of mast and procedures.

There's already a TODO comment in the code suggesting this optimization (line 234). This should improve performance without changing correctness, since commitment is deterministic and uniquely identifies the code interface.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.