Standard-Toolkit icon indicating copy to clipboard operation
Standard-Toolkit copied to clipboard

[Feature Request]: Use `Span<>` for all `foreach` loops

Open PWagner1 opened this issue 3 years ago • 2 comments

As part of .NET 7, it is recommended to use Span<> instead of foreach, as it's generally faster.

PWagner1 avatar Nov 27 '22 07:11 PWagner1

Vote for this one! Thank you! Span<> should become a standard in .NET, but many are still using IEnumerable<> interface (myself included :) It's hard to get use to it after so many years. Recently I updated one of my very old parsers which usually has to process billions of lines from multiple sources. After adapting code to ReadOnlySpan<> I measured over 50% perf. improvement and significantly less pressure on heap and GC activity (due to Span is always on stack). I wanted to add this request myself then I saw yours post :) Cool ! Thnx!

dax-leo avatar Dec 17 '22 22:12 dax-leo

The "Number of loops" in Krypton is rather small, and the updating of the UI takes a lot more CPU than using span on small loops. What takes most of the time is using the vtable lookup's for the colours

Smurf-IV avatar Jul 07 '24 08:07 Smurf-IV

The "Number of loops" in Krypton is rather small, and the updating of the UI takes a lot more CPU than using span on small loops. What takes most of the time is using the vtable lookup's for the colours

Closing.

giduac avatar Oct 26 '24 18:10 giduac