The resource loading... loading...

What happens when a strategy loop is used once and then neglected?

Author: Wa-emmnn_, Created: 2023-11-12 15:00:24, Updated:

I'm going to teach you guys how it happens when you use a strategy loop once, sometimes 60ms at a time, sometimes 10,000+ms at a time, and then you're going to have to go through a lot of different strategies. I timed each function internally, and found that when I was little, all functions were small, and when I was big, all functions were big. And one feature is to update the chart information, the status bar information takes longer to use than the market information =。= Is this caused by the cloud server, using Amazon's t2.micro.


More

Help (click on the image to get in touch)The graph state bar is theoretically just a demonstration that the slow cause should be the network IO, running the network IO parts in the loop as concurrently as possible

Inventors quantify - small dreamsIs it real or retested? The content of the status bar is refreshed frequently, and the refresh rate is not fast, so the content displayed is not immediately displayed the current status bar content. The real-time consumption is basically generated by network IO requests, other operation time can be largely ignored.

Skin that is oldUpdate chart information, state bar information can be used with multiple threads

Inventors quantify - small dreamsReduce the for loop to 10 times and observe again.

Wa-emmnn_I've found that one place takes longer, and the for loop ends up being 220+, what's the reason? var A = new Date (().getTime (() is the current time var B is equal to 0 var C is equal to 0. for (var i = 0; i < 1000; i++) { // all the computations inside the loop. B=new Date (().getTime (() -A) is the current date. I'm not sure. C=new Date (().getTime (() -A) is the current date. // output B is equal to 6 and C is equal to 220+ I'm just taking my time, I don't know if there's a problem.

Wa-emmnn_Thank you.

Inventors quantify - small dreamsIt is said that without a network IO, it will not take much time, usually in a few milliseconds. Instead of a simple test scenario, rule out whether the problem is caused by strategic design.

Wa-emmnn_It's a real disk, and I've calculated that when I use it, it's always small and large. It's not just a state bar, all the functions take basically the same amount of time.

Wa-emmnn_Thank you for your thoughts QAQ