Linux is faster than Windows - Is it the compiler?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I feel bad for the people who either don't already know this or deny it's truth.

👍︎︎ 5 👤︎︎ u/LinuxNurse 📅︎︎ Aug 12 2020 🗫︎ replies

Maybe or maybe not, but a random guy talking to a camera proves nothing.

👍︎︎ 3 👤︎︎ u/spayder26 📅︎︎ Aug 12 2020 🗫︎ replies

*surprise pikachu

👍︎︎ 1 👤︎︎ u/Zifnab_palmesano 📅︎︎ Aug 12 2020 🗫︎ replies
Captions
hey there my name is gary sims and this is gary explains i've been doing some testing and i found out that windows is a lot slower than linux if you want to find out more please let me explain so the context of this is that apple have decided to no longer use intel x8664 processors in their macs and they're going to use their own processors developed in-house using an arm instruction set-based cpu apple silicon seems to be the term that they are using now with that happening i wanted to create a benchmark that i knew would work across many many platforms natively compiled without any kind of emulation so that when the new macs come out i can actually run this program this suite of programs and engage the performance of the new macs now to do that i set about writing a suite of programs we'll talk more about in a second using c and c plus plus so they're pretty much uh universally uh able to compile across multiple operating systems so the idea was to support windows was to support mac os was to support linux and then to support them where possible on intel 32-bit and 64-bit x86 32-bit and 64-bit so including amd and then also on arm so that would mean for example mac os on 86 64 and mac os on arm windows on x86 uh 32-bit and x86 64-bit and windows on arm like for example on the surface pro x and then also on linux and for the raspberry pi and for intel so everything so basically trying to get to work across all the different uh combinations of operating system and uh system architecture so i started doing that i found some tool kits that i want to use and i've obviously using cc plus pretty universal and then i started to make the programs and then this is the first version i made for windows using the system and then sort of verifying it along the way on linux to see how things were going and i've got some results which i'll i'll show you now so these really are just kind of some different processors that i was able to get the hold off so you know we've got a ryzen 5 there we've got an intel i-core 7 we've got an intel i-core seven seventh generation i call seven uh tenth generation and the test result is in seconds so you can see the ryzen 5 is 155 seconds there so that was the slowest of the three and then the two i7s come in at different times and you can see that there is a difference in performance between the different uh processors now obviously in pc land there is just so many different processes that can be tested not only in just a current product range so intel's got the i3 the i5 the i7 the i9 and then all that kind of stuff but then also historically to the first generation the second generation the third generation all the way 10th generation you know whatever so there's a and then amd have got their own ones as well so there's a huge number of processes that could be tested and then each of those have got you know kind of their low power version and their unlocked version and you know an intel's naming scheme is a nightmare i've got a whole video about that on this channel to try to understand how they name all these processes so obviously this is just a very very tiny tiny example but it does shows how the test suite works and the idea is it's like speed test g for mobile there is a program that launches other programs and they do things like you know ray tracing and there's some emulation stuff going on and they're sorting and the prime numbers and all these kind of different tasks blurring of images all these different tasks that can happen and then once they all run one after the other the total time it took them to run is the score so there's no indexes there's no refactoring it according to this it's just a time score so the faster the processor the quicker it will do it so having got the windows version up and running i thought well i've got this pc here i could reboot this into linux now and run exactly the same code compile it and run it and in a good world ignore there would be some differences i thought you know five percent 10 differences maybe because of some you know compilers libraries whatever but hopefully this is going to be the same code we're going to see similar numbers so that's what i did i i recompiled for linux on the same hardware i ran the tests and these are the results i got so the orange bar is the time taken to run the program uh in windows and the yellow bar is the time taken to run it in linux and i've got two systems here one's an amd ryzen 5 one's a much much older intel q9 300 but in both cases you can see that the linux run times are significantly less in fact for the ryzen 5 that it's almost exactly half the time of the windows runtime so that number surprised me and hence the subject of this video because here we're seeing that running the same code cc plus code with a kind of you know a cross platform ui framework is actually running twice as fast under linux now of course that alarmed me because when you talk about benchmarking you want to benchmark the processor from one machine to another machine to another operating system to change the architecture you want these numbers to have some kind of uniformity to them following the pattern you'd expect so this was quite alarming so i had to do some further thinking so obviously the first thing is you know is optimization turned on is debugging turned off you know all these kind of things and yes they're all correct as i spent some time looking at it and they are all correct i also made sure there was no things that maybe could get optimized out by one compiler or on one operating system and as far as i can see these are consistent results now what's interesting is of course is the difference is that on linux you're using the gnu compiler suite so gcc g plus plus and on windows we're using microsoft visual studio so the next thing i did was i took one of those programs as an example program out of the suite and i removed all the ui stuff turned into just a command line program so there could be no arguments about you know the the ui is slow or whatever like that just a command line printed out a few lines of information but most of the work is not related to what comes out it's just the work the cpu is doing and then i compiled it with microsoft visual studio and then again with gcc on linux and i also got gcc for windows to compile it so i've now got three versions two on windows one on linux two different compilers and these are the results i got and so the orange bar at the top again is the microsoft c plus plus on windows and then the other two are gcc on linux and gcc on windows so we can see that there is a huge difference between microsoft c compiler and the gcc compiler suite so what does that tell me what tells me first of all that there is a problem in terms of optimization for microsoft's compiler it also tells me that there are a whole bunch of developers out there developing using visual studio and they've turned on optimization and they've you know they've done all the normal things and actually those programs are going to be running much slower than they would be if they were compiled by a different compiler so in that sense in its default setup windows programs compiled under visual studio will be much slower than programs compiled under gcc on linux or in fact it turns out under also under windows itself now obviously this isn't the end of the story there's many many more things that i can look into for example intel have a compiler that works on linux and mac os and on a window so i need to look into that of course i want this all to run on the mac as well and that is a whole separate video so for that video i'm going to be talking about how i've got this running on the mac get some numbers out for some different macs that we can talk about and then again check the different compilers apple's compiler inside of xcode maybe gcc let's see what we can get available and then when the arm version of the mac's come out to know what we've got on the intel world as we move over into the arm ecosystem so basically there's going to be a couple more videos about speed test g pc that's the pc version of speed test g how it works the problems i found while developing it the results i'm seeing while using it and we're going to talk about the mac as i said also i want to do a video about the surface pro x and its performance of course that's got the sq1 processor from microsoft based on the qualcomm snapdragon processor in that laptop running windows of course so that will be a separate video as well i'll basically keep you updated either in videos in here or on the community tab inside of youtube maybe on twitter to tell you how things are progressing okay that's it my name is gary sims this is gary explains i really hope you enjoyed this video if you did please do give it a thumbs up and if you like this kind of stuff if this kind of stuff interests you then why not stick around by subscribing to the channel okay that's it i'll see in the next one [Music] you
Info
Channel: Gary Explains
Views: 50,313
Rating: undefined out of 5
Keywords: Gary Explains, Tech, Explanation, Tutorial, Linux, Windows, Windows 10, Microsoft, Visual Studio, Visual C++, gcc, g++, C/C++ Optimizing Compiler, GNU Compiler Collection
Id: 8e7IdHG5fhQ
Channel Id: undefined
Length: 9min 34sec (574 seconds)
Published: Wed Aug 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.