-
Notifications
You must be signed in to change notification settings - Fork 158
Speed up version_chain benchmarks setup_cache #2833
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
Conversation
|
Nice idea to speed it up. |
python/benchmarks/version_chain.py
Outdated
|
|
||
| adb._ext.unset_config_int("VersionMap.ReloadInterval") | ||
| shutil.rmtree("version_chain_deleted", ignore_errors=True) | ||
| shutil.copytree("version_chain", "version_chain_tail_deleted") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're removing version_chain_deleted but copying to version_chain_tail_deleted.
Maybe add constants for directory names so it's harder to make such error:
DIR_UNDELETED = "version_chain"
DIR_TAIL_DELETED = "version_chain_tail_deleted"
CONNECTION_STRING_UNDELETED = f"lmdb://{DIR_UNDELETED}"
CONNECTION_STRING_TAIL_DELETED = f"lmdb://{DIR_TAIL_DELETED}"
python/benchmarks/version_chain.py
Outdated
| assert len(lib.list_versions(symbol)) == num_versions - deletion_point | ||
|
|
||
| adb._ext.unset_config_int("VersionMap.ReloadInterval") | ||
| print("IterateVersionChain: Setup cache took (s) :", time.time() - start_time, file=sys.stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We're printing the time two times. Here and in setup_cache. Maybe just keep one?
| if deleted: | ||
| ac = Arctic(IterateVersionChain.CONNECTION_STRING_UNDELETED) | ||
| else: | ||
| ac = Arctic(IterateVersionChain.CONNECTION_STRING_TAIL_DELETED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe if and else should be the other way round?
python/benchmarks/version_chain.py
Outdated
| assert len(lib.list_versions(symbol)) == num_versions - deletion_point | ||
|
|
||
| adb._ext.unset_config_int("VersionMap.ReloadInterval") | ||
| print("IterateVersionChain: Setup cache took (s) :", time.time() - start_time, file=sys.stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Also remove the corresponding start time
The setup_cache creates two libraries, one with the tail of the version chain deleted. We used to write both libraries with Arctic APIs.
I change it here to write most of the versions of one library with Arctic APIs, up to the point where we want to delete the symbol, then copy that state with
shutil.copytree. This roughly halves the amount of time spent insetup_cache, from ~17 minutes down to ~8 on my machine.I also change the benchmarks to control their number of runs with
sample_timerather thannumber. The high number was introduced for some benchmarks that run very quickly and so are noisy, but doing that across all the benchmarks isn't suitable as others are slow and stable.