C Board  

Go Back   C Board > Community Boards > Tech Board

Reply
 
LinkBack Thread Tools Display Modes
Old 10-16-2009, 04:03 PM   #1
Registered User
 
Join Date: Oct 2006
Location: UK/Norway
Posts: 464
Speed of different languages

Hey,

Is there anywhere I can go to get an objective overview over how fast different languages are compared to each other? Im not looking for what langues are the fastest for certien operations, but more as a programming languages as a whole.

I know that c/c++ is more or less the fastest you can get unless your willing to do crazy assembly stuff and is a guru when it comes to programming, my main goal is to see how big the difference is.

The reason for why I am asking is that I have grown very found of c#, but I am often being told that it is a lot slower the c when it comes to pure data processing, and the program I am looking into starting on now is a ray tracer and I do not want to spend ages working on it only to later find that I could get a 25% speed increase or something by simply redoing it i c.

And, I am not looking into starting a flame war, if admins feel that this is a bad road to go down, feel free to close this thread.

Regards
h3ro is offline   Reply With Quote
Old 10-16-2009, 04:13 PM   #2
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
There's this:

Square root of x divided by zero: The speed, size and dependability of programming languages

Which I would reckon C# will probably be fine based on that.

If I were you, I would come up with my own parallel tests in C & C#, something akin to the kind of data processing you want to do, and benchmark those.
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is offline   Reply With Quote
Old 10-16-2009, 04:17 PM   #3
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,381
Quote:
Originally Posted by h3ro View Post
The reason for why I am asking is that I have grown very found of c#, but I am often being told that it is a lot slower the c when it comes to pure data processing, and the program I am looking into starting on now is a ray tracer and I do not want to spend ages working on it only to later find that I could get a 25% speed increase or something by simply redoing it i c.
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

As always, optimize algorithms first. Then profile, and optimize hotspots. If necessary, thunk out to native code for extremely time-sensitive operations. But rewriting a well-written program in another language just to get some fixed performance boost is crazy.
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot
brewbuck is offline   Reply With Quote
Old 10-16-2009, 04:21 PM   #4
Guest
 
Sebastiani's Avatar
 
Join Date: Aug 2001
Posts: 4,923
There's certainly no reason why a C# program must run slower, as it could be converted directly to machine code and thereby optimized further. In fact both Java and C# already have such facilities available (gcc, for instance, allows you to compile Java code directly). So it basically just boils down to how efficient the implementation is, really. In any case, whatever language you choose, there is generally a way to incorporate components written in assembly language if things get really tight.
Sebastiani is offline   Reply With Quote
Old 10-16-2009, 04:26 PM   #5
Registered User
 
Join Date: Dec 2008
Posts: 71
Normally, I do a quick check at http://shootout.alioth.debian.org to have a general idea of how languages fare in terms of speed. The implementations of some of their programs could be a bit better though, but in general, I found them to be accurate.

I agree with brewbuck in that a 25% gain is just not worth it. Perhaps if your application absolutely needs the performance boost you could make the switch, but then you'd also have to consider the development time and the extra dependencies (Since C's standard library will most likely be insufficient for such a task).

Last edited by Ronix; 10-16-2009 at 07:21 PM.
Ronix is offline   Reply With Quote
Old 10-16-2009, 04:56 PM   #6
(?<!re)tired
 
Mario F.'s Avatar
 
Join Date: May 2006
Location: Portugal
Posts: 5,220
Quote:
Originally Posted by brewbuck View Post
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
It will be my signature as soon as I finish posting this.

As for the initial question. I'm currently studying the programming language. I'm not an expert on these matters by far, but you can still be a monkey and perform simple and yet intensive data processing tests. From what I observed so far there's absolutely no reason to believe C# under-performs in any way when compared to C or C++.

If anything one could expect a slight delay initiating the application as its assembled CIL is compiled on the fly. But after that, when you hit the Run Tests button, I can't see much difference between any of the languages. So the only disadvantage in terms of performance I can imagine on an application written in C# is if it needs to be executed several times in quick succession and for some reason it is being compiled by the JIT everytime.

Meanwhile NGEN eliminates the need for JIT compilation. As this technology matures (or so one can hope), it's expectable that those few areas where C# still has trouble matching C++ performance (3D programming rings a bell) will disappear. But as far as raw data processing is concerned, quite frankly only bad intentions can say the language is slower.

The London Stock Exchange run on a managed platform written in C#. I can hardly think of higher requirements concerning performance and volume of raw data processing. Especially coming from one of the busiest stock exchange markets in the world. These things run in real-time, process huge volumes of data and even have to have an uptime of... 99.9%?

Tell that to those people you hear saying C# is slow. And if they are developing an application that has higher performance requirements than the London Stock Exchange, then promise them you will pay attention to what they have to say. Otherwise you know where to send them.
__________________
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.


Mario F. is offline   Reply With Quote
Old 10-16-2009, 05:31 PM   #7
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
Quote:
Originally Posted by Mario F.
The London Stock Exchange run on a managed platform written in C#. I can hardly think of higher requirements concerning performance and volume of raw data processing. Especially coming from one of the busiest stock exchange markets in the world. These things run in real-time, process huge volumes of data and even have to have an uptime of... 99.9%?
Hmm, might want to read this before using that as an example. London Stock Exchange to abandon failed Windows platform.
__________________
bit∙hub [bit-huhb] n. A source and destination for information.
bithub is offline   Reply With Quote
Old 10-16-2009, 05:33 PM   #8
Registered User
 
Join Date: Oct 2008
Posts: 452
Quote:
Originally Posted by brewbuck View Post
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
Say that to professional game developers or operating system programmers, where 25% performance boost may very well be a significant difference. And where asking all the users to get a PC that's 25% faster may kill your project...
EVOEx is offline   Reply With Quote
Old 10-16-2009, 05:43 PM   #9
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,381
Quote:
Originally Posted by EVOEx View Post
Say that to professional game developers or operating system programmers, where 25% performance boost may very well be a significant difference. And where asking all the users to get a PC that's 25% faster may kill your project...
Professional game programmers and operating systems developers tend to think more carefully about their choice of language BEFORE starting a huge project, not a significant way into the project.
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot
brewbuck is offline   Reply With Quote
Old 10-16-2009, 06:01 PM   #10
(?<!re)tired
 
Mario F.'s Avatar
 
Join Date: May 2006
Location: Portugal
Posts: 5,220
Quote:
Originally Posted by bithub View Post
Hmm, might want to read this before using that as an example. London Stock Exchange to abandon failed Windows platform.
Interesting bit of information. Didn't know about it. Thanks. I'll certainly keep an eye on news about it.

A few random thoughts though:
  • The author of the article is obviously quite biased. His language and his conclusions betray him.
  • It's not clear what exactly happened and why the system is being abandoned. But serving such a huge platform on machines running Windows 2003 and SQL server 2000 can be part of the answer. Not so much the capacity of managed code to answer the requirements.
  • The most meaningful arguments the author makes aren't provided along with a quote to validate them. It becomes his word. So I'm left without knowing exactly how did LSE underperfomed and by what margin, how faster exactly was Masketprizm.
  • He talks too much of his sources inside LSE but I never heard of this journalist before. he sould make a name for himself before expecting people to blindly accept his unnamed sources as evidence.
  • I couldn't find any sources where LSE admits they will be removing the platform. This article speaks of a Financial Times article. But couldn't find it anywhere.
  • Meanwhile I've read at least twice LSE is reported (1, 2) to have clearly stated this to not have been an issue with TradeElect (the managed software in question). Any comments of the type "oh, really?" are then left unquoted.
Finally, I prefer this type of journalism.

In any case thanks for that. You are right. At this point that becomes a bad argument.
__________________
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.



Last edited by Mario F.; 10-16-2009 at 06:06 PM.
Mario F. is offline   Reply With Quote
Old 10-17-2009, 11:17 AM   #11
Unregistered User
 
Yarin's Avatar
 
Join Date: Jul 2007
Posts: 925
Quote:
Originally Posted by bithub View Post
Hmm, might want to read this before using that as an example. London Stock Exchange to abandon failed Windows platform.
Yeah, well... they deserve it for using .NET.
__________________
GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64
Yarin is offline   Reply With Quote
Old 10-17-2009, 11:57 AM   #12
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,470
Quote:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
Unless you are requiring all of your customers to buy the new 25% faster computer. Let's say you have 5000 machines you need to replace to run your new code. Now the cost is not worth it.

Also everyone forgets that if you want to distribute C# you should be bringing it down to native since anyone but anyone can get a small app off the net and read your source from the assembly. Once you bring it down to native you lose the speed and size benefits of C#. C# is a great language but let's keep it in it's rightful place. It was not designed to completely replace C/C++ and I doubt it ever will. But combined with C/C++ and C++/CLI it does offer some very nice flexibility and makes language interop much easier. After messing around with XNA and comparing it with the same type of app in C++ there really isn't a comparison. The native DirectX code ran almost 3 times as fast in debug as the XNA in release. The test was based on FPS measurements. I cannot reveal the details of the test but the C++ was doing far more and had several scripts running behind the scenes whereas the XNA did not. Even with all that C/C++ and native D3D were doing inefficiently it still trashed XNA's performance by a factor of 2 and sometimes 3. So basically brute-force D3D destroyed optimized XNA.

The only thing that XNA did well was texture loading since it compiles all your resources into a binary format which appears to load very quickly. Overall not impressed with the XNA side. Basically it tells me if I optimize XNA as I would optimize Direct3D I will still be slower by a factor of 2 or 3 if I were to use it for what I need to do. Unacceptable.
__________________
If you aim at everything you will hit something but you won't know what it is.

Last edited by Bubba; 10-17-2009 at 12:12 PM.
Bubba is offline   Reply With Quote
Old 10-18-2009, 06:28 AM   #13
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
Quote:
Originally Posted by Mario F. View Post
Finally, I prefer this type of journalism.
You mean the kind that involves a few phone calls to make sure the right parties will be reading what they want to see? No one at at FT is into MS stock (sarcasm), I'm sure, and this is not a boat many people will want to see rock.

I guess we all believe what we like.
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS

Last edited by MK27; 10-18-2009 at 06:30 AM.
MK27 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am very new . . . :( Eternalglory47 C++ Programming 6 09-05-2008 11:29 AM
Flight Simulator Wind Speed!! Dilmerv C++ Programming 6 03-20-2006 12:40 AM
Calculating total distance travelled from time and varying speed collin C Programming 6 01-08-2006 02:49 PM
increased net speed PING General Discussions 20 03-29-2005 07:05 AM
Strange loop D@rk_force C++ Programming 22 12-18-2004 02:40 PM


All times are GMT -6. The time now is 10:47 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22