shredder icon indicating copy to clipboard operation
shredder copied to clipboard

Explore manually specializing `Scan`

Open Others opened this issue 4 years ago • 0 comments

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.

Others avatar Aug 01 '20 06:08 Others