|
View Poll Results: Which do you like? | |||
C | 4 | 17.39% | |
C++ | 15 | 65.22% | |
C# | 9 | 39.13% | |
Multiple Choice Poll. Voters: 23. You may not vote on this poll |
|
Thread Tools | Display Modes |
#1
|
|||
|
C vs. C++ vs. C#
Hi. I am a computer scientist. This is a comparison of memory usage for a simple hello world application between C, C++, and C#. Compiled VS2010 32-bit x86 Release.
PHP Code:
PHP Code:
PHP Code:
Rogean you can thank me for the adsense money from the future googlers that will find this site (as applies to all of my insights made here).
__________________
In your unfailing love, silence my enemies; destroy all my foes, for I am your servant. Blessed be the LORD my strength, who teaches my hands for war, and my fingers to fight. (Psalms 143:12-144:1) [10:53] <@Amelinda> he grabbed my ass and then i broke his nose. | ||
|
#2
|
|||
|
Note: I was using the MS C compiler for the C code. Bjarne Strassoup (creator of C++) said that hello world should generate literally same code. So I copied the C code and compiled with MS C++ compiler and it was 488k.
interdasting
__________________
In your unfailing love, silence my enemies; destroy all my foes, for I am your servant. Blessed be the LORD my strength, who teaches my hands for war, and my fingers to fight. (Psalms 143:12-144:1) [10:53] <@Amelinda> he grabbed my ass and then i broke his nose. | ||
|
#3
|
|||
|
c++ for obv~ reasons
| ||
|
#4
|
|||
|
I'm kind of wondering why you're comparing the memory usage of each of these Hello World programs in the different languages; is that supposed to be a way to determine which language is better? God, I hope not.
Furthermore, what also saddens me is your leap from this into the Windows 8 Kernel and managed, but I have a feeling you don't know what managed means. Also, since you used "using System;" so you don't have to write the namespace System before Console. ReadKey() probably doesn't do what you think it does; I think your intention would be Read(). Lastly, you don't have to wonder if they generate the same code, since you can view the disassembly very easily in VS2010, but ensure you're viewing the release build when you do so. | ||
|
#5
|
||||
|
Of course I knew there would be criticism of comparing hello world applications, but I sincerely doubt C# will perform any better when dealing with generic containers compared to C++ STL which inlines to C.
Perhaps it is unfair as .NET is a framework, so I will compare it to Qt. PHP Code:
Quote:
__________________
In your unfailing love, silence my enemies; destroy all my foes, for I am your servant. Blessed be the LORD my strength, who teaches my hands for war, and my fingers to fight. (Psalms 143:12-144:1) [10:53] <@Amelinda> he grabbed my ass and then i broke his nose. | |||
|
#6
|
|||||
|
Quote:
Quote:
I'll stop wasting my time here. Good luck with your thread and checking how much memory Hello World programs use in different languages. | ||||
|
#7
|
|||
|
I could write a C++ program that could kill your whole family.
| ||
|
#8
|
|||
|
As far as ReadKey() goes, it is the accepted practice of preventing a console application of immediately closing. I tried Read(), and of course there wasn't any significant difference in the memory footprint. Maybe they load similar buffers, or don't load any until the key is actually pressed and the method returns, that I do not know.
What inspired this in the 1st place was reading this statement on stackoverflow: The .Net framework takes anywhere from 5-15 megabytes of RAM just to load up enough code to execute "Hello World". Obviously C# was going to fail in this. It's JIT'ed, which means that it's an inefficient waste of crap language designed solely for the purpose of treating ignorant software programmers as fodder for applications developed on a Microsoft platform. I don't care how easy it is to program in; there's no way in hell I'll use a language which doesn't put forth the idea of "flexibility" and "control" as important. C# was designed to make Microsoft money, and to provide businesses the ability to write generic, lame, CRUD applications. But after seeing all of this I'm reaffirmed and glad I switched to Qt years ago and never looked back.
__________________
In your unfailing love, silence my enemies; destroy all my foes, for I am your servant. Blessed be the LORD my strength, who teaches my hands for war, and my fingers to fight. (Psalms 143:12-144:1) [10:53] <@Amelinda> he grabbed my ass and then i broke his nose. | ||
|
#9
|
|||
|
Hi. I am a developer. This is the reality check.
Taken from http://www.ecma-international.org/pu...T/Ecma-334.pdf referenced by http://en.wikipedia.org/wiki/C_Sharp...ote-ECMA-334-6. As the definition of C# evolved, the goals used in its design were as follows: • C# is intended to be a simple, modern, general-purpose, object-oriented programming language. • The language, and implementations thereof, should provide support for software engineering principles such as strong type checking, array bounds checking, detection of attempts to use uninitialized variables, and automatic garbage collection. Software robustness, durability, and programmer productivity are important. • The language is intended for use in developing software components suitable for deployment in distributed environments. • Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++. • Support for internationalization is very important. • C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions. • Although C# applications are intended to be economical with regard to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language. I've bolded the most important bullet point for your reference. I understand many of you machine-hybrid basement dwellers enjoy ultra efficiency as I employ a number of you for highly specialized tasks in my company but keep in mind that it is important to use the right tool for the job. | ||
|
#10
|
|||
|
hence why it sux
__________________
In your unfailing love, silence my enemies; destroy all my foes, for I am your servant. Blessed be the LORD my strength, who teaches my hands for war, and my fingers to fight. (Psalms 143:12-144:1) [10:53] <@Amelinda> he grabbed my ass and then i broke his nose. | ||
|
|
|