4 ms·
What low level improvements in C# 7 do you mean? Ref returns, etc? Anything besides syntactic sugar?
by polskibus 9y ago
What low level improvements in C# 7 do you mean? Ref returns, etc? Anything besides syntactic sugar?
- oblio 9y agoMaybe these? https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md https://github.com/dotnet/corefxlab/blob/master/docs/specs/s...
- pjmlp 9y agoAll ref and struct related improvements up to the upcoming 7.3. The Span, Memory and related structures. SIMD improvements. As for syntax sugar, MSIL is expressive enough to fully support C++ semantics due to Managed C++ and C++/CLI, so it is quite nice if more such features get exposed at C# level, instead of forcing us to use C++/CLI.
- polskibus 9y agoSome of those like span are more of a library or jit features than language things. There is still a lot to be done to match C++, in the meantime syntax is getting uglier and uglier (I prefer const& to ref readonly). That's the problem when performance is being surfaced into language so late. In my opinion they should focus much more on being able to create zerocost abstractions than they do now. I'm waiting for a ref read-only that can be exploited for performance by jit. There are lots of things missing for performance like generics specialization or type classes. You have to go through box unbox inside typeof(T)==typeof(int) even though the type is fixed inside the if statement. I hope that shapes proposal is going to be worked on, however I doubt it's going to happen any time soon. I hope that c# and jit teams start working on harder things that will help c# dominate performance oriented software engineering in the future.
- pjmlp 9y ago> Some of those like span are more of a library or jit features than language things. Sure, C++ also has got its span and string_view as library. > There is still a lot to be done to match C++, in the meantime syntax is getting uglier and uglier ... Actually I find the opposite regarding syntax. Don't forget C# has roots on the Pascal/Algol family of languages, even if it the syntax is C like. For example Modula-3 also has the same REF and READONLY, just in caps. :) Type classes, well kind of nice, not really into them, given interfaces. Generics specialization is more a matter of improving the compilers (JIT/AOT). Here .NET Native might be interesting given that it uses the same backend as Visual C++. As for the rest, I never felt it was that slow and even with the current language semantics, Unity is quite confident that their new AOT compiler is able to take advantage of the HPC# subset (which still is 100% valid C#) to start moving C++ engine parts into C#.
- polskibus 9y agoWill regular .NET or .NET core be able to take advantage of HPC#?
- pjmlp 9y agoNo, it is a special AOT compiler (Burst) that is aware of Unity semantics and the C# subset. https://www.youtube.com/playlist?list=PLX2vGYjWbI0S8ujCJKYT-mIZf7YCuF-Ka https://www.youtube.com/playlist?list=PLX2vGYjWbI0S8ujCJKYT-... The talk "C# Sharp to Machine Code" contains the details how it works, while the other ones explain all the Unity engine pieces that are being moved from C++ into HPC#. .NET or .NET core benefit from this work, by the feedback Unity is giving back to Microsoft, as Miguel explained on his interview at Unity's booth.