Improve flatScheduleTask #3071
Labels
area/performance
Improvements to performance.
good first issue
Good for newcomers
kind/enhancement
Improvements to existing feature.
size/S
Small task. (A couple of hours of work.)
swift-nio has multiple implementations of
flatScheduleTask
which are all basically identical:Each of these is meaningfully different, e.g. in whether they take a deadline or a delay, or whether they require sendable closures and results.
@glbrntt has pointed out that the line
scheduled.futureResult.flatMap { $0 }.cascade(to: promise)
, which is common to all of them, is potentially suboptimal. A better implementation would be:We should change the implementations, and then confirm that we do actually see an allocation reduction from the change. Assuming we do, we can safely merge it.
The text was updated successfully, but these errors were encountered: