Performance improvements related to best_effort_copy
#57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the
best_effort_copy
logic to do less copying. I noticed when running a large group of tests, that there was a substantial delay before testing actually started. Digging into it and randomly pausing during this period, I added whatever was being copied to a list to not copy until the time was reduced by quite a bit. The only exception seemed to be_request
which would result in errors after a couple reruns. Since_request
was a deep object, I added a code path for forcing a limited depth copy.It's been a while since I worked on this, but the background, if I remember correctly:
Testing the performance, the improvement is substantial. Using the tests in this repo as a reference:
The failing test invokes more logic, exception handling, and introspection (errors are slow...) so it taking longer makes sense in this case. I disabled the check logic and its getting 6.6 seconds. I wouldn't expect an initial run with the daemon to be faster than without, so its worth calling out this is curious behavior and may indicate something is not quite right.