Quote from mhtrader:
Hey LeeD, I don't know who wrote that forum post, but it looks to me it was a LAWYER???... SO you are using a lawyer's post to show this?? OMG!
The information in the post is wrong or misleading at best! In your link the person posted the non-optimized version of the function because he couldn't find the function in release, it is optimized away do to the use of constants and function inlining. The C++ function in that post is way slower than the ASM function. I copied and pasted the function from your link and here is the real optimized function, the one that is faster, and I invite you and other to click on your link and check it and compare the actual code of the C++ function. My C++ compiler( that is not the best in the market) generates this 6 instructions:
PHP:
char cppToUpper(char c)
{
if (c > 122 || c < 97 )
01081000 8D 48 9F lea ecx,[eax-61h]
01081003 80 F9 19 cmp cl,19h
01081006 77 06 ja 0108100E
return c;
else return c - 32;
01081008 0F BE C0 movsx eax,al
0108100B 83 E8 20 sub eax,20h
}
0108100E C3 ret
LeeD next time try to fact-check before you post or you may be spreading a lie again.
Hi Mhtrader, I admit I didn't read the post I linked with prejudice. But I see neither did you read it very thoroughly.
The OP in
http://www.daniweb.com/forums/thread155136.html tests C++ code against his own assembly code "inlined" in a C++ function and the same assembly code compiled as a separate (pure assembler) module.
What he finds is inline assembler is substantially faster than assembler in a separate module (though it is the same code) and pure C++ takes zero execution time no matter what.
In fact, in my tests the C++ code compiles into:
Code:
; 78 : {
; 79 : stopwatch watch;
00024 ff d7 call edi
00026 89 44 24 14 mov DWORD PTR _watch$77957[esp+24], eax
; 80 : for (int i=0; i < 10000000; i++)
; 81 : {
; 82 :
; 83 : // cout << cppToUpper(c);
; 84 : //cout << cppToUpper(d);
; 85 : e= cppToUpper(c);
; 86 : e= cppToUpper(d);
; 87 : }
; 88 :
; 89 : }
0002a 8d 44 24 14 lea eax, DWORD PTR _watch$77957[esp+24]
0002e 50 push eax
0002f e8 00 00 00 00 call ??1stopwatch@@QAE@XZ ; stopwatch::~stopwatch
; 90 : cout << "That was C++\n";
00034 8b 0d 00 00 00
00 mov ecx, DWORD PTR __imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A
0003a 68 00 00 00 00 push OFFSET $SG-103
0003f 51 push ecx
00040 e8 00 00 00 00 call ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator<<<std::char_traits<char> >
As you can see the cycle is gone. This perfectly illustrates my earlier point that C++ compilers are capable of optimising away whole cycles.
I don't know what that long "disassembled" code refers to. It wasn't the reason I posted the link. I think it was quite clear from the post I linked that the poster himself was confused about the role of this code snippet and felt something was out of place.
Mhtrader, in conclusion, you are nitpicking.
For the sake of other readers, there was indeed a statement in my post which was incorrect. By an optimising C++ compiler "repeated summation would be replaced with a single multiplication". I tested this on 2 compilers I routinely use and neither of them does this kind of optimisation. My bad!
Quote from mhtrader:
Another of your smears:
However, observe how adamantly Mhtrader is defending the point that not letting users implement trading strategies in their favourite C# is a major selling point of his platform. I find watching it rather enjoyable and would hate to break his groove.
I have never mention what language the end user will use to write the strategies. I invite you to go thru the 12 pages to find that... you are not been noble.
In the opening post of this thread you wrote:
Quote from mhtrader:
-User written programs are not script languages. They are COMPILED for the CPU where it is running. No Java and No .NET, this is the real deal!!
How else can I interpret this other than:
1) You platform doesn't support trading strategies in C# ("No Java and No .NET")
2) It is a major selling point ("this is the real deal!!")
BTW, from your confrontational tone I detect you interpreted my post as a personal attack. I believe it was quite constructive but if you found it offensive I apologise. It wasn't my intent.