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.
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
Make sure that the ROOT writers enforce consistency for the Frame contents they write #513
Make sure that the ROOT writers enforce consistency for the Frame contents they write #513
Changes from 16 commits
fa7e96f
8fc5d81
9ecce26
ed99889
d470afb
e70375b
8c7f0ee
d0a87b5
38233df
9dbd135
7719acf
1d2766f
2342300
8be26e1
5d85991
af405fe
3cbcd14
6abff1d
c480c02
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 can use that
existingColls
is ordered, and maybe make a helper function for the comparison lambda, looks like it should be faster.Edit: Actually they are not sorted for the rntuple so this wouldn't work then without sorting them first
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.
I added the
binary_search
version to benchmarks1 I did before to see if a more involved approach works better for us. It looks like abinary_search
approach without lower-casing things is the best (depending on the number of collections). On the other hand, in most cases this check will probably exit simply because the two vectors have unequal size.Results with one vector orderd as we do in the ROOTFrameWriter (and the second one unordered). The numbers are the sizes of the vectors.
CompareLinear
is the current implementation,CompareBinary
andCompareBinaryLowerCase
usebinary_search
. The former one usesbinary_search(existingColls.begin(), existingColls.end(), id)
, the second one the proposal from above.Footnotes
Basically what the benchmark does is to select
N
collection names randomly from all the collection names that we collected during Make CollectionIDs a 32bit hash value of the collection name #412. This is done twice, in order to have vectors to compare. In this way the cheap check for the sizes is effectively always skipped and depending onN
the actual loop is executed at least a few times. The biggestN=512
in this case represents the worst case for the runtime as it will do the full N^2 of work. This is not entirely our use case, but it should represent sort of the worst case scenario. ↩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.
After some further checking it turns out that
binary_search
without taking into account thatexistingColls
are lexicographically sorted case insensitve doesn't work because the pre-conditions ofbinary_search
are broken. Hence, it looks likestd::find
and linear searching is still the way to go.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.
Just for documentation of our short internal discussion. Making the
binary_search
approach exit early in case the strings are of unequal sizes, speeds that up quite a bit and it becomes comparable in speed at 64 elements already and scales much better:Given that our happy path will always have to go through the complete vector to see whether the contents are the same, I have switched to this approach and also made sure that the collection names are sorted accordingly for the RNTuple writer.