←back to thread

201 points olvy0 | 3 comments | | HN request time: 0.001s | source
Show context
EVa5I7bHFq9mnYK ◴[] No.41879253[source]
It's a shame, actually, that .NET performance improvements of up to x1000 could still be found after two decades and hundreds of millions spent on development.
replies(2): >>41879332 #>>41879654 #
eknkc ◴[] No.41879654[source]
Most of the time, it is not because there were too many slow things to be improved, it is mostly because they are adding more facilities to the runtime, enabling other performance improvements.

For example, the ReadOnlySpan type is a recent addition to the runtime and it will allow faster iterations when used. They simply enabled Linq to use it now.

replies(1): >>41880338 #
EVa5I7bHFq9mnYK ◴[] No.41880338[source]
ReadOnlySpan is a breakthrough innovative data structure, consisting of a pointer and a _length, that took Microsoft Corporation two decades to invent.

Well, better late than never.

replies(2): >>41880387 #>>41883634 #
neonsunset ◴[] No.41880387[source]
other languages do not have special pointers that can point to GC object interiors, be transparently addressed with arithmetics and cooperatively updated by GC without pinning, while also allowing to point to stack and unmanaged memory
replies(2): >>41880551 #>>41880632 #
EVa5I7bHFq9mnYK ◴[] No.41880551[source]
I see, thanks. Still, x1000 performance improvement is called a bug fix.
replies(1): >>41884307 #
1. neonsunset ◴[] No.41884307[source]
I encourage you to read through this section: https://devblogs.microsoft.com/dotnet/performance-improvemen... and go through the pull requests that it references.

The Nx elements figure is a speedup you would expect if you introduce a shortcut to any algorithm that can bypass doing full iteration, and >100x speed-up is what you would expect from going from interface dispatch per element (even if devirtualized behind a guard) to a bespoke vectorized implementation.

Even if you happen to have irrational dislike of .NET, this is still useful learning material and perfectly applies to other languages that expose similar functionality (provided they have sufficiently good type system and generics).

replies(1): >>41904122 #
2. EVa5I7bHFq9mnYK ◴[] No.41904122[source]
An algorithm that performs a full iteration where a single lookup is sufficient, is a very bad algorithm. An iterator implementation that introduces 100x overhead is a very bad implementation. C++ has types and generics and pipes and is pretty efficient.
replies(1): >>41908714 #
3. neonsunset ◴[] No.41908714[source]
C++ is absolutely terrible at this, either UX or performance (or sometimes both), and it's not even close ;)