FORUMS BROKERS SOFTWARE
Home
 
    Forums > Technically Speaking > Programming > Anyone coding in Assembler?


Reply
 
Thread Tools
Old Jun 13th, 2012, 01:31 PM   #91
Makis
 
 
Join Date: Jan 2012
Posts: 43
After several embarrassing outages, LSE dumped their Windows/.NET infrastructure for a Linux/C++ based one and CTO Robin Paine 'resigned' back in 2010. Would be very interested to hear Robin's take on this.

Arguing that a microsoft OS and .NET can handle high transaction volumes at real time better than Linux/C++ is absurd.
    Quote
Old Jun 13th, 2012, 01:47 PM   #92
luckybastard
 
 
Join Date: Apr 2005
Posts: 279
Quote:
Quote from Makis:

After several embarrassing outages, LSE dumped their Windows/.NET infrastructure for a Linux/C++ based one and CTO Robin Paine 'resigned' back in 2010. Would be very interested to hear Robin's take on this.

Arguing that a microsoft OS and .NET can handle high transaction volumes at real time better than Linux/C++ is absurd.
Of course. It's just asking for problems to write stock exchange code for Windows. Not only because its TCP/IP layer is at least 3x slower, but also because you never know when your latency critical code is being executed and it can easily take 3000x more latency than a realtime OS like Redhat MRG
    Quote
Old Jun 13th, 2012, 02:49 PM   #93
tradelink
 
 
Join Date: Feb 2008
Posts: 577
we use both c++ and .net in tradelink. for many components of the librarys near identical code/algos are used across languages.

in bechmarks of applications constructed side by side in both languages, we've been surprised to see c# code outperform c++, significantly in some instances. other times c++ would win significantly, or they would be near approximate.

it's highly dependent on the task being performed and specifics of the implementation.

thankfully we have more than one choice so we can choose the tools best suited to a given task.
    Quote
Old Sep 8th, 2012, 09:50 PM   #94
xbaha
 
 
Join Date: Dec 1999
Location: riyadh, sa
Posts: 42
if you're latency is less than 0.001ms then think about re-coding in ASM..

the loop written by a bad language running 1000 times would take 1micro second to execute or less on an average hardware...

do the math!
    Quote
Old Sep 15th, 2012, 12:38 PM   #95
pfranz
 
 
Join Date: Nov 2009
Posts: 211
I quickly read this long thread, don't know whether I'm repeating points from someone else.
When programming complex systems like nowadays computers,you never know the outcome of a particular way of programming until you test. And testing shows that often, ways that look cumbersome produce the fastest results.
This totally supercedes the language you are using. So, though I believe that C# wastes machine resources, it can have parts correctly optimized which outperform standard C++.

Let me give you an example. Some years ago I read a study from AMD where they tried to do a simple task, copying memory, as fast as possible. They were just using Assembly.
They began with standard REP MOVSD and compared results with memory bandwidth: speed was much lower,so went on experimenting.
Any x86 programmer knows that REP MOVSD sucks a lot and is there for compatibility only.So he would think that using MOV, some jump instructions, and a bit of loop unrolling, interleaving instructions so that the superscalar pipe doesn't stall, would solve the problem.
That's what the study tried. And it improved the results, which remained far from the bandwidth limit.
To cut a long story short, they ended up examining the cache structure, and adding a loop - before the actual copy - which read a word from each cache line IN REVERSE ORDER to fill up the cache, using some specific AMD instructions (MFENCE, I believe).
This complicated program would nearly reach memory bandwidth.
Had someone written all that stuff in C (or even maybe C#), would have outperformed a straightforward ASM loop with MOV instructions,loop unrolling,instruction interleaving.

Yet I still use ASM in my Visual Basic 6 software, and get improvements in speed, which are quite useful for reducing order submission latency and dealing with many symbols data in fast markets, even on old hardware.
    Quote
Old Sep 16th, 2012, 10:56 AM   #96
braincell
 
 
Join Date: Jul 2011
Location: inside your bubble
Posts: 551
Quote:
Quote from pfranz:

I quickly read this long thread, don't know whether I'm repeating points from someone else.
When programming complex systems like nowadays computers,you never know the outcome of a particular way of programming until you test. And testing shows that often, ways that look cumbersome produce the fastest results.
This totally supercedes the language you are using. So, though I believe that C# wastes machine resources, it can have parts correctly optimized which outperform standard C++.

Let me give you an example. Some years ago I read a study from AMD where they tried to do a simple task, copying memory, as fast as possible. They were just using Assembly.
They began with standard REP MOVSD and compared results with memory bandwidth: speed was much lower,so went on experimenting.
Any x86 programmer knows that REP MOVSD sucks a lot and is there for compatibility only.So he would think that using MOV, some jump instructions, and a bit of loop unrolling, interleaving instructions so that the superscalar pipe doesn't stall, would solve the problem.
That's what the study tried. And it improved the results, which remained far from the bandwidth limit.
To cut a long story short, they ended up examining the cache structure, and adding a loop - before the actual copy - which read a word from each cache line IN REVERSE ORDER to fill up the cache, using some specific AMD instructions (MFENCE, I believe).
This complicated program would nearly reach memory bandwidth.
Had someone written all that stuff in C (or even maybe C#), would have outperformed a straightforward ASM loop with MOV instructions,loop unrolling,instruction interleaving.

Yet I still use ASM in my Visual Basic 6 software, and get improvements in speed, which are quite useful for reducing order submission latency and dealing with many symbols data in fast markets, even on old hardware.
It's good to know someone out there is using ASM.

As for your example, I agree, we (or actually I) completely forget sometimes that people who build compilers have entire dedicated teams for each of the simple functions, one of which is the one you mentioned with copying memory. A lot of these standardized tasks are handled superbly by C++ and are often faster than a straight forward ASM code, but, certain loops and complex conditionals get bugged up and slowed down with C++ compilers, so that's the only case I'd say ASM can be useful, and only if it's critical, ie your latency issue is a matter of nano-seconds just because of that little part. So the whole practice of trying to do ASM ends up being a fun experiment more than a truly useful functionality, in most cases.

In your case however, coding in anything other than VB6 would be faster (except in a few special cases). ;)
    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