It might provide a performance boost if we add methods to Scan that are manually specialized methods of existing calls from the collect method.
Right now we can't make the trait method scan generic over any closure without violating object safety. That means scanning an object requires potentially many indirect calls to the trait object closure. (This also inhibits optimizations I believe.) If for every collector call to scan we added a method scan_??? that had the closure manually inlined for that call, we might be able to get a perf boost.
This is a big readability/performance tradeoff imo.
It might provide a performance boost if we add methods to
Scanthat are manually specialized methods of existing calls from thecollectmethod.Right now we can't make the trait method
scangeneric over any closure without violating object safety. That means scanning an object requires potentially many indirect calls to the trait object closure. (This also inhibits optimizations I believe.) If for every collector call toscanwe added a methodscan_???that had the closure manually inlined for that call, we might be able to get a perf boost.This is a big readability/performance tradeoff imo.