Skip to content

Use compare_exchange_weak in steal loop for potential performance imp…#3285

Open
xin-ok wants to merge 1 commit intoapache:masterfrom
xin-ok:optimize/change_cas_weak
Open

Use compare_exchange_weak in steal loop for potential performance imp…#3285
xin-ok wants to merge 1 commit intoapache:masterfrom
xin-ok:optimize/change_cas_weak

Conversation

@xin-ok
Copy link
Copy Markdown

@xin-ok xin-ok commented May 4, 2026

What problem does this PR solve?

Issue Number:

Problem Summary:
在 WorkStealingQueue 的 steal 函数中,使用 compare_exchange_strong 在循环中重试。
由于已经在 do-while 循环中,改用 compare_exchange_weak 可以获得更好的性能,
同时保持语义正确

What is changed and the side effects?

Changed:

  • _top.compare_exchange_strong 改为 _top.compare_exchange_weak
  • 保持其他逻辑不变

Side effects:

  • Performance effects:
  • Breaking backward compatibility:

Check List:

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.

1 participant