Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Ensure the behavior of Map is deterministic #259

Merged
merged 3 commits into from
Dec 11, 2019
Merged

Conversation

erikzhang
Copy link
Member

No description provided.

public TValue Value;
}

private class InternalCollection : KeyedCollection<TKey, TItem>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the faster one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the code from https://github.com/neo-project/neo/blob/master/src/neo/IO/Caching/OrderedDictionary.cs

It is deterministic. We need it in VM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to use SortedDictionary, but we can do benchmark later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SortedDictionary will sort the keys, which is not needed for us, and there will be additional overhead. We just need to arrange the items in the order they were added.

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do benchmark later, but the changes are good

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

Successfully merging this pull request may close these issues.

None yet

2 participants