CN111580886A - Method and device for loading mass data through time slice rotation - Google Patents
Method and device for loading mass data through time slice rotation Download PDFInfo
- Publication number
- CN111580886A CN111580886A CN202010393621.6A CN202010393621A CN111580886A CN 111580886 A CN111580886 A CN 111580886A CN 202010393621 A CN202010393621 A CN 202010393621A CN 111580886 A CN111580886 A CN 111580886A
- Authority
- CN
- China
- Prior art keywords
- data
- loading
- timer
- loaded
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a method and a device for loading a large amount of data through time slice rotation, wherein the method comprises the following steps: step S1, when the main program responds to the data loading task, acquiring the data quantity which needs to be loaded currently by the main program, and starting a timer according to the acquired data quantity; step S2, according to the timer, the main program calls the data loading task at intervals, each time loads a small amount of data, until all data loading of the current loading task is completed; and step S3, when all the data of the current loading task are loaded, closing the timer, and completing the current data loading task.
Description
Technical Field
The invention relates to the technical field of UI (user interface) display, in particular to a method and a device for loading a large amount of UI data through time slice rotation.
Background
With the continuous development of science and technology, the importance of data is more and more emphasized, and the data recorded therewith is more and more. The recorded data presentation is generally loaded, sorted and displayed to the user by software. Problems are encountered when the amount of data is large.
The problem of large data display is generally solved by using a paged display, such as 100 records per page, to display a small portion of data at a time by switching from one page to the next. The method can solve the problem of loading the card, but also has some unfriendly places, the integrity is not very high when the user views the data, only one part can be seen at one time, and the method is not convenient if the front data and the back data need to be compared and viewed.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide a method and a device for loading a large amount of data through time slice rotation, so that complete data can be loaded at one time when a large amount of data is loaded, the normal execution of a main program is ensured, the problem of blockage is avoided, and the stable flow operation of the program is ensured.
To achieve the above object, the present invention provides a method for loading a large amount of data through a time slice carousel, comprising the steps of:
step S1, when the main program responds to the data loading task, acquiring the data quantity which needs to be loaded currently by the main program, and starting a timer according to the acquired data quantity;
step S2, according to the timer, the main program calls the data loading task at intervals, each time loads a small amount of data, until all data loading of the current loading task is completed;
and step S3, when all the data of the current loading task are loaded, closing the timer, and completing the current data loading task.
Preferably, in step S1, the timer is started when the acquired amount of data currently required to be loaded exceeds a preset threshold.
Preferably, in step S2, the main routine loads a predetermined amount of small data each time the data loading task is invoked.
Preferably, in step S2, the loading task is invoked every 1-5 ms according to a timer.
Preferably, in step S2, 5 to 10 pieces of data are loaded at a time.
To achieve the above object, the present invention further provides a system for loading a large amount of data through a time slice round robin, comprising:
the timer starting unit is used for acquiring the data quantity which needs to be loaded currently by the main program when the main program responds to the data loading task, and starting a timer when the data quantity which needs to be loaded currently is large;
the time slice rotation starting unit is used for enabling the main program to call a data loading task at intervals according to the timer, and a small amount of data is loaded each time until all data of the current loading task are loaded;
and the timer closing unit is used for closing the timer after all the data of the current loading task are loaded.
Preferably, the timer starting unit starts the timer when the acquired data amount currently required to be loaded exceeds a preset threshold.
Preferably, the main program loads a preset amount of small data each time the main program calls a data loading task.
Preferably, the time slice rotation starting unit calls the main program to load the task once every 1-5 milliseconds according to a timer.
Preferably, the time slice rotation starting unit loads 5 to 10 pieces of data to the main program each time.
Compared with the prior art, the method and the device for loading a large amount of data through time slice rotation acquire the data amount which needs to be loaded by the main program at present when the main program responds to the data loading task, start a timer according to the acquired data amount, then call the data loading task at intervals according to the timer and the main program, load a small amount of data each time until all data of the current loading task are loaded, realize that loading and displaying a large amount of data can be completed by one-time loading, and simultaneously ensure the normal running of the main program. User experience is greatly improved, program operation can be smoothly stored, and the possibility of program jamming and running is reduced.
Drawings
FIG. 1 is a flow chart of the steps of a method of loading large amounts of data through a time slice carousel in accordance with the present invention;
FIG. 2 is a system architecture diagram of a system for loading large amounts of data through a time slice round robin according to the present invention;
FIG. 3 is a schematic diagram of a prior art time slice simulation for loading a large amount of data at a time without using a time slice rotation method;
FIG. 4 is a schematic diagram of a time slice simulation for loading a large amount of data at a time by using a time slice round-robin method according to the present invention.
Detailed Description
Other advantages and capabilities of the present invention will be readily apparent to those skilled in the art from the present disclosure by describing the embodiments of the present invention with specific embodiments thereof in conjunction with the accompanying drawings. The invention is capable of other and different embodiments and its several details are capable of modification in various other respects, all without departing from the spirit and scope of the present invention.
According to the background art, the main program is stuck because the time is occupied by the function of loading data, sometimes the main program only needs a few microseconds to process its own events, but the time cannot be allocated to cause the main program to be stuck, so that the problem of stuck can be solved as long as the main program is intermittently given a little time. Therefore, the invention adopts a time slice rotation method to load a large amount of data, namely when a large amount of data UI display needs to be loaded, a certain time is given to a main program in one loading process, a timer can be specifically set, a small amount of data (for example, 5 pieces of data) is loaded at intervals of a plurality of times (for example, 1 millisecond), the principle is that every time 5 pieces of data are loaded, a loading task gives 1 millisecond time for the main program to process the next event needing to be processed, then the loading is continued, and the cycle is repeated until the loading is completed.
FIG. 1 is a flow chart illustrating the steps of a method for loading large amounts of data through a time slice carousel in accordance with the present invention. As shown in FIG. 1, the method for loading a large amount of data through time slice rotation of the invention comprises the following steps:
step S1, when the main program responds to the data loading task, the data amount that the main program needs to load currently is obtained, and when the data amount that needs to load currently is large, a timer is started.
In the embodiment of the invention, when the main program responds to the loaded data, the data volume needing to be loaded currently is obtained first, and when the data volume needing to be loaded currently exceeds a preset threshold value, the timer is started. That is, the timer is started only when the data volume is large and the jamming is likely to occur, and when the data volume to be loaded is small, the jamming phenomenon is not generated, and the timer is not required to be started for subsequent processing.
Step S2, according to the timer, the main program calls the data loading task at intervals of several times, and loads a small amount of data each time until all data loading of the current loading task is completed, so that after each data loading, the main program can have a small amount of time to process its own time, and the program runs smoothly.
In the embodiment of the invention, according to a timer, a loading program is called every 1-5 milliseconds, 5-10 pieces of data are loaded every time, namely, a small amount of data are loaded every 1-5 milliseconds by a main thread, and after the 5-10 pieces of data are loaded, a plurality of time is given to a main thread processing service logic to enable the main thread to process own events in time, so that the program runs smoothly (the loading time of the 5-10 pieces of data is short, and a user can hardly feel the program). For example, 5 pieces of data are loaded for 5ms, the timing time is 1ms, and the specific timeline is that the first 5ms is data loaded (theoretically, the page in the 5ms time is blocked, but the 5ms blocked user is not sensible due to the short time), the loading is completed, the time is paused for 1ms, then the loading is continued for 5ms, the time is paused for 1ms, and so on, that the main thread is left for 1ms to process the business logic, so that the program can run smoothly.
And step S3, when all the data of the current loading task are loaded, closing the timer, and completing the current data loading task.
FIG. 2 is a system architecture diagram of a system for loading large amounts of data through a time slice round robin according to the present invention. As shown in fig. 2, the present invention provides a system for loading a large amount of data through a time slice round robin, which comprises:
the timer starting unit 201 is configured to obtain a data amount currently required to be loaded by the main program when the main program responds to the data loading task, and start a timer when the data amount currently required to be loaded is large.
In the embodiment of the invention, when the main program responds to the loaded data, the data volume needing to be loaded currently is obtained first, and when the data volume needing to be loaded currently exceeds a preset threshold value, the timer is started. That is, the timer is started only when the data volume is large and the jamming is likely to occur, and when the data volume to be loaded is small, the jamming phenomenon is not generated, and the timer is not required to be started for subsequent processing.
The time slice rotation starting unit 202 is configured to enable the main program to call the data loading task at intervals according to the timer, load a small amount of data each time until all data of the current loading task are loaded, so that after the data are loaded each time, the main program can have a small amount of time to process own time, and the program runs smoothly.
In the embodiment of the present invention, the time slice round-robin starting unit 202 calls the loading program once every 1-5 milliseconds according to the timer, and loads 5-10 pieces of data each time, that is, loads a small amount of data once every 1-5 milliseconds, and passes the interval of 1-5 milliseconds to the main thread processing service logic, so as to ensure that the main program can process its own events in time, and the program runs smoothly.
And a timer closing unit 203, configured to close the timer after all data of the current loading task is loaded, so that the current data loading task is completed.
Fig. 3 is a schematic view of a time slice simulation in the prior art for loading a large amount of data at a time without using a time slice rotation method, where in the prior art, if a large amount of data is loaded at a time, a whole block of time block needs to be used temporarily, for example, 5 seconds are needed for loading 10 ten thousand pieces of data, in that 5 seconds, all other events of a main program are often blocked and cannot be executed, the main program is blocked, which is not only bad in user experience, but also is easy to derive that the program is blocked and rushed.
FIG. 4 is a time slice simulation diagram of loading a large amount of data at a time by using a time slice rotation method according to the present invention, in which a timer is used to cut a time slice for loading a task into a smaller one, and the smaller time slice is provided to a main program at intervals while a large amount of data is loaded, so that a program is not jammed.
In summary, the method and apparatus for loading a large amount of data by time slice rotation according to the present invention obtains the data amount that the main program needs to load currently when the main program responds to the data loading task, starts a timer according to the obtained data amount, and then calls the data loading task at intervals according to the timer, and loads a small amount of data each time until all data loading of the current data loading task is completed, thereby achieving the purpose of loading and displaying a large amount of data that can be loaded at one time, and simultaneously ensuring the normal operation of the main program. User experience is greatly improved, program operation can be smoothly stored, and the possibility of program jamming and running is reduced.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the present invention. Therefore, the scope of the invention should be determined from the following claims.
Claims (10)
1. A method of loading a large amount of data by time slice carousel comprising the steps of:
step S1, when the main program responds to the data loading task, acquiring the data quantity which needs to be loaded currently by the main program, and starting a timer according to the acquired data quantity;
step S2, according to the timer, the main program calls the data loading task at intervals, each time loads a small amount of data, until all data loading of the current loading task is completed;
and step S3, when all the data of the current loading task are loaded, closing the timer, and completing the current data loading task.
2. A method of loading a large amount of data by time slice round robin as claimed in claim 1 wherein: in step S1, the timer is started when the acquired amount of data currently required to be loaded exceeds a preset threshold.
3. A method of loading a large amount of data by time slice round robin as claimed in claim 2 wherein: in step S2, the main routine loads a predetermined amount of small data each time the data loading task is invoked.
4. A method of loading a large amount of data by time slice round robin as claimed in claim 3 wherein: in step S2, a load task is invoked every 1-5 ms according to a timer.
5. A method of loading a large amount of data by time slice round robin as claimed in claim 4 wherein: in step S2, 5-10 pieces of data are loaded each time.
6. A system for loading large amounts of data through a time slice round robin, comprising:
the timer starting unit is used for acquiring the data quantity which needs to be loaded currently by the main program when the main program responds to the data loading task, and starting a timer when the data quantity which needs to be loaded currently is large;
the time slice rotation starting unit is used for enabling the main program to call a data loading task at intervals according to the timer, and a small amount of data is loaded each time until all data of the current loading task are loaded;
and the timer closing unit is used for closing the timer after all the data of the current loading task are loaded.
7. A system for loading large amounts of data over a round-robin basis as defined in claim 6 wherein: the timer starting unit starts the timer when the acquired data volume needing to be loaded currently exceeds a preset threshold value.
8. A system for loading large amounts of data over a round-robin basis as defined in claim 7 wherein: and when the main program calls a data loading task each time, loading a preset amount of small data.
9. A system for loading large amounts of data over a round-robin basis as defined in claim 8 wherein: and the time slice rotation starting unit calls the main program to load a task once every 1-5 milliseconds according to the timer.
10. A system for loading large amounts of data through a round-robin as defined in claim 9 wherein: the time slice rotation starting unit enables the main program to load 5-10 pieces of data each time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010393621.6A CN111580886A (en) | 2020-05-11 | 2020-05-11 | Method and device for loading mass data through time slice rotation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010393621.6A CN111580886A (en) | 2020-05-11 | 2020-05-11 | Method and device for loading mass data through time slice rotation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111580886A true CN111580886A (en) | 2020-08-25 |
Family
ID=72113360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010393621.6A Pending CN111580886A (en) | 2020-05-11 | 2020-05-11 | Method and device for loading mass data through time slice rotation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111580886A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116561170A (en) * | 2023-05-26 | 2023-08-08 | 杭州中电安科现代科技有限公司 | A tree structure data loading method, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102207888A (en) * | 2011-05-09 | 2011-10-05 | 大唐移动通信设备有限公司 | Method and device for managing timer |
CN104836750A (en) * | 2015-05-04 | 2015-08-12 | 大连理工大学 | Data center network flow scheduling method based on round-robin |
CN110515672A (en) * | 2018-05-21 | 2019-11-29 | 阿里巴巴集团控股有限公司 | Business datum loading method, device and electronic equipment |
-
2020
- 2020-05-11 CN CN202010393621.6A patent/CN111580886A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102207888A (en) * | 2011-05-09 | 2011-10-05 | 大唐移动通信设备有限公司 | Method and device for managing timer |
CN104836750A (en) * | 2015-05-04 | 2015-08-12 | 大连理工大学 | Data center network flow scheduling method based on round-robin |
CN110515672A (en) * | 2018-05-21 | 2019-11-29 | 阿里巴巴集团控股有限公司 | Business datum loading method, device and electronic equipment |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116561170A (en) * | 2023-05-26 | 2023-08-08 | 杭州中电安科现代科技有限公司 | A tree structure data loading method, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102981863B (en) | The management method and device of a kind of starting up's project | |
CN105740326B (en) | Thread state monitoring method and device for browser | |
CN102946469B (en) | Voice broadcasting method and device of mobile terminal, and mobile terminal | |
WO2017211226A1 (en) | Method for displaying media file, terminal, and storage medium | |
CN109634479A (en) | Notification information processing method, equipment, storage medium and device under full frame state | |
US9817484B2 (en) | Method for capturing screen content of mobile terminal and device thereof | |
US20220385953A1 (en) | Video stream playing control method and apparatus, and storage medium | |
CN101661392B (en) | Method, device and equipment for operating special interface tool on mobile terminal | |
CN113190427B (en) | Method and device for monitoring blocking, electronic equipment and storage medium | |
CN113672458B (en) | Application program monitoring method, electronic equipment and storage medium | |
US11941728B2 (en) | Previewing method and apparatus for effect application, and device, and storage medium | |
CN111580886A (en) | Method and device for loading mass data through time slice rotation | |
CN106919377B (en) | Method and device for determining whether display interface of application program is white screen | |
CN106484348A (en) | A kind of animation method for drafting based on synchronizing signal and system | |
CN102981905A (en) | Method of application control and electronic device | |
EP4503564A1 (en) | Control method and apparatus for virtual robot, and device, storage medium and program product | |
CN112100085A (en) | Android application program stability testing method, device and equipment | |
US20220035666A1 (en) | Method and apparatus for data processing, server and storage medium | |
CN102316211B (en) | Method and device for realizing key acceleration | |
CN111949512A (en) | Application program jamming detection method and device, terminal and medium | |
CN112711474A (en) | Timer management method and device and electronic equipment | |
CN106648703A (en) | Message display method and device | |
CN109491771B (en) | Task processing method based on system performance optimization and related equipment | |
CN115017004B (en) | Process monitoring method and electronic device | |
CN109885442B (en) | Performance analysis method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20200825 |
|
WD01 | Invention patent application deemed withdrawn after publication |