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

Performance Optimization for Indicator Relations #48

Closed
b-scholz opened this issue Apr 1, 2016 · 2 comments
Closed

Performance Optimization for Indicator Relations #48

b-scholz opened this issue Apr 1, 2016 · 2 comments
Milestone

Comments

@b-scholz
Copy link
Member

b-scholz commented Apr 1, 2016

Example:

R(x) :- A(_), B(x). 

Transfer tuples from relation B to relation R if relation is not empty. Semantically, this can be interpreted as

R(x) :- size(A)>0, B(x). 

Souffle currently does not provide this optimization.

@kavorobyov kavorobyov added this to the 0.0.2 milestone Apr 23, 2016
@b-scholz b-scholz modified the milestones: 0.0.2, 1.1.0 Apr 26, 2016
@mmcgr mmcgr modified the milestones: 1.2, 1.1 Mar 30, 2017
@mmcgr mmcgr modified the milestones: 1.x, 1.2 Aug 18, 2017
@mmcgr
Copy link
Member

mmcgr commented Sep 21, 2017

Did this get worked on?
Currently the compiled version turns R(x) :- A(_), B(x). into

if (!rel_1_A->empty()) {
  for (const auto& env1 : *rel_2_B) {

Which seems to be what you describe.
I think the relevant parts of the code are

bool isExistCheck = !valueIndex.isSomethingDefinedOn(level);
for (size_t pos = 0; pos < atom->argSize(); ++pos) {
if (dynamic_cast<AstAggregator*>(atom->getArgument(pos))) {
isExistCheck = false;
}
}

and

souffle/src/RamExecutor.cpp

Lines 483 to 488 in 1392c67

if (scan.getRangeQueryColumns() == 0) {
// if scan is not binding anything => check for emptiness
if (scan.isPureExistenceCheck() && !rel.empty()) {
visitSearch(scan);
return;
}

@b-scholz
Copy link
Member Author

This has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants