Canvas vs Labels - page 9

 
The text output to the label is 100 times faster than the text output to the canvas, even though the canvas wasn't even clearing, it was sculpting the text onto the text.
 
Alexey Viktorov:

Dimitri, before judging something you need to understand where it all started...

If I'm not mistaken, somewhere along the line it said fifty lines...

Where did it all start? With a break from reality?

 
Dmitry Fedoseev:
It's 100 times faster to output text to label than to kanvas, even though kanvas wasn't even clearing, it was sculpting text onto text.

I'll be presenting tests soon, where Kanvas is fast enough too. And I'll also update the relevant source code in KB. It's all about limiting the number of updates per unit of time, as I found out later. See the posts above, it was discussed there. Start with this post: https://www.mql5.com/ru/forum/364640/page6#comment_21290218.

 
Mihail Matkovskij:

I'll be presenting tests soon, where Kanvas is fast enough too. And I'll also update the relevant source code in KB. It's all about limiting the number of updates per unit of time, as I found out later. See the posts above, it was discussed there. Start with this post: https://www.mql5.com/ru/forum/364640/page6#comment_21290218.

And I'm not fantasising, I'm measuring the performance of the code that would apply in reality. And I don't care at all what and where it's rendered, I'm measuring the final running time of the program.

 
Even a purely dumb comparison of just one call to TextOut() is 70 times slower than outputting text to the label.
 
Dmitry Fedoseev:

And I'm not fantasizing, but measuring the performance of code which would be applied in reality.

Dmitry Fedoseev:
Even a purely dumb comparison of just one call to TextOut() is 70 times slower than outputting text to the label.

If you don't want or can't understand it, here's a quote:

Renat Fatkhullin:

Nikolai is right - editing label properties has nothing to do with rendering the label.

The label, as any other object on the chart, is drawn in a totally different thread and independently from the operation of MQL5 program. The robot can only ask the chart to be forcefully rendered again, but can't measure the rendering time. Chart drawing with objects is completely asynchronous.

But rendering canvas is easy to measure as it is done directly in the flow of the robot and then during independent rendering of the chart it remains to do a native BitBlit of the bitmap ready in the context of the window. This operation is elementary and is well accelerated by the video card.

In text labels SetFont/TextOut in TTF fonts is quite expensive.
 
Mihail Matkovskij:

If you don't want or can't make sense of it, you get a quote:

And I've already answered you here

 
Dmitry Fedoseev:

And I've already answered you here

Are you going to arguewith the director of MetaQuotes?

 
Mihail Matkovskij:

Will you arguewith the director of MetaQuotes?

We have no disagreement.

 
Dmitry Fedoseev:
Even a purely dumb comparison of just one call to TextOut() is 70 times slower than outputting text to the label.

This is because the rendering of the chart is done in a separate thread. Whereas the pixel array processing forOBJ_BITMAP_LABEL is in the same thread as the application using it, as well as passing the pixels to the bitmap. Therefore,OBJ_BITMAP_LABEL may slow down the application, but not significantly if the bitmap is not updated too often. Just in my previous tests, OBJ_BITMAP_LABEL caused significant slowdowns for the same reason. But if you limit bitmap update frequency, the result is even better than with labels. And if you limit the bitmap update rate, it will be slightly faster thanOBJ_BITMAP_LABEL (due to rendering in a separate thread).Simply, it makes no sense to update objects more frequently than the human eye can perceive. Hence the lags, all the objects in the chart when you update them too often.