Skip to content

Commit

Permalink
GH-525 cache constants and GH-526 query optimizer (#527)
Browse files Browse the repository at this point in the history
* GH-526 add test

* improve how query explanation is transmitted and displayed to the user and move from node-sass to sass

* GH-525 cache getNobjects and capacity

* GH-526 update VariableToIdSubstitution to optimize at the StatementPattern level
  • Loading branch information
hmottestad authored Nov 28, 2024
1 parent 535eeab commit d19359b
Show file tree
Hide file tree
Showing 8 changed files with 11,848 additions and 7,259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,19 @@ public long getNpredicates() {
return predicates.getNumberOfElements();
}

long cachedNobjects = -1;

@Override
public long getNobjects() {
return getNshared() + nonTyped.getNumberOfElements()
if (cachedNobjects != -1) {
return cachedNobjects;
}

long l = getNshared() + nonTyped.getNumberOfElements()
+ languages.values().stream().mapToLong(DictionarySection::getNumberOfElements).sum()
+ typed.values().stream().mapToLong(DictionarySection::getNumberOfElements).sum();
cachedNobjects = l;
return l;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,17 @@ public void order(ByteOrder order) {
/**
* @return the capacity of the big buffer
*/

long capacity = -1;

public long capacity() {
return buffers.stream().mapToLong(CloseMappedByteBuffer::capacity).sum();
if (capacity != -1) {
return capacity;
}

long sum = buffers.stream().mapToLong(CloseMappedByteBuffer::capacity).sum();
capacity = sum;
return sum;
}

private int getBufferOffset(long index) {
Expand Down
Loading

0 comments on commit d19359b

Please sign in to comment.