[SR-15785] TaskGroup addTask is blocking with poor performance #58062
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
concurrency
Feature: umbrella label for concurrency language features
performance
standard library
Area: Standard library umbrella
swift 5.5
Environment
macOS 12.2, Xcode 13.2.1 and 13.3, 2020 i9 iMac, M1 Max MacBook Pro.
Additional Detail from JIRA
md5: cd628c72dea7e813640f5edee1597d34
Issue Description:
Attempting to enqueue many children, while quite easy with TaskGroup, is more than linear when you get into the tens of thousands. As a fundamental concurrency primitive, it would be beneficial if this performance could be improved.
Additionally, addTask seems to block the execution of children, letting memory balloon as the children are enqueued but aren't be executed.
Here's a simple example:
This code takes 35.6s to execute on a 2020 i9 iMac and, shockingly, 89s on an M1 Max MacBook Pro.
The text was updated successfully, but these errors were encountered: