Open
Description
Summary:
Starting a continuation on one thread, and then firing the resume on another, when there is currently no other work being done, results in ~30 microseconds of overhead on Linux, as opposed to ~7 microseconds on macOS for the same benchmark, on the same hardware (Xcode 15 beta on macOS, Swift 5.8.1 on Linux).
Steps To Reproduce:
- See attached benchmark (uploaded as .txt to make GitHub happy):
- start continuation on one thread
- write the continuation into a pipe
- block on read in a detached task to resume
- Run the same benchmark on macOS and Linux and observe significantly different results.
Results:
I expected that performance for the two platforms would be vaguely in-line with each other, but the continuation resume step is significantly slower on Linux - a profile verified that it was continuation resumes and not the relative performance of pipes on the two platforms.
Notes:
Some of the latency appears to be caused by the use of pthread semaphores for signaling on Linux in libdispatch.
Tracking as rdar://113640087.