How to get backtesting faster ? - page 3

 
Alain Verleyen:

This topic is about backtesting speed. "OOP doesn't affect performance" is just in your mind. OOP affects performance in mql4/mql5, that's a fact, try it, compare and measure to adjust your mind to reality.

That doesn't mean OOP is bad or anything, but speed is certainly not an argument in favor of OOP with mql4/mql5 . I am tired to read "mind view" with no facts to support it. In any sense. Programming, including OOP, doesn't need "supporters", it needs facts and scientific approach.

Attached, well known MovingAverage EA provided with each platform, and the same EA where I used some classes from Standard Library. Make some backtests and come back to tell us that "OOP dont affects to performance".

2017.08.13 14:12:31.109    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.062. Test passed in 0:02:06.782 (including ticks preprocessing 0:00:11.250).
2017.08.13 14:15:50.670    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:55.875.
2017.08.13 14:19:13.222    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:58.328.
2017.08.13 14:21:32.225    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:57.204.

"Normal" version.

2017.08.13 14:24:29.951    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.141. Test passed in 0:02:24.906 (including ticks preprocessing 0:00:11.610).
2017.08.13 14:27:09.976    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:02:19.984.
2017.08.13 14:29:28.202    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.031. Test passed in 0:02:13.094.
2017.08.13 14:31:59.773    Core 1    EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:02:19.703.

"OOP" version. Such very basic OOP usage is already 12.5% slower at minimum.


I think you are kidding if you use standard library as performance example. But I agree with you. The only truth are facts. Take one. My framework uses OOP deeply but outperforms native Bars datetime form easily. Are you sure OOP is slower or its the standard library implementation who penalty the performance?

https://www.mql5.com/en/forum/213355/page2

easy way to detect the end of a data hole with the 'new' mql5 functions .. how?
easy way to detect the end of a data hole with the 'new' mql5 functions .. how?
  • 2017.08.12
  • www.mql5.com
In the history data of m1 I have a hole - ok, can happen. E.g...
 
Juan Fernandez:

I think you are kidding if you use standard library as performance example. But I agree with you. The only truth are facts. Take one. My framework uses OOP deeply but outperforms native Bars datetime form easily. Are you sure OOP is slower or its the standard library implementation who penalty the performance?

https://www.mql5.com/en/forum/213355/page2

Only babbling, as always with you.

I challenge you to show us a faster backtest example using OOP versus "standard" coding.

 
Alain Verleyen:

Only babbling, as always with you.

I challenge you to show us a faster backtest example using OOP versus "standard" coding.

Ok. You have it here. Same performance. And as you know you always will have a small variation in results between tests for obvious reasons. No OOP penalty then if a code is slower with OOP the problem is the code itself, not OOP


Direct code



OOP code


Files:
Bug.mq5  6 kb
 
Juan Fernandez:

Ok. You have it here. Same performance. And as you know you always will have a small variation in results between tests for obvious reasons. No OOP penalty then if a code is slower with OOP the problem is the code itself, not OOP


Direct code



OOP code


You are a "funny" guy.

 
Alain Verleyen:

You are a "funny" guy.


Why? You say OOP is slower. A class with hierarchy is OOP. But is not slower than direct code. If you are confused about terms is your problem. Anyways as I told you before your example is the worst for blame OOP because that library is not created for be fast, it's for be easy to use. Then is normal have overhead.

 
Juan Fernandez:

Why? You say OOP is slower. A class with hierarchy is OOP. But is not slower than direct code. If you are confused about terms is your problem. Anyways as I told you before your example is the worst for blame OOP because that library is not created for be fast, it's for be easy to use. Then is normal have overhead.

OOP is slower when used in real EA. Anyone can now see how serious you are, with your "amazing" demonstration. You discredited yourself, you are not interested to learn or to share anything, just to be right, even when it's so obvious you are wrong. Enough time lost.
 
Juan Fernandez:

Ok. You have it here. Same performance. And as you know you always will have a small variation in results between tests for obvious reasons. No OOP penalty then if a code is slower with OOP the problem is the code itself, not OOP


Direct code



OOP code


What a beautiful OOP code.

 
Alain Verleyen:
OOP is slower when used in real EA. Anyone can now see how serious you are, with your amazing demonstration. You discredited yourself. Enough time lost.

It's a practical demostration you are wrong. But I agree with you. Its a waste of time...

 
Juan Fernandez:

It's a practical demostration you are wrong. But I agree with you. Its a waste of time...

It seems you are really thinking to have demonstrate something. Yes you have, but it's not what you think it is. I wish you nice dreams and a good night.
 
Marco vd Heijden:

What a beautiful OOP code.

The good is here...