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

Delay dictionary realization when it's enumerated #34

Merged

Conversation

dahlia
Copy link
Contributor

@dahlia dahlia commented Nov 13, 2020

Continued from #34. This make latency short when a Dictionary having unrealized internal pairs is enumerated. The solution is to delay its realization and just enumerate its internal key–value pairs. One trick here I used to avoid key duplication (note that unrealized keys don't guarantee their uniqueness) is simply comparing with the key from the previous iteration. This trick works because the enumeration is done after keys are sorted first.

Before:

Loading 50 files (102.26 MB = 102257499 bytes)...
Loaded 50 files.
Loading	00:00:00.1598300
Codec	00:00:15.4054540
Total	00:00:15.5652840

After:

Loading 50 files (102.26 MB = 102257499 bytes)...
Loaded 50 files.
Loading	00:00:00.1722320
Codec	00:00:08.1198900
Total	00:00:08.2921220

@dahlia dahlia requested review from moreal and a team November 13, 2020 10:18
@dahlia dahlia self-assigned this Nov 13, 2020
@dahlia dahlia requested review from earlbread, riemannulus, limebell and longfin and removed request for a team and earlbread November 13, 2020 10:18
Copy link
Contributor

@moreal moreal left a comment

Choose a reason for hiding this comment

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

👍

@dahlia dahlia merged commit 1e890b6 into planetarium:master Nov 16, 2020
dahlia added a commit to dahlia/libplanet that referenced this pull request Nov 16, 2020
dahlia added a commit to dahlia/libplanet that referenced this pull request Nov 16, 2020
moreal pushed a commit to moreal/libplanet that referenced this pull request Nov 17, 2020
moreal pushed a commit to moreal/libplanet that referenced this pull request Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants