Skip to content
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

Deduplicate the "other sets" in a LocalVocab #1632

Merged
merged 10 commits into from
Dec 4, 2024

Conversation

RobinTF
Copy link
Collaborator

@RobinTF RobinTF commented Nov 21, 2024

Since #1524, lazy joins can produce LocalVocabs with many duplicate "other sets". These duplicates cannot be easily detected because they are stored in a std::vector. They are now stored as a absl:flat_hash_set instead. This may come with a small performance penalty when the size of this set becomes large. To be able to detect this, add the size of the set to the details of the runtime information.

Based on the suggestion from #1524 (comment)

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.58%. Comparing base (44e2ba8) to head (01388d3).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/engine/Operation.cpp 96.42% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1632      +/-   ##
==========================================
+ Coverage   89.57%   89.58%   +0.01%     
==========================================
  Files         381      381              
  Lines       36792    36818      +26     
  Branches     4170     4173       +3     
==========================================
+ Hits        32955    32983      +28     
+ Misses       2525     2522       -3     
- Partials     1312     1313       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will try this out(performancewise) on large knowledge graphs, other than that, there are only few minor changes remaining.

src/engine/LocalVocab.h Outdated Show resolved Hide resolved
Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spotted a bug...

src/engine/LocalVocab.h Outdated Show resolved Hide resolved
@hannahbast hannahbast changed the title Swap out vector with hash set for LocalVocab Deduplicate the "other sets" in a LocalVocab Nov 29, 2024
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobinTF Thanks a lot for this PR. I looked at it and discussed it with @joka921 . It is fine, with the following addition:

For operations with a non-empty local vocab, add the size_ and otherWordSets_.size() to the details of the runtime information. For example in the form local-vocab-size: {size_} [{otherWordSets_.size()}]. That way, it will not go unnoticed when the local vocab becomes large or complex.

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add another detail (see the comments).

runtimeInfo().addDetail("num-local-vocabs", numLocalVocabs);
size_t vocabSize = result.localVocab().size();
if (vocabSize > 1) {
runtimeInfo().addDetail("local-vocab-size", vocabSize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also want the number of non-local-vocabs that are merged together in the materialized local vocab here (if it is greater than >1), solocal-vocab-num-sets` would be a nice name here.

absl::StrCat(vocabStats.nonEmptyVocabs_, " / ",
vocabStats.totalVocabs_,
", Ø = ", vocabStats.avgSize(),
", max = ", vocabStats.maxSize_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the number of contained sets (similar statistics, max/avg) would be good to know here.

@sparql-conformance
Copy link

Copy link

sonarqubecloud bot commented Dec 3, 2024

@joka921 joka921 merged commit d6453be into ad-freiburg:master Dec 4, 2024
23 checks passed
@RobinTF RobinTF deleted the merged-vocab branch December 4, 2024 12:47
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.

3 participants