Errors, bugs, questions - page 2162

 
Artyom Trishkin:
Enum is an integer enumeration.
0,1,2,3..., etc...

If a function template contains

EnumToString();

problems occur...

 
Vladimir Pastushak:

If the function template contains

EnumToString();

Problems arise...

An example is needed.
 
Artyom Trishkin:
An example is needed.

I did an overload, one of which was a pattern...

so I could separate the flies from the cutlets...

 
Vladimir Pastushak:

I did an overload, one of which was a pattern...

so I could separate the flies from the cutlets...

I know the flies, I've seen the cutlets, but I can't see the problem without the function code.
 
Renat Fatkhullin:

Optimising maths: trying to use arrays instead of sqrt.

So taking an element by index from a simple array should be a very fast operation, shouldn't it?

 
Комбинатор:

so taking an element by index from a simple array should be a very fast operation, shouldn't it?

Where do you see a simple array?

It's a dynamic array of a managed language with all the control implications. And sqrt is a single native CPU instruction.


Welcome to the world of amazing discoveries of optimizations and the influence of a mass of factors in each case in each CPU generation, each difference in cache sizes, multitasking, penalties, etc.

Only 20 years ago I was tinkering with assembler code on a 486 processor, struggling with speeds which varied by tens of percent due to rearrangement of instructions, alignment and simple memory positioning. It seemed crazy, but Intel manuals and Vtune later explained the picture.

But today the situation with optimization results got out of hand long ago. There are so many different processors with different caches on the market that your code is guaranteed to execute at different speeds. Processor caches and processor architecture have a huge impact. Even dynamic CPU frequency control has to be turned off to remove tens of percent difference on a benchmark.

For instance: Atoms with cache misses seemingly on decent architecture or strangled U models often show multiple times lower results even on simple cases. More cache misses and goodbye.

 
Artyom Trishkin:
I know the flies, I've seen the cutlets, but the problem is not visible without the function code.
If an overloaded function has a string, there is a problem when you call it for an integer...
 
Renat Fatkhullin:

Where do you see a simple array?

It's not the right case to set complexity. Arrays are used everywhere, in indicators they are the main calculation part, and you are now almost directly admitting that your implementation of arrays is slow.

I believe that you are much better at optimizations, but from the point of view of a common user it looks strange - you state that MQL compiler generates code comparable to C++, but it suddenly turns out that arrays in MQL are not fast at all.
 
Комбинатор:

It is not the right case to set the complexity. Arrays are used everywhere, in indicators they are the main calculation part, and you are now almost directly admitting that your implementation of arrays is slow.

Compared to a direct single assembler command?

Yes, easily. Are you not aware that processors have long had pre-calculated tables of various mathematical functions built in. And expensive cpu math commands use them to speed things up.

We will do a detailed analysis of his example on Monday and find out the exact cause.
 
Renat Fatkhullin:

Compared to a direct single assembler command?

thearray index is at best also reduced to a direct single assembler command, so the question still stands