Check Torvalds open source page : https://github.com/trending/c
Torvalds hates C++ ? (comment)
Naaa is a proven fact debated on the forums that C++ or objects for that matter are slower. C with pointers have a very stable performance. Is the lower language available, which is more or less easy to write, some parts are written in Assembly.
Try for your self a 3D engine build in C# sharp since you like so much, its is incredible slow in a computer with 10 or more years like my own.
C++ can achieve better performance then C# Sharp,
is true but still is not that much good to develop a operating system since, it does not achieve the same performance as pointers. (and im not sure if you can access all that stuff needed for hardware in a high level language)
Windows languages : C, C++, C#. Some parts in assembler. It's build the same way as Linux.
Maybe width the new computers that does not matter, but this is how thing are made. You should read more about low level programming language. The ones are close to machine code have more performance. They are harder to programme but have more performance.
One time i load a 3D engine in C# so slow that i could not even move around the map. For example Unity 3D is build in C++ is hard to do any thing at least i can move around in a 10 years computer.
Why high level is slower in terms of performance ?
Objects are a entanglement of data, so they are bit far way for the zero and one that the computer understand. So that mean after compiled more CPU activity to be done. Is simple as that. The more you entagle and nest slower it becomes. 2 entangle While loops are slower then 2 separeted while loops.
Is the same code the same language the same things... Is not about programming paradigms. Simple it consumes more references. Which will take more time to perform.
Why use high level?
Mainly because you can code more in less time and hope computers evovle so that perfomance is not noticed.
Assembly is closer to computer language, but extremely hard to program. You can see a code example for assembly:
mov edx,4 ; message length
mov ecx,msg ; message to write
mov ebx,1 ; file descriptor (stdout)
mov eax,4 ; system call number (sys_write)
int 0x80 ; call kernel
It's performance much more higher then C. Can search games build in Assembly like Tycoon. Was build in assembly. At the time they din't have computer capability to process that much amount of objects in the screen so they have to program it in assembly so that the game could be created in that time\date.
It have a extremely high performance for the time. It loaded a lot of stuff, think no other game does that at that time .
Another pratical Example Quake 3 Vs Unreal Tournament
- Quake 3 Have barly any frame loss https://www.youtube.com/watch?v=xfdnMoaWHZo
- While Unreal tournament made in C++ have high amount of frame loss : https://www.youtube.com/watch?v=UzxaGj6UCUg&t=45s
No comments:
Post a Comment