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

Use "unlikely" with Ensure #6648

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

mkindahl
Copy link
Contributor

@mkindahl mkindahl commented Feb 13, 2024

Since conditions used with Ensure are not expected to fire except in rare circumstances, we should always treat this as unlikely.

Disable-check: force-changelog-file

Since conditions used with `Ensure` are not expected to fire except in
rare circumstances, we should always treat this as unlikely.
@mkindahl mkindahl marked this pull request as ready for review February 13, 2024 12:29
Copy link

@jnidzwetzki, @svenklemm: please review this pull request.

Powered by pull-review

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cc26424) 80.05% compared to head (1eed282) 80.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6648      +/-   ##
==========================================
+ Coverage   80.05%   80.09%   +0.03%     
==========================================
  Files         190      190              
  Lines       37179    37133      -46     
  Branches     9450     9433      -17     
==========================================
- Hits        29763    29740      -23     
+ Misses       3001     2994       -7     
+ Partials     4415     4399      -16     

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

Copy link
Contributor

@nikkhils nikkhils left a comment

Choose a reason for hiding this comment

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

LGTM

@mkindahl mkindahl merged commit 1dc3efe into timescale:main Feb 13, 2024
50 of 51 checks passed
@mkindahl mkindahl deleted the ensure-use-unlikely branch February 13, 2024 14:32
jnidzwetzki added a commit to jnidzwetzki/timescaledb that referenced this pull request Feb 21, 2024
PR timescale#6648 introduces a branch prediction in the Ensure macro. However,
the checked condition needs to be negated to be unlikely. Therefore, the
check predicts the branch likelihood wrongly. In other words, reporting
an error in Ensure should be the unlikely case, and the condition should
be fulfilled in most calls. This commit fixes the branch prediction.
jnidzwetzki added a commit to jnidzwetzki/timescaledb that referenced this pull request Feb 21, 2024
PR timescale#6648 introduces a branch prediction in the Ensure macro. However,
the checked condition needs to be negated to be unlikely. Therefore, the
check predicts the branch likelihood wrongly. In other words, reporting
an error in Ensure should be the unlikely case, and the condition should
be fulfilled in most calls. This commit fixes the branch prediction.
jnidzwetzki added a commit that referenced this pull request Feb 22, 2024
PR #6648 introduces a branch prediction in the Ensure macro. However,
the checked condition needs to be negated to be unlikely. Therefore, the
check predicts the branch likelihood wrongly. In other words, reporting
an error in Ensure should be the unlikely case, and the condition should
be fulfilled in most calls. This commit fixes the branch prediction.
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

3 participants