Skip to content

Improve Record#get(String key) complexity to O(1) #696

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

Merged
merged 2 commits into from
Apr 14, 2020

Conversation

zhenlineo
Copy link
Contributor

The previous impl gives O(n) complexity because of index lookup in keys list. As the API of two Record#get methods are so similar, it is a valid assumption that the performance of two methods shall be the same.
This PR introduces a lookup map to use one extra small space to improve Record#get(String key) complexity from O(n) to O(1).

The previous impl gives O(n) complexity because of index lookup in keys list. As the API of two Record#get methods are so similar, it is a valid assumption that the performance of two methods shall be the same.
This PR introduces a lookup map to use one extra small space to improve `Record#get(String key)` complexity from O(n) to O(1).
@zhenlineo zhenlineo linked an issue Apr 9, 2020 that may be closed by this pull request
@zhenlineo zhenlineo requested a review from gjmwoods April 9, 2020 13:22
@zhenlineo zhenlineo merged commit cc08efb into neo4j:4.0 Apr 14, 2020
@zhenlineo zhenlineo deleted the 4.0-record-get-with-key branch April 14, 2020 07:52
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.

InternalRecord using List#indexOf()
2 participants