Registered: Jul 2008
09-03-11 11:38 PM
Quote from bln:
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.
I am not going to debate that abstraction, object orientation, and bad design add's overhead. It does.
However to say that Java, C#, and Scala (which is Java) are bloated is actually incorrect. The problem with the typical compilers is that they only do a generic optimization. Even with special flags the optimization is still generic.
From the perspective of C# and .NET the JIT compiler dynamically analyses the code behavior and then optimizes. This is why if you are careful with how your write your C# code it can be darn fast. Additionally with C# you have access to low level C type constructs. These constructs can be used to speed up the application.
All of what you are talking about can be done with C#. And I have the additional advantage that I will not shoot myself in the foot via a core dump.
I also go by the theory that the slowest link is still and will always be the network connection. Sure you can speed up the link, and make your code the fastest that you can.
HOWEVER, all you are doing is running is an arms race. I know because the folks I dealt with wanted to create code in hardware via programmable circuits. Other folks I know create algo's that jump the gun and do probabilities.
Unless you happen to be one of the big institutional players you are going to be outgunned and picking up scraps. Not saying that it can't be done. However if you were starting out and trying to get going using the assembly, C or C++ route is just going to give you a heartache.