Skip to content

bug: workerStack's binarySearch - #278

Merged
panjf2000 merged 1 commit into
panjf2000:devfrom
callthingsoff:fix_binary_search_overflow
Jun 8, 2023
Merged

panjf2000 merged 1 commit into
panjf2000:devfrom
callthingsoff:fix_binary_search_overflow

Conversation

@callthingsoff

Copy link
Copy Markdown
Contributor

Avoid overflow when computing mid.

Avoid overflow when computing mid.

@panjf2000 panjf2000 left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Well, I didn't want to overthink the possibility of this calculation overflowing the int type when we introduced this implemention of binary search, because if that's case, the amount of goroutines in ants would be too significant and it's meaningless to use a goroutine pool like ants. But I guess it's also OK for ants to be finicky here.

panjf2000

This comment was marked as duplicate.

@panjf2000 panjf2000 added bug Something isn't working enhancement New feature or request optimization needs fix labels Jun 8, 2023
@codecov

codecov Bot commented Jun 8, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (9fdd99a) 92.45% compared to head (70eb6ad) 92.44%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #278      +/-   ##
==========================================
- Coverage   92.45%   92.44%   -0.01%     
==========================================
  Files           9        9              
  Lines         769      768       -1     
==========================================
- Hits          711      710       -1     
  Misses         44       44              
  Partials       14       14              
Flag Coverage Δ
unittests 92.44% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
worker_stack.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@panjf2000
panjf2000 merged commit 67b3a7a into panjf2000:dev Jun 8, 2023
@callthingsoff
callthingsoff deleted the fix_binary_search_overflow branch June 8, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request needs fix optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址