Java/C++ language shootout http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=gpp&lang2=java Gives some idea of the relative performance of C++ and Java. In the real world, of course, things can be significantly different to benchmarks. These set of benchmarks are run on JDK 1.5. 1.6.0 is reportedly significantly faster.
I originally wrote my backtesting code in C++. Then decided to move to C# (Microsoft's analog of Java). The program ran 10 times slower! I looked into it - it wanted to verify every array boundary, couldn't do any inlining, couldn't use any MMX instruction. After tweaking with compiler options, using some "unsafe" code etc, I was able to reduce that difference to about x2. But it really does save development time, primarily because the library (.NET) is very large and very convenient. I think as long as the time my computer spends on calculations is not too large compared to time I spend on writing code, C#=Java is the way to go.
For fast loading and snappy performance, native win32 code cannot be beaten. Having coded in c, c++, java, and now c#, it's hard to go back to c/c++ after coding in java or c#. I would also advise going with java or c# for most projects. You will find that the actual code is the bottleneck most of the time and not the language. If you still feel your app or process requires more speed, code it in c or assembler and you can call unnmanaged DLLs from c#. Just remember, the called dll will be unmanaged and you will have to take care of cleaning it up yourself.
First let me state that I come from a background of coding C/C++ for embedded systems. Coding in C++ will give you at least 2.5X the performance of an equivalent JAVA application. We found this out recently when we needed to port a JAVA application which was just not cutting it in real time, and then measured the delta. This being said.... usually JAVA will meet the needs of most programmers for desktop applications. If you are not comfortable with C++ and do not require real-time intensive processing, I would urge you to take JAVA for a spin for development. There are also some good things to be said for C# in an MS CLR environment.... however keep an eye on your real-time requirements. Discussions over programming language selection tend to become a "religious debate". I would tell you to select something that appears to be reasonable for the constraints of your application (memory, real-time, interface, etc.) and run with it. Programming languages are sort of like riding a bike... once you rode one then you can figure out the others, just a matter of complexity and syntax. - Greg
I wanted to say one more thing to the OP... If you have to ask this question on a public board, then your system is NOT so speed-sensitive as to require C++ over Java.
Ill take that one step further. If you have to ask on a public forum, C++ is far too complex/difficult a language for you to be writing systems that could lose all your money automagically
Well, with generics and annotations and other stuff Java isn't turning exactly in a piece of cake. Thankfully.
Interesting discussion. I agree that Java makes for a nice development environment (particularly as how NetBeans is evolving). C# is also nice w/ dev studio. I personally prefer Qt/c++. But I'll never forget my first backtesting app written in c with pointer arithemtic. I could backtest 7 years of 1-minute bars on ES in 2 seconds. Yes, 2 seconds.
if your project involves capturing streaming times series data, consider that java and C# are not real-time languages. They run on an underlying virtual machine which controls execution. The java and C# VMs will halt your program for short periods of time while it does things like garbage collecting memory. This is not like using standard 'C' where you have more control over these things. Something to consider. If you will be dealing with time series, go with Linux and C.
yes that says it all cmaxb. java and C# are nice and easy for most general projects. But for performance in backtesting and capturing streaming data, C/C++ is the way to go. Yes QT4 is nice.