-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use of exceptions for flow control in BlockStore sublasses cause tests (and maybe other things) to take approx 200x as long when debugging #564
Labels
Comments
drmason789
changed the title
Use of exceptions for flow control BlockStore sublasses cause tests (and probably other things) to take 100x longer when debugging
Use of exceptions for flow control BlockStore sublasses cause tests (and probably other things) to take approx 200x longer when debugging
May 30, 2021
drmason789
changed the title
Use of exceptions for flow control BlockStore sublasses cause tests (and probably other things) to take approx 200x longer when debugging
Use of exceptions for flow control in BlockStore sublasses cause tests (and probably other things) to take approx 200x longer when debugging
May 30, 2021
drmason789
added a commit
to drmason789/npoi
that referenced
this issue
May 30, 2021
…ly reduce time to debug tests.
drmason789
changed the title
Use of exceptions for flow control in BlockStore sublasses cause tests (and probably other things) to take approx 200x longer when debugging
Use of exceptions for flow control in BlockStore sublasses cause tests (and maybe other things) to take approx 200x longer when debugging
May 30, 2021
drmason789
changed the title
Use of exceptions for flow control in BlockStore sublasses cause tests (and maybe other things) to take approx 200x longer when debugging
Use of exceptions for flow control in BlockStore sublasses cause tests (and maybe other things) to take approx 200x as long when debugging
May 30, 2021
tonyqus
added a commit
that referenced
this issue
Aug 24, 2021
#564 avoidance of exceptions for flow control to substantially reduce time to debug tests
Why is help wanted? |
Sorry, I think this is a mistake after long-time delaying. I forgot this issue is fixed by the PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
B60D06DA-6A28-45F4-A074-94EC03A7C973.MP4
In the attached video, TestMetaDataIPI.TestFour and TestSix take 144ms and 110ms respectively when run.
When debugged, they take 25.3s and 28.9s respectively.
What's taking up all this time? When I do the crudest form of profiling, i.e. break and see what it's doing, I find it in implementations of BlockStore.CreateBlockIfNeeded.
This function is trying to get the block, creating a new one if an IndexOutOfBounds exception is thrown.
To mitigate this, introduce BlockStore.TryGetBlockAt(int offset, out ByteBuffer buffer) and make that avoid throwing IndexOutOfRangeExceptions, instead returning false when it can't find the block and true when it does.
This cuts the execution time of these tests down to about 40% of before.
Additionally, there is code in DirectoryNode.GetEntry that is catching a KeyNotFoundException and throwing a new, more informative exception when the key is missing. This exception handling can be avoided using _byname.TryGetValue(...).
This takes the test execution time down to about 20% of before.
The text was updated successfully, but these errors were encountered: