Live data from Hacker News

Performance Improvements in .NET Core

blogs.msdn.microsoft.com

61–70 of 94 posts

Re: Performance Improvements in .NET Core

#61

I wish they used benchmark.net for measuring performance. It can give much more trustworthy measurements for such microoptomizations.

This is mentioned in the post, in case you missed it:

> Further, normally such testing is best done with a tool like BenchmarkDotNet; I’ve not done so for this post simply to make it easy for you to copy-and-paste the samples out into a console app and try them.

We love BenchmarkDotNet and use it (and other perf tools) quite a lot internally.

Re: Performance Improvements in .NET Core

#62

Earlier quoted context omitted.

Skimming, but it doesn't look like these optimizations are relevant to .NET standard (which is a formal specification of a set of APIs - not a particular implementation.)

Correct. Performance improvements are out of the scope of the standard. Much like how the HTML spec doesn't tell Google and Microsoft how fast their browsers need to work.

[deleted]

Re: Performance Improvements in .NET Core

#63
The real problem for me is compatibility of NuGets with .NET core. I have so many which are just not compatible and many which have a slightly different Core variant with weird gotchas.

As such I've stuck with .NET 4.5 for now. On the positive side Mono seems to have got a lot better and I have a bunch of stuff running on Linux with surprisingly few problems "out of the box".

Re: Performance Improvements in .NET Core

#64

Earlier quoted context omitted.

It takes about 5 minutes to set up the dotnet CLI tools and get a "Hello World". If you don't even want to spend that you can install Visual Studio and .NET Core stuff will just work out of the box, as is customary for VS. Versioning and documentation is a mess, but neither you nor the grandparent seem to have actually made the minimal time investment necessary to even encounter those problems.

Yeah the problem isn't "hello world." It never is, it's building something with the tooling that works cross platform or that can be deployed to the platforms I want to target. That's much more than "hello world" and the important part. Perhaps you could make a useful comment next time instead of something plainly not?

Well, you literally said that it was useless and that you gave up before you began. Given that, I'd say that revelation's comment was pretty useful - explaining how you could quickly and easily get up and running with .NET. Perhaps you could tone down the hyperbole next time?

Re: Performance Improvements in .NET Core

#65

What's up with the memory consumption of C# .Net Core? It looks like it has dethroned Java as the memory bloat champion. http://benchmarksgame.alioth.debian.org/u64q/csharp.html

We haven't spent much time with those benchmarks. We looked at a couple of them and believe that there are better ways to write them in C# and get better results. That's not FUD but our findings. This is a great community activity. Clearly, the community is more than capable of performance enhancements, based on the improvements they have made in the product. If people start improving the C# benchmarks, please file a…

Are any of those discussions around better way to write the benchmarks public?

From a very quick look, something like http://benchmarksgame.alioth.debian.org/u64q/program.php?tes... looks like a direct port from a C program, rather than idiomatic C#.

Re: Performance Improvements in .NET Core

#66

Every time I try to get a quick feel of .NET on Linux, I allocate an hour to it and that hour is always spent wandering around various guides on microsoft.com and never getting anything done. There are terms like .NET Core, .NET Platform, .NET Framework, .NET SDK all mixed up on nearly every page, multiple versions of "Getting started" and "Quick start" guides, massive navigation menus and options on every page so yo…

I don't disagree with your point at all. Hopefully https://dot.net/core will become that. As @runfaster2000 says the team have taken the point on board and are working on it. However FWIW, I put together a C# on Linux Workshop for DevConf.cz earlier on in the year that might be useful for some folks https://github.com/martinwoodward/csharpworkshop - also includes links to the docs for building from source etc if you…

Thanks for that: https://github.com/dotnet/core/pull/326#issuecomment-2624791... is the clearest instructions for building from source* I've seen.

Note that that still seems to require an existing binary (the bootstrapping problem). I wonder if the Debian CLR people have seen this.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779970

Re: Performance Improvements in .NET Core

#67
post #18
post #7

I was expecting maybe 10% improvements, but many of these are 30x perf improvements on common collection operations

The List. Add change is small but its hand optimized assembly, quite impressive.

Worth noting it's not hand written assembly, but instead writing C# code in a very specific way in order to encourage the compiler to implement more aggressive optimizations (inlining, bounds check removals, etc).

Re: Performance Improvements in .NET Core

#68

Every time I try to get a quick feel of .NET on Linux, I allocate an hour to it and that hour is always spent wandering around various guides on microsoft.com and never getting anything done. There are terms like .NET Core, .NET Platform, .NET Framework, .NET SDK all mixed up on nearly every page, multiple versions of "Getting started" and "Quick start" guides, massive navigation menus and options on every page so yo…

Point taken. We have some improvements to make on this front.

One then that would have seriously helped me a few months ago, when I did a little project to learn some C# and write a command line tool using .NET Core would be a simple list of "using" statements that I'm likely to see in C# books and other documentation that are not available in Core (or that need configuration or settings changes to make work). (Or maybe the other way...a list of all "using" statements that work out of the box).

The command line tool I was trying to write was to read my Safari reading list on my Mac, and construct an HTML page that contains the same information that I could put on my website, where I could then access it from my Surface Pro. Apple provides a way to export the reading list in XML, so that was my input.

I don't remember what it was now, but my first approach used some XML stuff that I got out of examples from some recent C# book, and it worked fine in Visual Studio Community Edition on my Windows gaming machine. In Core, though, on my Mac (and on my Surface Pro and Windows gaming machine) it failed to build. It was not finding something I was trying to include via "using".

I was not able to figure out if that thing is simply not part of Core, or if some build setting somewhere has to be changed to make it available.

(I eventually changed my approach and dealt with the XML through LINQ instead of at a lower level, so that I no longer needed whatever it was whose "using" was giving me trouble, and successfully got access to my Reading List from my Surface Pro).

Re: Performance Improvements in .NET Core

#69

Earlier quoted context omitted.

We haven't spent much time with those benchmarks. We looked at a couple of them and believe that there are better ways to write them in C# and get better results. That's not FUD but our findings. This is a great community activity. Clearly, the community is more than capable of performance enhancements, based on the improvements they have made in the product. If people start improving the C# benchmarks, please file a…

Are any of those discussions around better way to write the benchmarks public? From a very quick look, something like http://benchmarksgame.alioth.debian.org/u64q/program.php?tes... looks like a direct port from a C program, rather than idiomatic C#.

Some of them seem to have some rules [1] like:

> Please don't implement your own custom "arena" or "memory pool" or "free list" - they will not be accepted.

> ...

> We ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.

So there might not be too much room to improve. There could be some room to improve for things like "custom ... memory pool" since .NET Core has ArrayPool [2] built-in. But I can't tell if the spirit of that rule is "don't implement pooling" vs. "you can only allocate memory in the standard ways provided by the runtime."

[1] http://benchmarksgame.alioth.debian.org/u64q/binarytrees-des...

[2] https://github.com/dotnet/corefx/blob/master/src/System.Buff...

Re: Performance Improvements in .NET Core

#70
post #4

Earlier quoted context omitted.

As .net core is a full rewrite, all these optimizations are .net core specific, so porting them isn't going to be a easy thing.

.NET Core is not a rewrite in any way. It's the same runtime with the same GC and JIT, same language compilers and mostly the same standard library. It has just been stripped down by removing deprecated features (such as code sandboxing / partial trust) and made support non-Windows platforms. You might have confused it with ASP.NET Core, the web development framework, which is a full rewrite.

You are right, i was confusing asp.net core with .net core.
Post reply on HN