Asynchronous and multi-threaded programming in MQL - page 39

 
Andrey Barinov:
...

What can be found by eye in a table of 1000 rows by scrolling? What problem is being solved?

P.S. Offtopic again...

Andrew, the task was to allow the user to create any table. Like in Sharp. You never know what he may have in mind...)).

I suggest we end the offtopic)).


To be fair, you can only redraw the visible part of the table, and only redraw the invisible part on a scroll event. But again, this was a stress test.


It all depends on how exactly the values in the table are changing. If the values change very quickly and constantly, then it's better to redraw only the visible area, and redraw the invisible during scrolling. If values are changing infrequently, it is better to redraw all at once, so that at the moment of start of scrolling there is no delay because of redrawing. Since you never know exactly how often the values in the table will change, I have chosen a universal method - redraw all at once. You don't see too many tables with values jumping around like crazy, so it's better to redraw them all at once. So, it's better to redraw the whole canvas at once and bypass the delay at the beginning of the scrolling.

SZY. Have you seen how long it takes to redraw a canvas of 900*7000 pixels? Even with MT5, this delay can reach hundreds of milliseconds. It is very unpleasant to get such delay when you start scrolling. Therefore, if the redrawing frequency is low, it is better to draw all at once.

Getting back to the topic - this is one of the reasons for the need for multi-threading in MT5!)


One last thing. In order to avoid problem with processor overload when too often redrawing large tables, I chose another way. I made a special regulator to adjust speed of changing values. That is, the values change quickly, but the user regulates the speed of their output (redrawing) with slider (I showed it). Thus, the load on the processor is reduced at times and the user is more convenient to perceive the information from the table.

 
Реter Konow:

Andrei, the task was to allow the user to create any table. Just like in Sharp. You never know what he'll get into his head...))

I suggest to finish offtopic)).


To be fair, you can redraw only the visible part of the table, you can redraw the invisible part only on a scroll event. But again, it was a stress test.


SZY. It all depends on how exactly the values in the table change. If the values change very quickly and constantly, then it's better to redraw only the visible area, and redraw the invisible during scrolling. If values are changing infrequently, it is better to redraw all at once, so that at the moment of start of scrolling there is no delay because of redrawing. Since you never know exactly how often the values in the table will change, I have chosen a universal method - redraw all at once. You don't see too many tables with values jumping around like crazy, so it's better to redraw them all at once. So, it's better to redraw the whole canvas at once and bypass the delay at the beginning of the scrolling.

SZY. Have you seen how long it takes to redraw a canvas of 900*7000 pixels? Even with MT5, this delay can reach hundreds of milliseconds. It is very unpleasant to get such delay when you start scrolling. Therefore, if the redrawing frequency is low, it is better to draw all at once.

Going back to the topic - this is one of the reasons of need of multithreading in MT5!)


One last thing. In order to avoid problem with processor overload when too often redrawing large tables, I chose another way. I made a special regulator to adjust speed of changing values. That is, the values change quickly, but the user regulates the speed of their output (redrawing) with slider (I showed it). Thus, the load on the processor is reduced at times and the user is more convenient to perceive the information from the table.

Peter, do you understand the difference between asynchrony, multithreading and parallelism?

 
Sergey Chalyshev:

Peter, do you understand the difference between asynchrony, multithreading and parallelism?

I suggest you give an example of asynchronous or parallel operation in a single thread.
 
Реter Konow:
I suggest giving an example of asynchronous or parallel operation in the same thread.

OK, bring it on!

 
Sergey Chalyshev:

OK, Bring it on!

I don't know of any.

Flow only offers a sequence, and it is difficult to be parallel within a narrow sequence. One can only be asynchronous within a sequence speculatively, looking back at one's previous roundabout passes and noting new twists on the old route, proudly thinking one is following a new path...

Understand, the limits of single-threadedness cannot be overcome by the ingenuity of a self-confident coder who believes that countless parallel lines can pass through a single point. This non-Euclidean geometry does not fit into the program's realities and does not add asynchrony to the processes inside the thread.
 
Sergey Chalyshev:

OK, bring it on!

One-handed clapping? Zen outward is not Zen :-)

Well you know for a fact that Peter stays out of the sandbox. He basically can't understand the terms.

what's the point of asking questions like that? well he's going to start blabbering like a professional reporter

 
Maxim Kuznetsov:

Clapping one hand with the other? Zen outwards is not Zen :-)

Well you know for a fact that Peter stays out of the sandbox. He basically can't understand the terms.

what's the point of asking questions like that? well, he'll start blabbering like a professional reporter.

Why would he flub? I'm laughing. Well, then give me an example of single threaded asynchrony with paralleling. If it's anything other than self-defeating, I admit I'm wrong.
 
Guys, well, elementary logic. Well, how to make something asynchronous in one thread, jumping over a single sequence of actions? The only way is to move in a circle and at each iteration make a decision which operations to perform and which to postpone. But is it normal asynchrony? We should not speak about parallelism at all. What kind of parallelism can we have in one thread? ))

Two threads - two separate action sequences, asynchronous to each other.
 
Реter Konow:
Well, guys, it's elementary logic. Well, how can one thread do something asynchronous, jumping over a single sequence of operations? The only way is to move in a circle and at each iteration make a decision which operations to perform and which to postpone. But is it normal asynchrony? We should not speak about parallelism at all. What kind of parallelism can we have in one thread? ))

Two threads are two separated action sequences, asynchronous to each other.

Two, or twenty-two threads can be either synchronous or asynchronous. A single thread can include both synchronous and asynchronous operations. You have indicated how. Parallel does not know how to include the parallel ones.

 
Реter Konow:
Guys, well, elementary logic. Well, how to make something asynchronous in one thread, jumping over a single sequence of actions? The only way is to move in a circle and at each iteration make a decision which operations to perform and which to postpone. But is it normal asynchrony? We should not speak about parallelism at all. What kind of parallelism can we have in one thread? ))

The two threads are two separated action sequences, asynchronous to each other.

An asynchronous call does not necessarily create a new thread