Originally posted by eek
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: C# vs C++ performance
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "C# vs C++ performance"
Collapse
-
Originally posted by d000hg View PostI'd love to know how C# compared, they don't mention the test platform (that I could see) but I assume Linux. For a paper I would expect to know:- Hardware platform
- Operating system
- C++ compiler
- Was C++ 32 or 64 bit
- Java version
Are those details in there somewhere? For it to be a 100% credible paper we should be able to repeat the experiment. I'm not disputing the results, but such things are important. Are those data available?
Leave a comment:
-
I'd love to know how C# compared, they don't mention the test platform (that I could see) but I assume Linux. For a paper I would expect to know:- Hardware platform
- Operating system
- C++ compiler
- Was C++ 32 or 64 bit
- Java version
Are those details in there somewhere? For it to be a 100% credible paper we should be able to repeat the experiment. I'm not disputing the results, but such things are important. Are those data available?
Leave a comment:
-
Interesting paper from google comparing C++, Java, Scala and their own language Go here:
https://days2011.scala-lang.org/site...s3-1-Hundt.pdf
Leave a comment:
-
Originally posted by d000hg View PostSKA is an application which automatically sales, as are nearly all web-apps. Making arbitrary code multi-threaded effectively is hard.
I think you mean it automatically scales but in reality it doesn't. The vast majority of the work is a simple process which can be run in parallel.
Leave a comment:
-
Originally posted by doodab View PostI assume you are referring to solaris studio. The debugger(dbx) isn't actually written in Java at all, your problem is the IDE which is IIRC an old version of netbeans and quite likely tulip.
Have you tried using the latest version? Instructions to set it up with sun studio compiler and debugger can be found Configuring the NetBeans IDE for C/C++/Fortran - NetBeans IDE 7.0 here (solaris studio 12 is a way down the page)
One problem is the app is massive, even with the old native motif debugger it was slow, but bearable. But You're right we should research it a bit and see if we can't get a better version. With normal apps it's a bit slow but generally OK.
I've been meaning to hunt around for something better, maybe some open source thing, or get niftier with dbx.
Leave a comment:
-
Originally posted by BlasterBates View PostThe trouble is there's a lot of propoganda about VM' s being just as fast as a native compled code. That's baloney and always will be. Java and C# are 3GL languages just like any other that have their own runtime environments, there's an overhead and with a large amount of data that is very noticeable. I have to face a horribly slow Java app everyday that slows my productivity down. These 3GL's are great for User interfaces but shouldn't really be used for serious "Data processing"; you simply throw away CPU "bandwidth".
Have you tried using the latest version? Instructions to set it up with sun studio compiler and debugger can be found Configuring the NetBeans IDE for C/C++/Fortran - NetBeans IDE 7.0 here (solaris studio 12 is a way down the page)
Leave a comment:
-
The trouble is there's a lot of propoganda about VM' s being just as fast as a native compled code. That's baloney and always will be. Java and C# are 3GL languages just like any other that have their own runtime environments, there's an overhead and with a large amount of data that is very noticeable. I have to face a horribly slow Java app everyday that slows my productivity down. These 3GL's are great for User interfaces but shouldn't really be used for serious "Data processing"; you simply throw away CPU "bandwidth".
Leave a comment:
-
Originally posted by VectraMan View PostI ran it on a machine with dual cores. And it only used one. So there's your money wasted then.
Any code these days that aims to have high performance should not only be parallel to support multiple cores on the same box, but also (if that is required) multiple boxes working in sync towards same goal.
SKA C# code runs on a cluster with 1 TB of RAM and 144 cores.
HTH
Leave a comment:
-
Originally posted by VectraMan View PostNice work.
I can't see that any of this is doing any extra bounds checking or anything fundamentally different in the algorithms, so it has to come down to general inefficiencies of the runtime. To be honest, as much as I'm a C++ programmer and obviously wanted my side to win, I'm kind of suprised. I was expecting with all the improvements of JIT and modern processors to be getting about 10% at best with C++.
/clrure is a bit pointless really; without the ability to seemlessly integrate with native code I'd never bother with C++ .NET, and just use C#. If anything C# is probably easier for an experienced C++ programmer to figure out than C++ .NET.
I would still argue that for the average server side business or web app even a 2x speedup on something like that is irrelevant because what you are speeding up only represents a small fraction of where the time goes anyway. And as you pointed out the difference between good code and average code can be worth twice as much as the difference between languages, which means I'm probably best off sticking with Java.
Leave a comment:
-
Originally posted by AtW View Postx2 performance can be achieved by buying double number of cores - usually that's cheaper than paying for x2 time of programmer dealing with C++ buggy code.
Leave a comment:
-
Originally posted by doodab View PostI meant identical code as /clrure. I had a look at sorting small structures that contain a key & array index as I think that's more like something I would do, and disregarding setup, allocation, copying etc, just timing the call to the sort routines I got:
Native takes ~70ms for 1/2 million items
C++ CLR takes ~150ms
C# takes ~ 400ms using Array.Sort<T> and IComparer
C# with ~150ms using the "indirect" sort Array.Sort<int, T>
So the native code seems to have a 2x advantage and the best C# method seems to vary quite a bit depending on what you are sorting i.e. for the downloaded code the use of a delegate was fastest, I found IComparer faster and the indirect sort faster still.
I will knock something similar up in Java later if I can be arsed.
Edit: Java takes about 500ms out of the box (the code is a JUnit test BTW, force of habit) but can be reduced quite a lot by e.g. using latest VM instead of 1.5, tuning vmopts, so I'm down to sub 200ms now.
I can't see that any of this is doing any extra bounds checking or anything fundamentally different in the algorithms, so it has to come down to general inefficiencies of the runtime. To be honest, as much as I'm a C++ programmer and obviously wanted my side to win, I'm kind of suprised. I was expecting with all the improvements of JIT and modern processors to be getting about 10% at best with C++.
/clrure is a bit pointless really; without the ability to seemlessly integrate with native code I'd never bother with C++ .NET, and just use C#. If anything C# is probably easier for an experienced C++ programmer to figure out than C++ .NET.
Leave a comment:
-
Originally posted by AtW View Postx2 performance can be achieved by buying double number of cores - usually that's cheaper than paying for x2 time of programmer dealing with C++ buggy code.
HTH
Buying an x core processor is probably not much use for your average single thread noddy c# application. For most other uses though faster hardware is far more likely to fix a problem
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Streamline Your Retirement with iSIPP: A Solution for Contractor Pensions Sep 1 09:13
- Making the most of pension lump sums: overview for contractors Sep 1 08:36
- Umbrella company tribunal cases are opening up; are your wages subject to unlawful deductions, too? Aug 31 08:38
- Contractors, relabelling 'labour' as 'services' to appear 'fully contracted out' won't dupe IR35 inspectors Aug 31 08:30
- How often does HMRC check tax returns? Aug 30 08:27
- Work-life balance as an IT contractor: 5 top tips from a tech recruiter Aug 30 08:20
- Autumn Statement 2023 tipped to prioritise mental health, in a boost for UK workplaces Aug 29 08:33
- Final reminder for contractors to respond to the umbrella consultation (closing today) Aug 29 08:09
- Top 5 most in demand cyber security contract roles Aug 25 08:38
- Changes to the right to request flexible working are incoming, but how will contractors be affected? Aug 24 08:25
Leave a comment: