Which is faster - Floating-Point or Integer arithmetic? - page 4

 
Alain Verleyen:

I am not sure if you do it on purpose or not, hopefully not. Your test has nothing to do with what Fernando explained.


CDouble is a lib and wrapper. We were debating algorithms NOT data structures. You're just trying to win a "straw-man argument" just for the sake of arguing. My test had everything to do with what Fernando explained... in fact I even made the mistake of running in debug mode... running the compiled version on the platform gave me even better results.

  1. Both take a double as arg simulating the new Bid.
  2. <int> function converts double to int
  3. Both make 2500 comparisons in their respective data-type (NO Conversions in this loop!!! A straight-up comparison)
  4. Both finish in the same time.
Therefore, one must have greater than 2500 int comparisons in MQL5 to offset the latency introduced by rounding double and converting to int. Please run these tests yourself. Prove me wrong quantitatively instead of resorting to insults and straw-men. Opinions don't matter, only quantifiable results.

 
nicholishen:

CDouble is a lib and wrapper. We were debating algorithms NOT data structures. You're just trying to win a "straw-man argument" just for the sake of arguing. My test had everything to do with what Fernando explained... in fact I even made the mistake of running in debug mode... running the compiled version on the platform gave me even better results.

  1. Both take a double as arg simulating the new Bid.
  2. <int> function converts double to int
  3. Both make 2500 comparisons in their respective data-type (NO Conversions in this loop!!! A straight-up comparison)
  4. Both finish in the same time.
Therefore, one must have greater than 2500 int comparisons in MQL5 to offset the latency introduced by rounding double and converting to int. Please run these tests yourself. Prove me wrong quantitatively instead of resorting to insults and straw-men. Opinions don't matter, only quantifiable results.

Forum on trading, automated trading systems and testing trading strategies

double variable with wrong decimal cases

Fernando Carreiro, 2018.01.15 04:14

Need I remind you, that you were the one that hijacked this thread and started boasting your performance tests. Your assumption (or math) was incorrect so I did correct it (but you did not agree).

Until that point, no one had suggested using "ints". It was in fact the OP himself that came to that conclusion and decision, and for which I confirmed that I did  it too.

No one spoke about "ints" being faster either until you took it upon yourself to claim that they would slow things down and even started using "longs" instead.

This was never a "personal" matter, as I could care less if you or anyone else uses "ints" or not, but I felt obliged to correct your assumption (or math) of the performance claim that you made.

When I state that "I give up", it is simply a statement of rendition, because even when I do try to correct your "math", you find someway to circumvent it and claim that we are just trying to attack you on some "personal level" instead of on the facts. That certainly is not the mindset of a scientific approach.

Pardon me, but as far as I can see, you are the only one making this a "personal matter"!

So, if you don't like my "I give up" statement; maybe you will prefer this instead - Live long and prosper!


 
Alain Verleyen:


I'm literally the only one in this thread presenting evidence.

 
Alain Verleyen:

Test results on MT5 build 1745 (100 arithmetic operations), method 5 is using CDouble instead of double.

Using ints is 8 times faster. Using CDouble is 4 times slower.

Wow! Looking at your test results, I suddenly realised that Integer arithmetic in MT5 is way faster than MT4. My results in post #16 were from a MT4 run, but when I ran it on MT5 there was a drastic improvement, also on floating point, but mostly on integer and long.

I had not realised before this, that the MT4/MT5 difference was so accentuated. This makes me want to use "int" even more in my EA's!

 
nicholishen:

I'm literally the only one in this thread presenting evidence.

Forum on trading, automated trading systems and testing trading strategies

double variable with wrong decimal ca

Alain Verleyen, 2018.01.15 04:04


Test results on MT5 build 1745 (100 arithmetic operations), method 5 is using CDouble instead of double.

1: 17749 ms for 100000000 iterations

2: 16049 ms for 100000000 iterations

3: 1972 ms for 100000000 iterations

4: 1944 ms for 100000000 iterations

5: 65246 ms for 100000000 iterations

Using ints is 8 times faster. Using CDouble is 4 times slower.


 
Fernando Carreiro:

Wow! Looking at your test results, I suddenly realised that Integer arithmetic in MT5 is way faster than MT4. My results in post #16 were from a MT4 run, but when I ran it on MT5 there was a drastic improvement, also on floating point, but mostly on integer and long.

Yes they are, MT5 is really faster in general, with some specific exceptions.

I had not realised before this, that the MT4/MT5 difference was so accentuated. This makes me want to use "int" even more in my EA's!

loool

 
nicholishen: I'm literally the only one in this thread presenting evidence.
That must be the most conceited and arrogant statement I have seen so far on this thread! Congratulations on your promotion to demi-god status, or do you prefer the title "Supreme Leader"?
 
Fernando Carreiro:
That must be the most conceited and arrogant statement I have seen so far on this thread! Congratulations on your promotion to demi-god status, or do you prefer the title "Supreme Leader"!

I must have missed it... sorry.... please point me to the evidence...

 
nicholishen:

There you go with that straw-man again! HAHAHA CDouble is a rounding library, you know, like when you have to send an order.... and only when you send an order. You are so far off point it's a joke. CDouble is not a double type replacement and apparently you are the only one who thinks so. You can't simply agree that for every-day use, int conversion is the worst algo. Alain, NOBODY is talking about CDouble... If you want to talk algos specifically bring on some ideas instead of your constant trolling, please for the love of god!

You introduced CDouble in the first place so I was curious to include it in the performance test. Of course I knew the answer before running the test, but it was a scientific discussion.

For professional coders, performance is ALWAYS an issue (though not the only one obviously). 

nicholishen:

I must have missed it... sorry.... please point me to the evidence...

It was done numerous time. But you can't see them.

This topic was very instructive.

 
Alain Verleyen:

You introduced CDouble in the first place so I was curious to include it in the performance test. Of course I knew the answer before running the test, but it was a scientific discussion.

For professional coders, performance is ALWAYS an issue (though not the only one obviously). 

It was done numerous time. But you can't see them.

This topic was very instructive.

I agree! I learnt something new about MT5 performance that I had not quantified before. Also, with all the tests and evidence presented, I plan to make much more use of Integer arithmetic from now on.