Skip to content
Discussion options

You must be logged in to vote

Try not to run code in an async main fn (or block_on), because code there cannot be work-stealing and will run slower.

Actually, the work-stealing or not doesn't matter for this topic as block_on always blocks the current thread. Work-stealing is an optimization which targets to worker thread. For example, there is an async task does AI reasoning running on a worker thread, this prevents the worker thread from executing async tasks in the local task queue. Work-stealing allow another idle worker threads steal tasks from other worker threads. However, thread who runs the block_on doesn't have the local task queue, so work stealing doesnt matter.

For multi thread runtime, since the thread…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AsenHu
Comment options

@ADD-SP
Comment options

ADD-SP Aug 1, 2025
Collaborator

@AsenHu
Comment options

Answer selected by AsenHu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants