Canvas vs Labels - page 4

 
Maxim Kuznetsov:

Obviously the Canvas (BitMap) is redrawn/copied in its entirety, but only the labels have changed. Why should I be surprised?

Canvas is just convenient and moderately fast.

Dmitry Fedoseev:
And without any comparative tests it's obvious that simple label will output text faster.

Of course, I knew it before. But I was convinced that using Kanvas is the fastest way to output. At the same time, it was terribly slow in the tester (when outputting data of an Expert Advisor being tested), especially on ticks. Using labels fixed the situation, of course. So I decided to find out how slow Kanvas really is compared to Labels. It turns out to be 321 times slower, if this measurement is to be believed.

 
Mihail Matkovskij:

Of course, I knew that before. But I was convinced that using Kanvas was the fastest way of output. However, in the tester (when outputting data of the EA under test) it was terribly slow, especially on ticks. Using labels fixed the situation, of course. So I decided to find out how slow Kanvas really is in comparison with Labels. It turns out 321 times, if this measurement is to be believed.

Well, aren't there a lot of fantasy storytellers in the world?

 
Dmitry Fedoseev:

Aren't there many fantasy storytellers in the world?

That's for sure!

 
Maxim Kuznetsov:

Obviously the Canvas (BitMap) is redrawn/copied in its entirety, but only the labels have changed. Why should I be surprised?

Canvas is just easy to use and moderately fast.

Why redraw the whole bitmap?
to prove it's slower than redrawing the label?

For a proper comparison, you should also redraw only part of the bitmap, the size of the marker.

 
Taras Slobodyanik:

Why redraw the whole bitmap?
to prove that it is slower than redrawing the label?

For proper comparison, you also need to redraw only part of the bitmap, the size of the label.

Actually this is how it updates:

all at once

 
Maxim Kuznetsov:

this is actually how it's updated:

all at once.

does it refresh or does it redraw?
I've never seen a slowdown when refreshing.

 
Taras Slobodyanik:

so is it being updated or redrawn?
I've never seen any lags when updating.

If you've never seen brakes when working with OBJ_BITMAP_LABEL, it's important to say where. If when working in the terminal, yes. The delay is insignificant. But if you take the work in the tester and also Model: All ticks or OHLC on M1, the constant passing of the m_pixels array using ResourceCreate is very noticeable. Pixel operations are generally considered to be the most costly in any program.

 
Maxim Kuznetsov:

this is actually how it's updated:

all at once

Eh, I remember that you could edit the canvas in the video buffer with a pixel, but it's so uninteresting(

 
Dmitry Fedoseev:

There aren't many fantasy storytellers in the world, are there?

Dmitry, before you judge something you have to understand where it all started...

Forum on trading, automated trading systems and testing of trading strategies

Errors, bugs, questions

Mihail Matkovskij, 2021.03.07 14:02

Comment outputs lines of completely different length (visually) while their length is exactly the same

Comment

Code:

void OnStart() {
  string str[5], res="";
  StringInit(str[0], 50, 'a');
  StringInit(str[1], 50, 'X');
  StringInit(str[2], 50, '=');
  StringInit(str[3], 50, ' ');
  StringInit(str[4], 50, ':');
  for (int i = 0; i < 5; i++) 
    res += str[i] + "\n";
  Comment(res);
}

How can I output lines withComment, that visually they were of the same length? For example, I want to output a table that has three columns so that the columns are equally spaced vertically.

If I'm not mistaken, somewhere along the line it said fifty rows...
 
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...

Better make an example where a Canvas based display overtakes the display from Labels! Like, if you want to disprove my claims, then by the law of logic you have to prove the opposite. Will it work...?