FORUMS BROKERS SOFTWARE
Home
 
    Forums > Technically Speaking > Programming > Java vs C++ or C#


Reply
 
Thread Tools
Old Sep 1st, 2011, 12:00 PM   #31
christianhgross
 
 
Join Date: Jul 2008
Location: Cayman's...
Posts: 353
I have written automated systems in all three languages.

First C++ is WAY WAY WAY overrated as a superior language. I am an old guy here and I remember when the Fortran people used to say, "oh that C++ will never be as fast as Fortran". Lo and behold it was and now the C++ people are saying the same thing.

With all that being said, the reality is as follows.

C++ is faster if you chuck the "safety" features of programming languages and avoid things like STL, and Boost. In raw bytes to bytes C++ is faster, but then again so is C.

The moment you add the baggage of STL, and Boost you are slower than well written C# code. The advantage that the C# JIT and Java jit have is that those safety features are well optimized. C++ safety features rely on the optimization of the compiler.

Thus if you are not careful with your STL, and Boost code you will have a lame duck of an application.

If you are not careful with your object references in C# or Java then you will also have lame duck applications.

Let me illustrate... We all know about OHLC (Open High Low Close) The classical object approach is to define the OHLC as individual classes and put it into a List<OHLC>.

THAT IS MEGA SLOW... In C# you need to define the OHLC as a struct and then create an array like the following OHLC[]. That simple step in itself has a massive speed up factor.

I personally would never touch C++ again. I would rather tweak and optimize my C# or Java code. My development with C# or Java is 100 times more productive than farting around with a dangling C++ pointer that causes a core dump.

If you plan on using C# or Java make sure to invest into a profiler like the one from Jet Brains. A profile will quantify what is slow code, and not be reliant on what you think is slow.
    Quote
Old Sep 1st, 2011, 12:36 PM   #32
rwk
 
 
Join Date: Dec 2003
Posts: 1,087
Quote:
Quote from christianhgross:
... My development with C# or Java is 100 times more productive than farting around with a dangling C++ pointer that causes a core dump...
Programmer productivity is almost always the more important factor, and so the best language is usually the one you already know (unless it's Fortran or Cobol ). Also, upgrading to more powerful hardware is often cheaper than re-optimizing software unless you've done something really dumb.
    Quote
Old Sep 1st, 2011, 01:34 PM   #33
christianhgross
 
 
Join Date: Jul 2008
Location: Cayman's...
Posts: 353
Quote:
Quote from rwk:

Programmer productivity is almost always the more important factor, and so the best language is usually the one you already know (unless it's Fortran or Cobol ). Also, upgrading to more powerful hardware is often cheaper than re-optimizing software unless you've done something really dumb.
I did not want to say that as an argument... But yeah I agree with you. I am so much more productive with C#, or Java.
    Quote
Old Sep 2nd, 2011, 09:08 AM   #34
syswizard
 
 
Join Date: Jun 2004
Location: PA
Posts: 3,987
I think one of the largest Java platform's is ThinkorSwim's desktop application. It's gotta be 1/2 million lines of code....at least.....and it uses multithreading to-the-max.
    Quote
Old Sep 2nd, 2011, 02:58 PM   #35
christianhgross
 
 
Join Date: Jul 2008
Location: Cayman's...
Posts: 353
Quote:
Quote from syswizard:

I think one of the largest Java platform's is ThinkorSwim's desktop application. It's gotta be 1/2 million lines of code....at least.....and it uses multithreading to-the-max.
Or Interactive Brokers... Think or Swim is considered a dog by some. However I always thought IB's TWS was pretty quick.
    Quote
Old Sep 3rd, 2011, 04:32 AM   #36
bln
 
 
Join Date: Nov 2009
Posts: 111
In my humble opinion higher abstract level languages like Java, C#, Scala, etc is to bloated for any low latency work.

Abstraction add overhead, object orientation add overhead. Bad design add overhead.

I use C and Assembler for my HF and algo stuff as it's what I'm used to and is a little bit faster than C++.

Some stuff of concern to me:

- Most efficient L1/L2/L3 cache utilization. Use as small data types as possible to pack as much data as possible into the caches.

- Context switching and maximum best thread design, keep all cores saturated at full speed at lowest overhead.

- Most efficient transfer and utilization of the memory bus between the main memory and CPU/Caches, here size of the used data types play an role.

- Lowest size footprint, you want your code and variables to reside in the caches to the most so you do not get to much slow memory access.
    Quote
 
Reply
Thread Tools

Forum Jump



   Conduct Rules   Privacy Policy   Sitemap Copyright © 2014, Elite Trader. All rights reserved.   

WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Trading & Clearing
AMP Global Clearing
Futures and FX Trading
Collective2
Automated Trading Services
CTS
Futures Trading Software
dom993trading.com
NinjaTrader Consulting
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
NinjaTrader
Trading Software Provider
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thenut-trader.com
FX, Gold, & Stock Signals
TradersStudio
System Building & Backtesting
Tradier
Equity and Options Trading
Trading Technologies
Trading Software Provider