Skip to content

Commit 0f274d1

Browse files
authored
Update MPSC_queue.hpp
Add branch prediction `DAKING_UNLIKELY` for empty bulk operation.
1 parent 1d0ea58 commit 0f274d1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/daking/MPSC_queue.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace daking {
486486
DAKING_ALWAYS_INLINE void enqueue_bulk(const_reference value, size_type n) {
487487
// N times thread_local operation, One time CAS operation.
488488
// So it is more efficient than N times enqueue.
489-
if (n == 0) {
489+
if (n == 0) DAKING_UNLIKELY {
490490
return;
491491
}
492492

@@ -514,7 +514,7 @@ namespace daking {
514514
"Iterator must be at least input iterator.");
515515
static_assert(std::is_same_v<typename std::iterator_traits<InputIt>::value_type, value_type>,
516516
"The value type of iterator must be same as MPSC_queue::value_type.");
517-
if (n == 0) {
517+
if (n == 0) DAKING_UNLIKELY {
518518
return;
519519
}
520520

0 commit comments

Comments
 (0)