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

Feature/variables optimization #673

Merged
merged 3 commits into from Sep 20, 2021
Merged

Conversation

ziflex
Copy link
Member

@ziflex ziflex commented Sep 20, 2021

  • Loops containing RETURN NONE return empty arrays now (almost zero-allocation)
  • Variables having _ name are ignored and do not get allocated to scope/stack.

if f.distinct {
// We need to check whether the value already exists in the result set
hash := value.Hash()
_, exists := f.hashTable[hash]
Copy link
Member

Choose a reason for hiding this comment

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

f.hashTable has type map[uint64]bool and value always true, so this can be rewritten as

if f.hashTable[hash] {
    return
}

Copy link
Member Author

Choose a reason for hiding this comment

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

what if a key does not exist?

Copy link
Member

Choose a reason for hiding this comment

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

If the key does not exist f.hashTable[hash] returns default value for bool which is false

@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #673 (886a706) into master (0c4a18c) will decrease coverage by 0.2%.
The diff coverage is 11.5%.

❗ Current head 886a706 differs from pull request most recent head 0d3403a. Consider uploading reports for the commit 0d3403a to get more accurate results

@@           Coverage Diff            @@
##           master    #673     +/-   ##
========================================
- Coverage    35.9%   35.7%   -0.2%     
========================================
  Files         349     351      +2     
  Lines       12621   12706     +85     
========================================
+ Hits         4531    4536      +5     
- Misses       7656    7734     +78     
- Partials      434     436      +2     

@ziflex ziflex merged commit b3c19bf into master Sep 20, 2021
@ziflex ziflex deleted the feature/variables-optimization branch September 20, 2021 18:45
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.

None yet

2 participants