Linux is faster than Windows - Is it the compiler?

  Переглядів 55,311

Gary Explains

Gary Explains

День тому

While developing my new benchmark, dubbed Speed Test G PC, I noticed that the results were much slower on Windows compared to Linux. Here is why!
Introduction to Android app development: www.dgitacademy.com
Let Me Explain T-shirt: teespring.com/gary-explains-l...
Twitter: / garyexplains
Instagram: / garyexplains
#garyexplains

КОМЕНТАРІ: 672
@GaryExplains
@GaryExplains 3 роки тому
I have uploaded some test source code, more info here: ukposts.infoUgxWgvnB5MmJnSOknDp4AaABCQ
@Tinfoilpain
@Tinfoilpain 3 роки тому
Thanks for the info Gary, I made added the code to a godbolt instance here: godbolt.org/z/d77ovd and added clang 10.0 for posterity, all with the same flags (I'm not a windows expert so there may be more optimization options).
@totalermist
@totalermist 3 роки тому
Seems as if GCC replaces printf calls will putchar in places. The rest of the assembly is identical and not particularly slower or faster in any way. The difference in performance is an artefact specific to this very code and doesn't even concern the compiler. It's a difference in the runtime library and its use (printf vs putchar in terms of optimisation) and not a general issue with MSVC at all.
@GaryExplains
@GaryExplains 3 роки тому
@@totalermist Sorry but I completely disagree for several reasons. 1. The code hardly does any output. You can actually see where the code takes a long time between solutions 5 and 6, for example. 2. All 3 versions of the subleq function do equal amounts of output but some are faster, again proving that the output is not a factor. 3. If you remove all the output, except for printing the times (which itself isn't timed so it doesn't matter if it is slow) then the performance remains the same. Sorry.
@totalermist
@totalermist 3 роки тому
@@GaryExplains Gary you are correct - the issue is something else entirely. It's so obvious that I'm ashamed to say it took me a while to see. You are comparing apples to oranges in this test! *GCC* is a *C* compiler and renaming the subleq-program to .cpp doesn't change the fact that it's still C code! Use this *C++* version pastebin.com/ZA7PsECk You'll see that even with MSVC the CPP version is actually *faster* than the pointer "optimisation" and not slower (at least on my machine) than the g++ and even the gcc version. MSVC is a bad C compiler - that's no secret. But if you use it to compile *actual* C++ code and not C code (which the gcc compiler is *much* better at optimising - it's used to compile the Linux kernel after all!), it does an excellent job. Btw, clang generates the same output as msvc when you throw the C program at it and is also slower than the gcc code... Again - if you use proper C++ instead, the optimisation engines kick in and make the code as fast as it should be. So shame on me for not immediately realising that and shame on you for throwing C code at a C++ compiler and then wondering why it fails to perform compared to a C compiler...
@GaryExplains
@GaryExplains 3 роки тому
​@@totalermist Dude, all you have done is create a fourth variant of the function, this time a C++ version that is quicker than the original. Congratulations. I have about 20 of those here. Micheal Barber (another viewer) has also submitted one here: ukposts.infoUgxWgvnB5MmJnSOknDp4AaABCQ?lc=UgxVMvqvmdh9Zc9bJjd4AaABAg.9CQboIaz9Qq9CQzDW1EYme All very interesting, but not the point of the exercise. I want to know why is the first one slow and why is subleq_g3 not. MSVC is a C and C++ compiler. It can handle the C stuff just fine. Renaming my test files to just .c and using clang, cl, and gcc all yield the same results. BTW, I am not comparing apples to oranges, GCC is also the generic name for the GNU Compiler Collection and it says very clearly at the top of the code to use g++ (but I also mention you can compiler it with gcc). But as I said, using the .c extension and just gcc, clang or cl doesn't alter the results at all. So, since you seem a bit blinked about the whole C/C++ thing, here is a special version of the question, just for you. Using pure C code (with .c files) etc, why is MSVC slower than gcc and clang? Why is subleq_g3 quicker using MSVC when it shouldn't be. Is there a workaround that doesn't involve hand optimizing the code for each and every function when clang and gcc don't need such mollycoddling.
@benmeehan2843
@benmeehan2843 3 роки тому
Hi, I am Ben from Microsoft Have you tried restarting your computer?
@SuperHeroINTJ
@SuperHeroINTJ 3 роки тому
Rotfl
@zapengineer694
@zapengineer694 3 роки тому
Lmao ! Get this to the top rfn
@jGRite
@jGRite 3 роки тому
Yes, I tried restarting my computer. Linux was faster.
@chrwl007
@chrwl007 3 роки тому
Thanks, Ben, that helped... restarted into Linux and what do you know? Instant speed boost.
@GaryExplains
@GaryExplains 3 роки тому
🤣
@hponde
@hponde 3 роки тому
Since in the end this ended up being about compilers I’m curious how GCC compares against the Clang compilers (especially in the MacOS)
@GaryExplains
@GaryExplains 3 роки тому
Yes, so am I. That will be in the video about using Speed Test G PC under macOS, as I said towards the end of the video.
@hponde
@hponde 3 роки тому
Gary Explains I missed it. Sorry about that! Thanks for replying. Excited to see the results!
@xrafter
@xrafter 3 роки тому
Can you even download gcc in macOS? Btw i like eating macos.
@notthedroidsyourelookingfo4026
@notthedroidsyourelookingfo4026 3 роки тому
For comparing compilers with smaller programs or code snippets, you can always use godbolt.org for assembly and quick-bench.com actual benchmarking.
@rigille
@rigille 3 роки тому
watch "what is a creel?" video comparing the compilers, clang performed the optimizations even better than gcc (for those examples at least)
@ykhatat
@ykhatat 3 роки тому
So GCC compiler is faster than Microsoft visual studio compiler
@xrafter
@xrafter 3 роки тому
The dark side is so not the jedi way.
@fireclown68
@fireclown68 3 роки тому
MSVC is an exceptionally good compiler, as is LLVM.
@LoyalSlime
@LoyalSlime 3 роки тому
@@fireclown68 yea these linux goons need to stop saying their feature less compilers are great. Its not about what runs an 8 queens fast.
@MrGarrowson
@MrGarrowson 3 роки тому
@@fireclown68 lol did you even watched the video ?
@MrGarrowson
@MrGarrowson 3 роки тому
@@LoyalSlime As a user you want the fastest program. Who cares about features when your program will be this much slower?
@wpyke
@wpyke 3 роки тому
I love the idea of a benchmark that works across multiple platforms like this!
@GaryExplains
@GaryExplains 3 роки тому
😁
@DS-Pakaemon
@DS-Pakaemon 3 роки тому
Everyone commenting that it's obvious windows is slow. Windows isn't slow, The VSC compiler is slow. On GCC, both are same. Watch the damn video first.
@ianpineda
@ianpineda 3 роки тому
*vs compiler
@cultofape1000
@cultofape1000 3 роки тому
Yup, there used to be a mingw build of Blender that pretty much negated the speed difference between linux and windows builds. Unfortunately it wasn't maintained.
@circuit10
@circuit10 3 роки тому
Windows is slow to use in general user experience
@pipyakas
@pipyakas 3 роки тому
Thanks to the wonderful clickbaity title, that's what you get. Talking about compilers on the video title wouldn't get many views
@xrafter
@xrafter 3 роки тому
@@pipyakas But it will make people comment in your video.
@oj0024
@oj0024 3 роки тому
Have you tried comparing the generated assembly code from msvc, gcc and clang with godbolt?
@anant6778
@anant6778 3 роки тому
a pre-requisite question is wether he knows assembly well enough to do justice to that. Does Dave ?
@inomo
@inomo 3 роки тому
@Gary have you tried other compilers like Clang? Also, how difficult would be to convert Speed Test G Suite in Julia?
@winsomehax
@winsomehax 3 роки тому
Should rename the video as "GCC is a fantastic compiler"... I've used Linux since 1998, but even I will admit that a blanket statement that Linux is faster than Windows ain't true.
@circuit10
@circuit10 3 роки тому
It usually is though because it's more lightweight
@SensSword
@SensSword 3 роки тому
Been using it since the same time too. DJGPP was my gateway drug thanks to id Software using it.
@JazibOfficial
@JazibOfficial 3 роки тому
Linux can't handle high memory usage, and freezes on nearly full memory usage, never happens on windows. Also, battery performance in linux is very poor on nvidia optimus laptops.
@aktw1234
@aktw1234 3 роки тому
@@JazibOfficial that is just generally false. there is something wrong with your setup if that is happening.
@JazibOfficial
@JazibOfficial 3 роки тому
@@aktw1234 Linux eats up the battery as it does not fully support hybrid graphics(Nvidia optimus), so if your laptop has a dedicated graphics card, it will almost always use it to draw views on the screen, which eats up a lot of battery. Hence, poor battery performance.
@SimoSimon9
@SimoSimon9 3 роки тому
Suggestion... Could you add the actual result numbers on the bar charts on each bar? I personally find this approach more informative than abstract bars. Love your work btw. Keep it up. Sincerely, A fellow electrical engineer :)
@xrafter
@xrafter 3 роки тому
عمر؟
@shokama
@shokama 3 роки тому
Just out of curiosity, is there any difference on the size of the compiled programs?
@wissensfrosch
@wissensfrosch 3 роки тому
I wonder how much of this is the optimization strategies inside the compilers and how much is the choice of standard library. Especially with the STL for C++ the implementation matters a lot. In debug mode, e.g., MSVC’s STL is really slow. However, using large frameworks for data types exclusively (like Qt) could level that playing field.
@noufbouf
@noufbouf 3 роки тому
great content, keep it up man ! shoutout from Montreal
@GaryExplains
@GaryExplains 3 роки тому
Appreciate it!
@piiumlkj6497
@piiumlkj6497 3 роки тому
Can I ask what library you used for your gui ?
@EvertvanKootwijk
@EvertvanKootwijk 3 роки тому
Hi Gary, did you take into account the setting of the Windows power profile (powercfg /l)? With the balanced profile, the CPU is constantly being throttled, unless all cores are being loaded. If your benchmark only loads one core, the clockspeed does not go up to 100%.
@georganatoly6646
@georganatoly6646 3 роки тому
I wonder if the windows C++ compiler is doing something odd with some kind of managed runtime. I seem to recall running into a default CLR context for C/C++ code compiled in Visual C++ for Windows resulting in having to explicitly configure the code to be compiled to run unmanaged. I was writing a native library for an Android app using the Native Development Kit when I stumbled across this.
@Jinoshkp
@Jinoshkp 3 роки тому
Can you try the same in Java. Curious if the JVM differs in performance Operating systems ?
@gary7363
@gary7363 3 роки тому
Gary, I found that using MinGW in W-10 that -O1 is a little faster than -O3 optimization on my Intel I3 NUC CPU. All my run times were ~8 secs. and -O0, no opt., were ~40 secs. I am very interested in the native complex data type in gcc (-std=c99 and #include
@nimrodlevy
@nimrodlevy 3 роки тому
As i saw this video and it interested me... so i took, just for the test, ready made src's specifically apache-httpd, vim and i compiled them both and the differences where neglagable +/- 2% (usually in favor of linux - i guess because i used core version - fedora) what ever i added to the make file i couldn't recreate your results... Can you post your test software src in github/gitlab? This video is really really interesting... Maybe there's much to learn from here...
@wbwarren57
@wbwarren57 3 роки тому
Great video! I don’t think I’ve seen anybody else take this approach. It’s highly interesting and also extremely informative. Thanks.
@GaryExplains
@GaryExplains 3 роки тому
Glad it was helpful!
@dorukhan8707
@dorukhan8707 3 роки тому
I have been experiencing so much lag spikes so far after I have started using POP!_ Os and although I have installed nVidia drivers it still lags. Any idea why, is it about the gpu? Btw I use intel i7 6700k and Asus GTX970
@zephyrus.9
@zephyrus.9 3 роки тому
Is there a possibility to compare .Net based benchmarks with C# and CLR being the primary runtime.
@JaydeepMaddipati
@JaydeepMaddipati 3 роки тому
Hey gary..I faced a problem of windows defender's real time protection slowing my sieve of eratosthenes program compared to native linux.After disabling it,program ran much quicker..faster than linux on 10^8 number range input.Btw i was testing rust program.Can u check that setting as well?
@JaydeepMaddipati
@JaydeepMaddipati 3 роки тому
I found the opposite true for rust lang.msvc toolchain was faster than gcc toolchain for the same prime generator program
@PeterJohnston42
@PeterJohnston42 3 роки тому
Can you also use some real-world tools, which are cross-platform. For example I use DaVinci Resolve and Blender and found both to be 50% faster on Linux than on Windows 10.
@GaryExplains
@GaryExplains 3 роки тому
Those are interesting results... but for my test suite it needs to be automated using my own code. However the code tries to be as "real world" as possible, so there is a ray tracing test in there, etc.
@blenderpanzi
@blenderpanzi 3 роки тому
@@GaryExplains You can do headless renders from the command line with blender AFAIK. So that might be an easy and useful addition. You can do similar things with Inkscape and GIMP.
@GaryExplains
@GaryExplains 3 роки тому
True, but that isn't the aim of Speed Test G PC.
@zaentyt837
@zaentyt837 3 роки тому
In my testing using an insider version of Windows and some ARCH Linux blender gives way better results using OptixAi accelerated GPU API setting for cycles render gives better results in photo render, and animations, however while enabling bloom in eevee Linux is faster due to no GPU acceleration and just pure software render, since it doesn't need to acces gpu performance
@zaentyt837
@zaentyt837 3 роки тому
@@GaryExplains blender supports Ray traced reflections through Nvidia studio capable PCs only available for RTX platforms on Windows 10, though u can still change code for Linux version to get the Optix Ai gpu api on Linux at a massive performance loss
@ShihabShahriar555
@ShihabShahriar555 3 роки тому
Isn't the title highly misleading? Hasn't the conclusion been MS compiler is slower than GCC- NOT windows is slower than linux? Edit: The title has been edited now, it used be just "Linux is faster than Windows!". Current one is fine.
@GaryExplains
@GaryExplains 3 роки тому
No, I don't think so. Native code produced for Windows using the native tools is demonstrably slower than native code produced for Linux using the native tools. So, Linux is faster than Windows.
@MishaAmashukeli
@MishaAmashukeli 3 роки тому
Yeah, this phenomenon has even got a name: "clickbait".
@GaryExplains
@GaryExplains 3 роки тому
@Misha Amashukeli Hmmm... While I respect that maybe your view, I wholeheartedly disagree. There is a fine line between a catchy, enticing headline and clickbait. Where you draw that line is matter of debate.
@ShihabShahriar555
@ShihabShahriar555 3 роки тому
@@GaryExplains Thanks for your response. Comparing two OS systems (to me) implies comparing their kernel: thread scheduler, efficiency of system calls, resource management etc, not User space applications. Microsoft justifiably deserves criticism for poor developer tools and resulting poorly performing programs built on top of those tools. But the OS itself I think is a separate entity. Recently I had a pure CPU-bound program that run around 40% slower on Linux than windows (pytest parallel), even after taking steps like closing all background apps etc. Should we really conclude something as bold as "Linux is slower than windows" from that?
@GaryExplains
@GaryExplains 3 роки тому
Funny that you include "kernel: thread scheduler, efficiency of system calls, resource management etc" but not the tool provided by the OS maker to write your programs. Odd.
@cernejr
@cernejr 3 роки тому
Interesting. Which version of VisualC++, of GCC, what optimization flags were used, what did the benchmark actually do? Maybe too much detail for a video, an accompanying article would be nice.
@manoliskontos8377
@manoliskontos8377 3 роки тому
So the question is, could we replace with gcc entirly and get better performance on windows? Tweaking windows for better performance?
@alancrobertson
@alancrobertson 3 роки тому
Are the binaries significantly different in size as well?
@craigharris9591
@craigharris9591 3 роки тому
What version of Linux was tested?? Any chance you could test handbreak and winff on both and give us some results on them as well?? Thanks in advance!!
@GaryExplains
@GaryExplains 3 роки тому
Several.
@matteorepossi5991
@matteorepossi5991 3 роки тому
Does the same happens also on Intel's recent i7 processors? Or we're still back at when compilers were dumping AMD?
@kevin.michaels
@kevin.michaels 3 роки тому
I have to say, I love how involved you are in the comments Gary :D #garyexplains
@ionciubotaru2696
@ionciubotaru2696 3 роки тому
Were these tests done on Clear Linux?
@ananon5771
@ananon5771 3 роки тому
very interesting,i always thought it had to do with linux being (generally) more efficient with its cpu scheduler and alot less resource hungry. but looking at this,it seems to be the compiler that is the main factor,with the other factors ive seen being relatively minor,but there are more tests to be done,so they could be factors in other tests. very insightful video
@lahmyaj
@lahmyaj 3 роки тому
7:27 - How can this be the case? (total coding newbie here) I mean I'm guessing obviously different compilers do make a difference but I thought the code to machine language process (which is what I understand a compiler does?) should all follow the same process no? Like I would've thought all compilers would essentially create the same resulting bit-for-bit program?
@GaryExplains
@GaryExplains 3 роки тому
No, absolutely not. Each compiler generates different machine code.
@mmmhorsesteaks
@mmmhorsesteaks 3 роки тому
How about setting -o0 on gcc and /od on msvc?
@makisekurisu4674
@makisekurisu4674 3 роки тому
But visual studio has several other compilers for use also. So does most developers not use the native compilers for windows and rather use the other ones like .net framework or something maybe even GCC?
@xrafter
@xrafter 3 роки тому
also.So is not website ?
@GaryExplains
@GaryExplains 3 роки тому
@Xrafter LOL
@makisekurisu4674
@makisekurisu4674 3 роки тому
@@xrafter Now fixed?
@xrafter
@xrafter 3 роки тому
@@makisekurisu4674 Yes.
@Masterr59
@Masterr59 3 роки тому
This was a really interesting topic. I never have used the visual studio compiler and just always used GCC, but I wouldn't have expected that much of a difference. But I remember in school how they told us not all compilers are created equal and that's generally where a lot of magic happens.
@nitesh.dodeja
@nitesh.dodeja 3 роки тому
Can you please test with clang compiler on mac also
@pekkokuopanportti6859
@pekkokuopanportti6859 3 роки тому
It's been a couple of years since the performance tests, but at least back then we were able to get better performance out of the Intel compilers (for both C and Fortran) than the Gnu compilers for our quantum-physics-related simulation codes when running on Intel processors (using Linux).
@aronpye4931
@aronpye4931 3 роки тому
I wonder which compiler optimisation options were used, and whether MSVC would fair better if it’s optimisations were tweaked?
@GaryExplains
@GaryExplains 3 роки тому
The code has been released, see pinned comment. Please try whatever optimization options you want.
@cheaterman49
@cheaterman49 3 роки тому
Dunno 'bout the compiler, what about the stdlib? Did you also compare musl vs glibc on Linux? People have been getting interesting results, and I wouldn't expect compilers themselves to make such a difference nowadays? EDIT: Also, benchmarking code generally isn't very complicated, so it would be very interesting to compare the disassemblies? I believe some people did it above (talking about printf vs putchar but not that relevant as you answered), can they find a simple down-to-Earth explanation of the machine code difference causing the overhead? (other than "VC++ is bad at compiling C", which as you noted isn't that relevant in itself...)
@marlonramanan9112
@marlonramanan9112 3 роки тому
That is quite an eye opener! Thanks Gary!
@thelookofdisapproval8234
@thelookofdisapproval8234 3 роки тому
gcc is faster than MS Visual C++ for sure, But I have a bit respect for MSVC, because of an experience I had with it During a practical exam in my bachelor's I was using g++ and was stuck on segmentation fault, and I spent 2 hours trying find its source, but unfortunately, I ran out of time. when I came back to my dorm, I tried figuring out why my code didn't work, and for fun I tried running it in visual studio, and it found my source of segmentation fault in one go, it marked it as possible source of error. I still dont use MSVC (I may use it when I get a more powerful computer), mainly because I've switched over to linux, and I just generally have gotten better at coding and debugging. But that moment was like as if I found new religion
@petersilva037
@petersilva037 3 роки тому
valgrind is your friend...
@GauthamKrishna9991
@GauthamKrishna9991 3 роки тому
Use debug symbols, use GDB and Valgrind, and that should be enough!
@thelookofdisapproval8234
@thelookofdisapproval8234 3 роки тому
@@GauthamKrishna9991 I was in 1st year of college back then, with very few experience with debugging. now its like 4 years ago
@edino1981
@edino1981 3 роки тому
I ve noticed this too and i think that msvc compiler adds bounds checking code or similar.
@ultrium2000
@ultrium2000 3 роки тому
Did you run the release version and not the debug version? :) Joking aside, have you tried running the Linux code on WSL. That would be interesting to me.
@GaryExplains
@GaryExplains 3 роки тому
Yes, the WSL speeds are very similar to the native Linux speeds.
@anon1187
@anon1187 3 роки тому
Proudly seeing this on my Linux😄😄...by the way Gary always do an excellent job in these fields......Cheers
@MoncefNaji
@MoncefNaji 3 роки тому
Even Microsoft knows their C++ compiler is garbage. They are considering ditching it altogether and just use clang.
@Manuel-rl6um
@Manuel-rl6um 3 роки тому
This is ver exciting Gary!
@dvila1977
@dvila1977 3 роки тому
Are you going to use Docker for your future test?
@ryanmalin
@ryanmalin 3 роки тому
Loving the content thanks Gary
@KZgun4hire
@KZgun4hire 3 роки тому
Gary. You can use VS code ide with gcc or clang under windows.
@dhawaljoshi
@dhawaljoshi 3 роки тому
If gcc is the similar on arm architecture then it would give you a common base to design the speedtest around it.
@levveliki8888
@levveliki8888 3 роки тому
MS cl is known for not being a good optimizing compiler. Though I would add that for some workloads ms cl is better than gcc. compilerexplorer is a good tool that can be used to see the different assembly produced by various compilers.
@terra0009
@terra0009 3 роки тому
I've never tested it, but it may be the case: Microsoft, gcc and llvm all have a feature to protect the execution control-flow. This is a feature that makes a program safer to execute, but it does impact performance. This feature is being each time more requested, and the impact in performance is very application dependent. Maybe, just maybe, the microsoft compiler enables it as default, while GCC doesn't. Or maybe GCC is just a hell of a good compiler (at least compared to visual studio) =)
@yngvenystrand167
@yngvenystrand167 3 роки тому
Very interesting Gary! I have two computers with the same Intel i7 quad core processor, one 3 GHz running Ubuntu and one 3.6 GHz running Windows 10. I'm using Python for mostly number-crunching programs using the NumPy module. The Ubuntu computer runs the programs in about 70% of the time it takes for the Windows computer to run them, despite having a slower CPU. Both have plenty of memory so that is not an issue. The NumPy module is written in C, so maybe your video just gave the answer to this.
@Seijakukun
@Seijakukun 3 роки тому
Gary, another thing, if you're using Visual Studio 2017/19 on Windows, the default compiler is going through the .net interpreter. However, you can manually choose to make a "complete compile" and append the libraries into your exe/dlls so your program doesn't go through the .net interpreter. I suppose you'd get better results that way
@Seijakukun
@Seijakukun 3 роки тому
docs.microsoft.com/en-us/dotnet/framework/net-native/
@GaryExplains
@GaryExplains 3 роки тому
That only applies to C#
@valgeirg
@valgeirg 3 роки тому
Interesting stuff. No need for the clickbait.
@happygimp0
@happygimp0 3 роки тому
How much does compile time differ between this compilers?
@GaryExplains
@GaryExplains 3 роки тому
Is that an important factor?
@sociocritical
@sociocritical 3 роки тому
Just use clang. Clang/Clang++ is the C/C++ frontend for LLVM and is basically the standard when it goes down to compiler optimizations. Clang also has way better error messages, is highly compatible with GCC and is available on all plattforms and can target all relevant architectures.
@olehigorovich474
@olehigorovich474 3 роки тому
How about playing games and video editing on Linux? Which is faster?
@GaryExplains
@GaryExplains 3 роки тому
I would guess Windows because of the GPU support.
@An.Individual
@An.Individual 3 роки тому
This is an interesting video. I would never have believed GCC works better than MSVC. Thanks Gary.
@GaryExplains
@GaryExplains 3 роки тому
Glad it was helpful!
@seriykot1
@seriykot1 3 роки тому
@@GaryExplains Which MSVC compiler did you use, the free version or the paid version that has optimizations for the specific CPU instruction set?
@GaryExplains
@GaryExplains 3 роки тому
@@seriykot1 Can you give me a link to where Microsoft describes the "pro" level optimizations for the paid versions?
@seriykot1
@seriykot1 3 роки тому
@@GaryExplains Sorry for the confusion, it's the Intel compiler that is paid for. Looking forward to the rest of your Speed Test G PC series!!
@asafalgawi7898
@asafalgawi7898 3 роки тому
Hi Gary, is the benchmark open source ?
@jacko314
@jacko314 3 роки тому
very surprising results. it is hard to believe that compiler optimizations would yeild such differences. could it be battery optimzations? i've noticed my laptop runs longer on windows than on ubuntu. would be interesting to compare the actual assembl code.
@howardlam6181
@howardlam6181 2 роки тому
not surprising if you're a seasoned programmer.
@al20ov87
@al20ov87 3 роки тому
How about writing your test suites directly in x86 assembly and assembling it on both windows and linux, without any system calls, that way the tests would be more fair?
@GaryExplains
@GaryExplains 3 роки тому
Because the whole point is that I want to test the new Macs, which of course will be ARM based not x86.
@msheaver
@msheaver 3 роки тому
There have been some tests running Blender renders on Windows and Linux, and they have seen similar results!
@synen
@synen 3 роки тому
Thank you for the video but I also think the video title is incorrect. If GCC in Windows and GCC in Linux had the same performance how is one OS faster than the other? What am I missing? Thank you.
@tsujiharu225
@tsujiharu225 3 роки тому
Windows is compiled with Visual C++, so the resulting binaries won't run as fast as a (hypothetical) GCC-compiled build. Since you're running the OS binaries natively, the compiler plays a key role when it comes to performance. To that end, I wholeheartedly disagree that the video title is incorrect, but Gary probably should've explained the relationship between the compiler and OS performance better...
@Farhan-pk3wq
@Farhan-pk3wq 3 роки тому
What about WSL runtime compared to Windows?
@GaryExplains
@GaryExplains 3 роки тому
The WSL times were very similar to the Linux times.
@franciscosusana2292
@franciscosusana2292 3 роки тому
@@GaryExplains strange, I ran some Nestjs test on WSL2 and Ubuntu 20.04 and the performance of Ubuntu was far better! (on the same I5 10th Gen Laptop) Outcome: I quick to Windows and I'm an Linux user since then...
@GaryExplains
@GaryExplains 3 роки тому
@@franciscosusana2292 Does Nestjs test server load performance or CPU performance?
@franciscosusana2292
@franciscosusana2292 3 роки тому
@@GaryExplains when I run the test I see on htop the CPU bars increasing abruptly and sometimes I have to wait for the tests to finish to use the laptop again. And by load do you mean in terms of RAM?
@FlavioO
@FlavioO 3 роки тому
Hello Garry, i didnt understand what is slower, the Application running on the OS, or the binaries generated by diferent compilers?, So Windows is slower than Linux as the title suggests? It looks that your test is more about compilers than about operating system
@GaryExplains
@GaryExplains 3 роки тому
Windows as an ecosystem using the OS and the development tools from the OS maker results is slower code.
@FlavioO
@FlavioO 3 роки тому
Im a followers of your channel, and like the way you explain things, i confess that this idea is good, but the result is not accoplished since on your title you says that Windows is slower, but you demonstrarem that the same Application compiled by the same compiler runs equally um Windows and Linux. Not all Windows applications are developed using visual studio, so the Windows ecosystem has more than VS. Unless you want intentionally to transmit a biased message, the result is not very well acconpished because you demonstrate that gnu compiler procures the same result on Windows and Linux. By Logic your vídeo title should be more like "Visual Studio compiler produces slower binaries than gcc". I think the idea is good as well as the approach, i feel your conclusions looks biased. Just trying to be imparcial
@GaryExplains
@GaryExplains 3 роки тому
Not all Windows applications are developed using VS, sure, but a lot are, the majority I would say. My conclusion isn't biased at all, I clearly show what is happening and my conclusion is based on the facts. Please don't confuse the 5 words in the title, with the detailed content I give over 9 minutes of explanation. Don't judge a book by its cover, etc, etc.
@FlavioO
@FlavioO 3 роки тому
Well, its just a suggestion, if the title were a question it would fits 100% with the content, in my opinion as it is a statement, i feel it works more like a clickbate, its just my opinion, dont take it personally. Also as a suggestion taking a real world case, as for example compiling nginx with gcc on both operating systems, serving only static files, how does it performs? how many requests per second? how much resources are used? how operating system interferes/helps? Thanks for your work, it is great and very appropriated. Hope to continue seeing your explanations
@GaryExplains
@GaryExplains 3 роки тому
I have tried titles with question marks before and they don't work, it seems that many people can't actually read properly and don't even notice the question mark. Then people still accuse me of click-bait because they say that anything can be put as a question but still be click-bait.
@dhawaljoshi
@dhawaljoshi 3 роки тому
Excited about this!
@GaryExplains
@GaryExplains 3 роки тому
😁
@zhd-net
@zhd-net 3 роки тому
Gary: Have you compared Visual Studio developed applications employing NET CORE for cross-platform use?
@GaryExplains
@GaryExplains 3 роки тому
Yes here: ukposts.info/have/v-deo/bptka4KHaoqmsas.html
@zhd-net
@zhd-net 3 роки тому
@@GaryExplains Wow, super fast reply appreciated. And a good job showing the cross-platform abilities of .Net Core. However, given the speed comparison of compilers shown here, I was wondering how the .Net Core cross-platform performance compared. It was fairly difficult comparing performance from the Hello World response times. 🤣🤣🤣 Just kidding, keep up the good work. 👍
@crayzeape2230
@crayzeape2230 3 роки тому
C'mon Gary, throw Clang into the mix, inquiring minds want to know ;) Ooooops - Just saw your video on Clang , guessing you might have something in a future video. :)
@0xdead982
@0xdead982 3 роки тому
can you publish the source code you wrote ? i wonder what cross-platform UI you used.
@yahtadi5152
@yahtadi5152 3 роки тому
Cant wait Speed Test G Server Running server os with accelerator card and stuff Amazing as always prof
@Staycalm2010
@Staycalm2010 3 роки тому
Did you try if Clang performed any differently?
@GaryExplains
@GaryExplains 3 роки тому
As I said in the video there is more to investigate.
@GlennStory
@GlennStory 3 роки тому
Are you planning to release the source code?
@BareSphereMass
@BareSphereMass 3 роки тому
Now I want a video about GCC vs VS...
@3Cr15w311
@3Cr15w311 3 роки тому
Back in the early 2000s I found that VC++ generated faster code (in Release mode) than g++ under Linux in optimized mode but haven't tested it in over 15 years. One important thing that was true in the late 90s and early 2000s was to use the statements with the STL to reserve a certain size for containers because g++ generated code that increased the size exponentially by some factor rather than linearly. Doing this made one program of mine run an order of magnitude faster because at the time, VC++, when increasing the size of a string, would allocate a constant amount of space more, then copy the whole thing into the new space, then a very short amount of time later, it would do it again, turning the run time into quadratic. g++ would increase it by a factor such as a percentage then need to perform this reallocation and copying far less often. After putting in the extra statements, the programs ran comparably on the two compilers. I understand that at some point Visual Studio started adding some kind of layer that caused a performance pentalty but by that time I was no longer using it and was using UNIX and Linux systems almost exclusively. so I never really investigated it or cared by that point.
@jfreshh330
@jfreshh330 3 роки тому
Gary, have you thought about making your tests more streamlined? I mean maybe you could make an app like Geekbench or Antutu (RIP)
@GaryExplains
@GaryExplains 3 роки тому
What do you mean by "streamlined"?
@jfreshh330
@jfreshh330 3 роки тому
Gary Explains kinda like mainstream. Like how PCmark has apps. I could honestly see CPU manufacturers like AMD & Intel using your benchmarks to measure efficiency or something as time goes on
@GaryExplains
@GaryExplains 3 роки тому
Sorry, I am not being awkward, I promise, but what do you mean by mainstream? Do you mean release it to the public?
@jfreshh330
@jfreshh330 3 роки тому
Gary Explains yeah i may have chosen the wrong word my apologies. But yeah a mobile app or something
@GaryExplains
@GaryExplains 3 роки тому
Thanks for clarifying. So on the mobile side I have Speed Test G and a whole channel for testing devices: ukposts.info/the/8Cd4TlU1d5mPNGKXibCWqw.html and there is an FAQ which covers thing like the availability to the public garyexplains.com/faq. On the PC side, Speed Test G PC is very new, like the paint is still drying on it, so the future is yet to be decided.
@yasinarif7291
@yasinarif7291 3 роки тому
Is there an advantage to run C++ compared to c, as in c++ can run all c commands but c cannot run most c++ commands, if so this would be like comparing apples to oranges, I did like watching this hopefully people will go back to writing in c, good to see someone looking at why things run as slow and bad as they do considering the architecture amount of cores and frequency most processors have now.
@hamza2128
@hamza2128 3 роки тому
It would be interesting to see results of vm Linux in Windows and vice versa
@PATRIK67KALLBACK
@PATRIK67KALLBACK 3 роки тому
Wow, I'll download gcc for windows and start testing it for windows app. I think I can even use it in Visual studio as compiler.
@francescogiuseppearagona1109
@francescogiuseppearagona1109 3 роки тому
2:09 this results make no sense to me: the 7700hq is a 4 cores / 8 threads mobile CPU. How can it score better than a 6 cores / 12 threads Ryzen 5 desktop CPU? This might be a first indication that there is something wrong with the code you are trying to use as a benchmark. Then, actually some benchmarks were reported to work better on linux than on windows, but this is a whole other issue.
@mas921
@mas921 3 роки тому
back in the day we always used intel compilers, libs and profilers as much as possible 😎. sorry if this is an obvious/stupid question; but the visual studio one wasn't C+++/CLI right? thats the "c++ .net" AFAIK. looking forward to the intel compiler results!
@GaryExplains
@GaryExplains 3 роки тому
I just double checked and the binaries are native, no CLR in sight!
@mas921
@mas921 3 роки тому
@@GaryExplains thanks for checking!
@fragarena9910
@fragarena9910 3 роки тому
invaluable information, thank you
@worldhello1234
@worldhello1234 3 роки тому
@0:16 That is one reason I use Linux, the other one is the custom kernel for gaming. :)
@OmegaDarkMage
@OmegaDarkMage 3 роки тому
So glad I switched off Windows, all the Linux distros (Arch and Ubuntu distros) I've tried run buttery smooth compared to Windows 10. I have games running with wine/lutris running just as well and in some cases better which is insane considering the games in question like Final Fantasy 14 and the Elder Scrolls Online were optimized for Windows.
@bevintx5440
@bevintx5440 3 роки тому
Yes, compilers matter a great deal, as well as which options are used with those compilers. I find it interesting that Microsoft used to brag about generated code speed, but when I just now went to their website I saw everything else but that.
@justin3594
@justin3594 3 роки тому
I think that this proved that when you compare apples to apples by using the same hardware, same compilers with the same settings on windows and Linux they are the same speed.
@peterjansen4826
@peterjansen4826 3 роки тому
@Gary, you know about Blender being faster on Linux? It is because on Linux it can divide the workload over threads faster than on Windows, the rendering itself is roughly as fast. I know that generally Linux is faster with task-switching, I don't know why though.
@zaentyt837
@zaentyt837 3 роки тому
Also compiler versions can differ through both hardware and software, and not only that but the way you have tested. If there is no problem can I ask which version of Windows you are using?
@GaryExplains
@GaryExplains 3 роки тому
Windows 10 and Visual Studio 2019.
@zaentyt837
@zaentyt837 3 роки тому
@@GaryExplains ok, are you using any insider specific version or using the standard windows?
@littlebrethren9486
@littlebrethren9486 3 роки тому
Zaent YT who cares, Windows sucks anyway
@GaryExplains
@GaryExplains 3 роки тому
Standard everything.
@Maximococolio
@Maximococolio 3 роки тому
I thought the same, wich Windows version and if the correct commands to enable multicore usage on AMDs R5 to achieve a better performance.
@thecuriousone1721
@thecuriousone1721 3 роки тому
huh very interesting.... looking forward to windows vs macos
@scottcampbell2707
@scottcampbell2707 3 роки тому
It would be interesting to see the results if you could run your benchmark with the various tests running concurrently, rather than sequentially.
@faroptimistic
@faroptimistic 3 роки тому
Request you to do a similar comparision for Java VM between Linux and Windows ..
@martinmbuthia1965
@martinmbuthia1965 3 роки тому
In my opinion the best technical info and tutorial videos. Now I know to stick with gcc as much as I can.
@cristiandavidhomeacosta5091
@cristiandavidhomeacosta5091 3 роки тому
Also processes like Antimalware Service Executable makes development tasks like npm install or npm run dev - build significantly slower on windows than on Linux, is one of the reasons why I prefer to use Linux.
@johnsimon8457
@johnsimon8457 3 роки тому
Cristian David Home Acosta that’s right. My company provided windows virus scanner will hold up anything npm by as much as 40% because of the hundreds of thousands of files touched and generated.
@toddmarshall7573
@toddmarshall7573 3 роки тому
Contrasting GUI platforms is probably not possible with your algorithm suite. Further, multi-threading, multi-processing, multi-user, multi-vm, etc. are not well presented. I contend most algorithms will perform about the same when these other issues are stripped. But these other issues "are" the issues.
@GaryExplains
@GaryExplains 3 роки тому
Why do you think that multi-threading, multi-processing are not well presented?
@GaryExplains
@GaryExplains 3 роки тому
Also why is not possible to compare using my suite? I haven't explained hardly any details about how it works. What assumptions are you making?
@user78405
@user78405 3 роки тому
reason why...memory usage difference and services running in background that Microsoft track every computer online...programs like browsers ..firefox is notrious in memory leaks but its faster than any browser i used ...i try chrome...not liking at all...maybe its style or when loading up..i am not familary with... another reason...linux is all good and all..but requires lot of user effort to run any program..its not the same as windows, download and run....on linux its more downloading and downloading more then config and config more then run then crash then troubleshoot and run and pass
@DAVIDGREGORYKERR
@DAVIDGREGORYKERR Рік тому
I don't think that it is the compiler i.e CODE::BLOCKS plus GCC Tool Chain but you have many different settings that can be applied, I have used -march=opteron -Wall -fexceptions -march=opteron -fomit-frame-pointer -fexpensive-optimizations -O -Wshadow -ansi -m64 -ffast-math -save-temps -march=opteron -m64
@GaryExplains
@GaryExplains Рік тому
Are the flags not part of the compiler?
@jorditribo94
@jorditribo94 3 роки тому
Did you step through your code in a debugger making sure gcc isn't optimising some of your variables? Maybe in assembly code.
@GaryExplains
@GaryExplains 3 роки тому
If only I said in the video that I checked things like that... wait, I did! 🤦‍♂️
@AminAramoon
@AminAramoon 3 роки тому
That's simply impossible my friend. gcc is known the be the fastest compiler but 2X performace difference has to be a bug in your testing. 1) release the code on github 2) does your code make syscalls, if not, how can you compare linux vs windows 3) what do you mean by consistent? how did u benchmark those numbers? did you use gbench or some other benchmarking tools ? 4) what are the default options for your compilers? is vectorization active, loop unravelling, you an even turn off branch predictor in msvc.
@GaryExplains
@GaryExplains 3 роки тому
I released the code. Please see the pinned comment. Please play with the code a let me know. Several people have tried and the conclusion has been the same.
Windows 10 Desktop on a Raspberry Pi 4!!!
15:18
Gary Explains
Переглядів 355 тис.
Why Linux Is Better For Programming
13:32
Hallden
Переглядів 2,7 млн
Самый большой бутер в столовке! @krus-kos
00:42
Кушать Хочу
Переглядів 6 млн
Секретная разработка КГБ! Волга «Догонялка» на V8…
1:07:10
Мастерская Синдиката
Переглядів 2,5 млн
10 ways Linux is just better!
11:32
Linus Tech Tips
Переглядів 3,9 млн
AMD’s Actually RELEASING THESE CPUs!
6:10
Gamer Meld
Переглядів 52 тис.
The Linux Tier List
27:34
Chris Titus Tech
Переглядів 827 тис.
Why I Code on Linux Instead of Windows
9:16
ForrestKnight
Переглядів 927 тис.
What is Linux? - Linux Explained
12:45
DorianDotSlash
Переглядів 186 тис.
The 12 Linux Apps Everyone Should Know About
21:20
DistroTube
Переглядів 438 тис.
The Death of Moore's Law - Fact or Fiction?
17:16
Gary Explains
Переглядів 25 тис.
SMART TVs ABSOLUTELY SUCK! Here's Why & What To Do.
6:34
Techlore
Переглядів 72 тис.
Linux Directories Explained - including /etc /home /var /proc /usr
13:39
Gary Explains
Переглядів 37 тис.