Apple M1 Vs Intel Core I9 And .Net Performance - First Look

  • 18-Apr-2022

In this corner, we've got the new lightweight, MacBook Air with the Apple Silicon m1 ship. And in this corner, weighs 850 pounds. Good. Boy, yeah, MacBook Pro pretty heavy. I don't usually do dot net tutorials here, and I've never done one before.

But why am I doing this? Now, this is actually a back end that I secretly use. Well, maybe not so secretly.

I love as the back end for my mobile applications and to build web applications on there. I've admitted it so net 5 just came out, and what better. Way to test it than to see how it works on the MacBook Pro versus the new m1 I'm going to be doing some performance tests, not really super scientific. But just to give you an idea of what the speeds are going to be like with a 64 gigabyte i9 processor. This monster, MacBook Pro from 2019, the 16 16-inch version versus just the wimpy little MacBook Air, which I have right here.

And just 16 gigs of ram with the m1 chip I'm really curious to find out. I haven't done the test, yet you will see it as well as. I will who is going to win, maybe there won't be a winner. So let's start things off by installing SDK. I don't have it installed on either one of these machines yet. So let's start off from the beginning. Here is dot download, and I'm going to grab SDK right here.

Now, this will give me the CLI, so I'll be able to execute net commands, build projects right from the command line. Let's, go ahead and save that, and I'm going to do the same thing on the MacBook Air as well. You can always search for net download on Google, which is what I did here, let's grab that download SDK, and I'm going to install it on. Both of these.

The installation is just pretty simple it's using a pkg, which just requires a double click and following some prompts now let's pop open the terminal on both of these, and we're going to do the dot net command. So dot net dash version, it's installed 5.0.101 dot net dash, dash version. Okay. So far so good, no winner, yet I'm going to go to my code. Directory and make a directory for net, same thing here and go into that directory.

Now, we're ready to kick things off, so there's, a couple of other things that I like to do for development environment. Now I usually use Visual Studio on Windows running in an emulator. I use parallels right now. I used to use VMWare fusion, but parallel seems to be a little better these days. But right now, neither of them are going to work on the new m1 chip, so we're going to be using Visual Studio code, which. Is also a really nice option since it has the c-sharp extension, which works beautifully I'm going to show you to you right now and how the whole process works, so we're going to create a brand-new project, botnet, new and let's call this one console, it's just going to create a console application.

So that we can easily test things all right? You know what I'm going to do that over because I actually want to test the speed of the creation process as well. So I'm going to clear things out. Okay, let's set. This up properly I'm going to create a brand-new project so net, new console, which is just going to create a brand-new console, application I'm going to do the same thing here, and I'm going to hit enter at the same time. So we see which one finishes faster.

Now I know that creating an application isn't, really something that we all care about, but still I'm really curious to see who wins. Interesting MacBook Pro is the clear winner on that one. It created the project much faster. Okay, fine let's open. This up in Visual Studio code and here's our project we have a dot net, cs project and a program.cs I'm going to pop open VS Code here as well.

Now, if you are interested in my video about VS Code and testing vs, code performance on these machines, check out that video I'll link to it up here somewhere as well, and I'll link to it down below. Now, I am running the regular version of VS Code that is being translated by Rosetta 2. Right now. I also have the insiders build there.

If I get strange performance. Issues with the m1 while testing this I'm going to also try this on the insider's build just to make sure it's nothing having to do with their translation layer. Now, I also like to install the c-sharp extension, so I'm going to go to extensions here search for c-sharp. And there it is right there, I'm going to install that one and Visual Studio, dark, that's, fine. Now VS Code is also telling me that required assets to build and debug are missing Should you add them?

And I think, yes, you should. Click, yes on that one, because what it's going to do is give you something really, really interesting. So if we take a look at the file system now you'll see that we have a new VS Code folder in there. And the VS Code folder has launch configurations as well as tasks that you can actually run and trigger from the command line. And this will tie into the debugger in Visual Studio codes, you'll, be able to trigger your debugging and attach to processes right from this tab right here in BS, code I'll, show.

You that in a minute let's do the same thing here, I'm going to go to my extensions and search for c sharp and install that one. And I can select the dark theme, it's, fine. Here it's also asking me. Do I want to install the missing assets?

And I want to say, yes here. Okay. So let's, check out our really simple program here that prints out hello world.

How do I run this two ways? One a simple way is gone to the terminal tab and right inside your program folder. You can issue. The command botnet run I'm going to do. The same thing here and then hit the enter key at the same time. So they run at the same time. We should be all set and ready to do this test right now.

I'm going to hit enter at the same time here to see what happens. Ready? One, two, three, ooh, the MacBook Pro is a clear winner here.

Hmm. I wonder if I run it, one more time, if I get the same results because there's probably some compilation that got saved MacBook Pro. It really is winning in this case, wow, by the way, the MacBook Air. I've been doing a lot of.

Testing on this, I've installed Xcode android studio. I ran simulators, and I have not yet even plugged in the charger it's still on the battery. The way I took it out of the box, and it hasn't died yet. It is pretty close to dying. And I wonder if that has anything to do with my test, maybe there's some throttling going on. I don't know, possibly this has to do with the version of Visual Studio code, I'm running. But I doubt that, is running through an emulation stage with Rosetta.

If you know, the. Answers to these questions I'm, just doing the tests here, if you know the answers to these questions, then please, let me know down below and everybody else can benefit as well. Now I am curious to run this test on the new VS Code exploration edition. So this is the insider's build that's actually built for the new arm processors, let's, try that out I'm going to open this up there's. Our net folder, let's open up the terminal control, backtick and run botnet. Run do the same thing here again, one two, three.

Okay, so clearly it's, not the editor's fault something's going on with the botnet runtime. It runs fine. But it is a little slower on the m1 processor versus the MacBook Pro powerhouse, i9 it's, probably optimized for this. Now, if you go to performance and then take a look at their docs' section you'll see that they have a profiling workflow document. So this is a pretty interesting tool and resource that you can use to test and profile your dot net code.

And what I'm going to do is. Actually borrow some of this to change some code here and run a longer sample. So for example, right here, we have something having to do with date time and ticks, I am curious to see of the memory usage and the CPU usage. So what I'm going to do is actually let's see, um, this project settings, right here are going to prevent hitting, so it's going to avoid needing the warm-up part I'm going to go ahead and replace the Cs, pro settings with the one I copied from that repository, Let's save that let's see if this is any faster it doesn't, look like it, not sure that actually does anything. In my case, this actually tells you how to do some performance testing within Visual Studio, proper, the actual full Visual Studio.

We don't have the capability to do that. Now maybe they'll add some documentation on how to do this using the command line. Now there is an interesting test right here. The allocation tracking test, so I'm going to copy this program right here and paste that. Into our code, this whole class and what's really cool about the c-sharp extension and the net SDK that I installed is that it provides intelligence and automatic imports.

Well, it did that in regular Visual Studio code. So let's do that there. So Visual Studio insiders is not doing that for me, but regular Visual Studio code is its underlying the missing references and offering me to automatically import these for me, which is nice let's do that and there's my using statements. So what this will do is.

This will consume a little more memory, and I'm going to increase this actually to let's make it 10 million iterations. And once it's done I'm going to say, console.write line all done. So this will use the cryptography namespace, and therefore it'll allocate some more memory for running this application.

And this should take a few seconds to run. Now just so that we're on the same page with the MacBook Pro I'm going to do the same thing here. So we're, not cheating I'm going to change the project to. Have those settings we're, avoiding hitting, the project, and I'm going to copy that code to rot as well, the crypto code right here for our program, all right? Finally, the test botnet run here and dot net run over there. Ready for this going to hit enter let's see who finishes first, wow, oh, you're going to say, Alex that was pretty silly because this one only did a hundred thousand iterations, whereas that one still has to do a few more a million let's change that up make sure they're on the same page and.

They're, both going to do 10 million iterations let's. Do it one? Two, three all right? Who's going to win let's? See come on come on, oh, MacBook, pro finished. And then that one finished MacBook Pro is clearly the winner here at least in today's test all right there's.

One more thing we need to do and that's to take a look at the CPU usage and the memory usage through the activity monitor so let's run this. But first what I'm going to do is change this to 100 million iterations on each one of these 100.A Million that should take a good minute or so to run let's, run one more time at the same time, boom, they're, both running. Okay. Let's. Take a look at the activity monitor here.

It is. Ah, this is very interesting check this out so net on the m1. This is on the m1 machine. Right here net is showing up CPU usage, 98, architecture is listed as intel. So this tells me that this is not optimized for the m1 chip yet, I'm sure it'll be faster when it is, but right now it's running through a translation. Layer which is Rosetta. So there it is it's running through Rosetta.

We also have process down here. But the top one is 98.3 and the memory usage is 160. Now mono, I believe that allows c-sharp language to run on a Mac so that's, also taking up quite a bit of memory. Right? There. Let's. Take a look at this one, which is the MacBook Pro dot net is taking up 100.1 CPU.

Now, it's, 99.9 threads 7, memory. Okay. So over here is not taking up that much memory where is it even being it on here? Am I? Missing it there, it is not much memory at all the big one is mono. So it's 214 here, and it's taking up 374 megabytes on the MacBook Air.

So there you go, take it or leave it. They both finished after this one's done. I just want to print out console.write line console.write line all done MBP we're going to do this one more time just to see who is going to win this one with a hundred thousand iterations go.

Did I say a hundred thousand I'm at a hundred million? Oh, I got the low battery warning on the.MacBook Air it's about time is it gonna finish before it dies is anything happening? Hello. All right there. You have its folks MacBook Pro wins. The dot net game for now on all levels of my testing. Now, perhaps my testing is not scientific enough.

If there is specific test, you want to see let me know down in the comments below otherwise for now. The winner is the 2019 MacBook Pro with 64 gigs of ram I'm going to test this out on a Mac mini as well to see if that changes anything, but I doubt it because of. That Rosetta translation layer that's happening there on the new m1 processors. So if you like this kind of content, if you like this video, if it was informative, I'd appreciate a like and subscribe to the channel. You'd really help me out thanks for watching, and I'll. See you in the next video.

Leave a Reply

Your email address will not be published. Required fields are marked *