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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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.44%. Comparing base (82ccc51) to head (4e61b01).

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.43%   89.44%           
=======================================
  Files         375      375           
  Lines       36207    36233   +26     
  Branches     4081     4084    +3     
=======================================
+ Hits        32383    32407   +24     
- Misses       2510     2511    +1     
- Partials     1314     1315    +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.

@sparql-conformance
Copy link

Copy link

sonarcloud bot commented Nov 30, 2024

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.

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