Closed POABOB closed 12 months ago
All modified lines are covered by tests :white_check_mark:
Comparison is base (
f0b98c3
) 94.08% compared to head (9a26314
) 94.43%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks!
name: Pull request about: Propose changes to the code title: 'make the code cleaner in worker_loop_queue.go and worker_stack.go' labels: '' assignees: ''
1. Are you opening this pull request for bug-fixs, optimizations or new feature?
refactor
2. Please describe how these code changes achieve your intention.
I noticed that the original code uses the
if
statement to determine if the queue is overflowing in worker_loop_queue.go. I think it can use themodulo
operator to make it cleaner.before
after
And there are two different calculation methods for binary search of the mid variable in worker_loop_queue.go & worker_stack.go. I think
l + ((r - l) >> 1)
is a better way.worker_loop_queue.go
worker_stack.go
Last, I think it can reuse the
isEmpty()
method to evaluate the condition below.before
after
3. Please link to the relevant issues (if any).
No
4. Which documentation changes (if any) need to be made/updated because of this PR?
No
4. Checklist