CN112000909A - Method, computing device and storage medium for browser information processing calculation - Google Patents

Method, computing device and storage medium for browser information processing calculation Download PDF

Info

Publication number
CN112000909A
CN112000909A CN202011176025.9A CN202011176025A CN112000909A CN 112000909 A CN112000909 A CN 112000909A CN 202011176025 A CN202011176025 A CN 202011176025A CN 112000909 A CN112000909 A CN 112000909A
Authority
CN
China
Prior art keywords
task
sub
data
threads
calculation
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.)
Granted
Application number
CN202011176025.9A
Other languages
Chinese (zh)
Other versions
CN112000909B (en
Inventor
常建龙
廖恒泰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai shouqianba Internet Technology Co.,Ltd.
Original Assignee
Shanghai Cash Bar Internet Technology Co ltd
Nanjing Yanli Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Cash Bar Internet Technology Co ltd, Nanjing Yanli Technology Co ltd filed Critical Shanghai Cash Bar Internet Technology Co ltd
Priority to CN202011176025.9A priority Critical patent/CN112000909B/en
Publication of CN112000909A publication Critical patent/CN112000909A/en
Application granted granted Critical
Publication of CN112000909B publication Critical patent/CN112000909B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Embodiments of the present disclosure relate to a method, computing device, and non-transitory machine-readable storage medium for browser information processing calculations, the method comprising: determining the number of slices based on the performance data of the terminal equipment and the determined number of the sub threads at the terminal equipment where the browser is located so as to generate a plurality of sliced data; sequentially creating a target number of sub-threads to synchronize a plurality of fragment data; the main thread broadcasts the current computing task for the target number of the sub-threads, so that the target number of the sub-threads can perform computing and report the computing result and the task identifier; summarizing a calculation result based on the task identifier in response to the fact that the task identifier meets a preset condition determined by the main thread; and in response to determining that all the sub-threads complete reporting of the calculation results and the main thread completes summarizing of the calculation results for output. The method and the system can enable the browser to be smooth when facing computing tasks related to mass data and not blocked or slowed down.

Description

Method, computing device and storage medium for browser information processing calculation
Technical Field
Embodiments of the present disclosure relate to the field of information processing, and more particularly, to methods, computing devices, and non-transitory machine-readable storage media for browser information processing calculations.
Background
The browser is, for example, a JavaScript engine (JS engine for short), an interface rendering thread, an event triggering thread, and an http requesting thread. In the conventional method for processing browser information, a JS engine on which a browser is based is single-threaded, because JavaScript is used as a client scripting language, the main task of the JavaScript is to process user interaction, the user interaction mainly responds to the addition and deletion of DOM, and only one event response is processed in one event loop in the form of an event queue, so that script execution is relatively continuous. Thus, to avoid resource contention between the DOM's, the JavaScript engine is typically designed to be single threaded. Due to the single-thread setting of the JS engine, when a browser of the user terminal faces a computing task related to mass data, serious blocking or slow down can be caused by the single thread, and even the browser is jammed, even has no response for a long time and even crashes. For example, when a large picture is loaded by using a browser or calculation is performed on map data, the whole JavaScript engine thread may be blocked, so that the following code cannot run normally, and the user experience is obviously reduced.
Therefore, the conventional computing method for the browser is easy to generate blocking, stuck and the like when facing computing tasks involving mass data.
Disclosure of Invention
The present disclosure presents a method, computing device, and non-transitory machine-readable storage medium for browser information processing that enables a browser to remain very fluid in the face of computing tasks involving large amounts of data, without being blocked or slowed.
According to a first aspect of the present disclosure, there is provided a method for browser information processing calculation. The method comprises the following steps: determining the number of slices for dividing an array of original data of a computing task to be processed by the browser at a terminal device where the browser is located based on performance data of the terminal device and the determined number of sub threads; based on the number of slices, dividing an array of original data of the computing task so as to generate a plurality of sliced data, wherein the sliced data is a set of coordinate points; sequentially creating a target number of sub-threads to synchronize a plurality of fragmented data, wherein the algorithm of the sub-threads is determined based on the input parameters of the calculation task, the input parameters of the calculation task are a geographic fence consisting of a plurality of coordinate points, and the sub-threads are configured to output calculation results by a monitoring function; the main thread broadcasts the current computing task aiming at the target number of sub-threads so as to be used for the target number of sub-threads to compute the fragment data corresponding to the current task and report a computing result and a task identifier, wherein the task identifier indicates the current computing task; summarizing a calculation result based on the task identifier in response to the fact that the task identifier meets a preset condition determined by the main thread; and in response to the fact that all the sub-threads in the target number of the sub-threads finish reporting the calculation results and the main thread finishes summarizing the calculation results, outputting the summarized calculation results.
According to a second aspect of the present invention, there is also provided a computing device comprising: at least one processing unit; at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit, cause the apparatus to perform the method in the first aspect of the disclosure.
According to a third aspect of the present disclosure, there is also provided a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a machine, performs the method of the first aspect of the disclosure.
In some embodiments, the method for browser information processing calculation further comprises: the main thread confirms the idempotency of the summary of the calculation results based on the task identification, and is used for determining whether at least one of the following is satisfied: the calculation results of single calculation tasks are not complete; and the results of a plurality of computing tasks interfere with each other.
In some embodiments, the method for browser information processing calculation further comprises: the main thread creates a corresponding calculation result queue according to the task identifier; after the sub-thread finishes a calculation task, the reported calculation result is merged into a calculation result queue; and the main thread judges whether the single calculation task is completely completed or not based on the task identification and the calculation result queue corresponding to the task identification.
In some embodiments, the method for browser information processing calculation further comprises: and generating a universal unique identification code to be used as a task identifier between the start of the current calculation task, wherein the collected calculation result is the number of coordinate points in the designated geo-fence range.
In some embodiments, the performance data of the terminal device is determined via: creating a predetermined number of child threads; calculating the average time consumed by each sub-thread in the preset number of sub-threads to finish the calculation of the preset times; determining performance data of the terminal device based on the average time; adjusting the predetermined number in response to determining that the performance data is less than the predetermined threshold value, so as to recalculate the performance data of the terminal device based on the adjusted predetermined number; in response to determining that the performance data of the recalculating terminal device is greater than or equal to the predetermined threshold, determining the adjusted predetermined number as the determined target number of child threads.
In some embodiments, determining a number of slices for partitioning an array of raw data for a computing task to be processed by a browser based on performance data of the terminal device and the determined number of child threads comprises: determining the data quantity of each fragment data based on the performance data of the terminal equipment and a preset data quantity base number; determining a number of slices to divide the array of raw data for the computing task based on the number of data per sliced data and the determined target number of child threads.
In some embodiments, the predetermined data volume base is 10000, and the algorithm of the sub-thread is used to calculate the straight-line distance for the coordinate point.
In some embodiments, the calculating the fragment data corresponding to the current task by the plurality of child threads and reporting the calculation result and the task identifier includes: in response to determining that the child thread receives the broadcasted current computing task, computing input data based on the constructed algorithm to calculate a number of coordinate points that are within the specified geo-fence range; reporting a calculation result related to the current calculation task to the main thread through the monitoring function in response to the fact that the sub-thread completes the calculation of the current calculation task; returning a task identifier corresponding to the current computing task to the main thread; and merging the calculation results of the current calculation task into the corresponding calculation result queue created by the main thread.
It should also be understood that the statements described in this summary are not intended to limit the key or critical features of the embodiments of the disclosure, nor are they intended to limit the scope of the disclosure. Other features of the embodiments of the present disclosure will become readily apparent from the following description.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements.
Fig. 1 shows a schematic diagram of a system for implementing a method of browser information processing, according to an embodiment of the present disclosure.
Fig. 2 shows a flowchart of a method for browser information processing according to an embodiment of the present disclosure.
FIG. 3 shows a flow diagram of a method for managing a computation results queue according to an embodiment of the present disclosure.
FIG. 4 shows a flow diagram of a method for determining a target number of child threads in accordance with an embodiment of the present disclosure.
Fig. 5 shows a flowchart of a method for reporting a computation result and a task identifier by a child thread according to an embodiment of the present disclosure.
FIG. 6 schematically shows a block diagram of an electronic device suitable for use to implement an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
As described above, in the conventional scheme for browser information processing calculation, due to the single-thread setting of the JS engine, when the browser of the user terminal is faced with a calculation task involving massive data, the browser is prone to blocking, jamming and the like, and even to no response for a long time or even to breakdown.
To address, at least in part, one or more of the above problems and other potential problems, example embodiments of the present disclosure propose a solution for browser information processing. The scheme comprises the following steps: determining the number of slices for dividing an array of original data of a computing task to be processed by the browser at a terminal device where the browser is located based on performance data of the terminal device and the determined number of sub threads; based on the number of slices, dividing an array of original data of the computing task so as to generate a plurality of sliced data, wherein the sliced data is a set of coordinate points; sequentially creating a target number of sub-threads to synchronize a plurality of fragmented data, wherein the algorithm of the sub-threads is determined based on the input parameters of the calculation task, the input parameters of the calculation task are a geographic fence consisting of a plurality of coordinate points, and the sub-threads are configured to output calculation results by a monitoring function; the main thread broadcasts the current computing task aiming at the target number of sub-threads so as to be used for the target number of sub-threads to compute the fragment data corresponding to the current task and report a computing result and a task identifier, wherein the task identifier indicates the current computing task; summarizing a calculation result based on the task identifier in response to the fact that the task identifier meets a preset condition determined by the main thread; and in response to the fact that all the sub-threads in the target number of the sub-threads finish reporting the calculation results and the main thread finishes summarizing the calculation results, outputting the summarized calculation results.
In the above-described aspect, by determining the number of slices so as to divide the array of raw data of the computation task into a plurality of pieces of sliced data based on the performance data of the terminal device and the determined number of child threads, the present disclosure can dynamically decide the number of slices regarding the raw data of the computation task according to the performance of the terminal device and the scale of the computation data. In addition, a target number of sub-threads are sequentially created so as to synchronize a plurality of fragment data, the main thread broadcasts the current computing task for the plurality of sub-threads, and the plurality of sub-threads compute the fragment data corresponding to the current task and report the computing result and the task identifier; and the main thread collects the calculation results based on the task identifiers and determines that all the sub-threads finish calculation and report and the main thread finishes the collection of the calculation results or outputs the results. According to the method and the device, data calculation and result collection can be respectively completed by utilizing the sub-thread and the main thread when mass data calculation is faced, so that the calculation power of the terminal equipment can be fully utilized to perform parallel calculation, the terminal equipment configured with the browser is enabled to have mass data parallel calculation capability quickly without using a threshold, and the browser can still be enabled to be smooth when faced with a calculation task related to mass data and cannot be blocked or slowed down.
FIG. 1 illustrates a schematic diagram of an example system that can be used to implement a method of browser information processing algorithms in accordance with an embodiment of the present disclosure. As shown in fig. 1, the system 100 includes: terminal device 110, server 120, network 130.
With respect to terminal device 110, it may perform calculations based on input data from a browser to download network data or perform calculation tasks. The terminal device 110 is for example configured to determine the number of slices for computing the array of raw data of the task divided into a plurality of sliced data; sequentially creating a target number of sub-threads to synchronize a plurality of fragmented data; the main thread broadcasts the current computing task aiming at the target number of sub-threads so as to be used for calculating the fragment data corresponding to the current task by the target number of sub-threads and reporting a computing result and a task identifier; the main thread collects the calculation result based on the task identification; and if it is determined that all the sub-threads finish the report of the calculation results and the main thread finishes the summarization of the calculation results, outputting the summarized calculation results. The terminal device 110 includes, for example: the system comprises a slice number determining unit 132, a slice data generating unit 134, a sub-thread creating unit 136, a calculation task broadcasting unit 138, a slice data calculation result reporting unit 140, a calculation result summarizing unit 142 and a summarized calculation result output unit 144.
Regarding the slice number determination unit 132, it is used for determining the slice number for dividing the array of the raw data of the computing task to be processed by the browser based on the performance data of the terminal device and the determined number of the sub threads at the terminal device where the browser is located.
Regarding the sliced data generation unit 134, it is configured to divide an array of raw data of a calculation task based on the number of slices so as to generate a plurality of sliced data, which is a set of coordinate points.
Regarding the sub-thread creating unit 136, it is configured to sequentially create a target number of sub-threads to synchronize the plurality of sliced data, an algorithm of the sub-thread is determined based on an input parameter of the computing task, the input parameter of the computing task is a geo-fence composed of a plurality of coordinate points, and the sub-thread is configured to output a computing result by a snoop function.
With regard to the compute task broadcast unit 138, it is used for the main thread to broadcast the current compute task for multiple sub-threads.
The fragmentation data calculation result reporting unit 140 is configured to calculate the fragmentation data corresponding to the current task by the multiple sub-threads and report a calculation result and a task identifier, where the task identifier indicates the current calculation task.
And a calculation result summarizing unit 142, configured to determine whether the task identifier meets the predetermined condition by the main thread, and summarize the calculation result based on the task identifier if the main thread determines that the task identifier meets the predetermined condition.
And a post-summary calculation result output unit 144, configured to output the summarized calculation result if it is determined that all the sub-threads in the target number of sub-threads complete reporting of the calculation result and the main thread completes summarizing of the calculation result.
FIG. 2 shows a flow diagram of a method 200 for browser information processing algorithms in accordance with an embodiment of the present disclosure. It should be understood that the method 200 may be performed, for example, at the electronic device 600 depicted in fig. 6. May also be performed at the terminal device 110 depicted in fig. 1. It should be understood that method 200 may also include additional components, acts not shown, and/or may omit illustrated components, acts, as the scope of the present disclosure is not limited in this respect.
At step 202, the terminal device 110 where the browser is located determines, at the terminal device where the browser is located, a slice number for partitioning an array of raw data of a computing task to be processed by the browser based on performance data of the terminal device and the determined target number of the child threads.
Regarding the performance data of the terminal device, it is measured and calculated in advance based on a predetermined number of sub threads and an average time for each sub thread to complete a predetermined number of calculations via the terminal device 110. This measurement is performed only once and the calculated performance data is cached locally at the terminal device 110 for later invocation when the browser creates a child thread and computes the sharded data. Fig. 4 mentioned below will relate to a method of determining performance data of a terminal device, and will not be described herein in detail.
The determination method of the number of slices includes, for example: before slicing original data to be calculated downloaded by a browser, determining the data quantity of each sliced data based on performance data of terminal equipment and a preset data quantity base number; then, based on the data amount of each piece of sliced data and the determined target number of sub-threads, the number of slices into which the array of raw data of the computing task is divided is determined. The manner of determining the data amount per sliced data is described below in conjunction with equation (1).
N = P × K (1)
In the above formula (1), K represents performance data of the terminal device. P represents a predetermined data volume base. N represents the calculated data amount per sliced data. The predetermined data volume base number can be preset, and research shows that when the predetermined data volume base number is 10000, the parallel computing efficiency is better, and at this time, the computed data quantity of each piece of fragment data is =10000 × 1.5385= 15385.
At step 204, terminal device 110 splits the array of raw data of the computing task based on the number of slices to generate a plurality of sliced data, which is a set of coordinate points. By adopting the above means, the number of slices can be dynamically decided according to the number of the original data of the calculation task and the performance evaluation result of the client side where the browser is located.
For example, after the terminal device 110 calculates the data amount (e.g., 15385) of each piece of sliced data, the JavaScript slice method is used to divide the array of the original data of the computation task (e.g., using an instruction arrayObj. slice (start, end), where arrayObj represents the original array of the computation task, start represents the start position of the piece of sliced data, and end represents the end position of the piece of sliced data), so as to obtain the piece of sliced data.
At step 206, the terminal device 110 sequentially creates a target number of sub-threads to synchronize the plurality of sliced data, an algorithm of the sub-threads is determined based on an input parameter of the computing task, the input parameter of the computing task is a geo-fence composed of a plurality of coordinate points, and the sub-threads are configured to output a computing result by a listening function.
The terminal device 110 cyclically creates sub threads in sequence based on the target number of sub threads. And creating an algorithm for each sub-thread according to the applied input data, the algorithm for the sub-thread being used to calculate the linear distance for the coordinate point. Each child thread then synchronously slices the data and specifies a snoop function for outputting the child thread computation results.
An algorithm for the child thread is determined based on input data of the application. The input data of the application is for example a geo-fence consisting of a plurality of coordinate points. With respect to geofences, which is a virtual fence that encloses a virtual geographic boundary, a target object may receive an automatic notification message when the target object enters, leaves, or is active in a particular geographic area corresponding to the virtual geographic boundary.
Algorithms for sub-threads include, for example, calculating straight-line distances for coordinate points, which includes square root, cosine, sine, arcsine, power calculations, and the like. The result of the computation of a child thread is, for example, the number of coordinate points located within a specified geofence range.
At step 208, the main thread of terminal device 110 broadcasts the current computation task for the target number of sub-threads, so that the target number of sub-threads perform computation for the sliced data corresponding to the current task and report a computation result and a task identifier, where the task identifier indicates the current computation task.
For example, before the current computing task starts, the terminal device generates a universal unique identification code to be used as a task identifier; and then the main thread broadcasts a calculation task to each sub-thread, and sequentially circulates and sends the task identification of the calculation task and input data for calculation to the sub-threads. Each child thread performs a calculation for the current fragment data based on the determined algorithm for the child thread, the fragment data being a set of coordinate points. Then the sub thread reports the calculation result through a monitoring function; and the sub-thread also returns a task identifier while reporting the calculation result.
At step 210, the main thread of terminal device 110 determines whether the task identification meets a predetermined condition.
At step 212, if the main thread of terminal device 110 determines that the task identity meets the predetermined condition, the calculation results are summarized based on the task identity. If the main thread of the terminal device 110 determines that the task identifier does not meet the predetermined condition, the process jumps to step 218 to determine that the calculation results of the single calculation task are not complete or the calculation results of the plurality of calculation tasks interfere with each other.
Regarding the predetermined condition, it is, for example, that the main thread of the terminal device 110 determines, based on the task identity as an idempotent of the computation result summary, whether at least one of the following is satisfied: the calculation results of single calculation tasks are not complete; and the results of a plurality of computing tasks interfere with each other. For example, if the main thread confirms that the aggregated calculation result generated by the multiple calls based on the task identifier is consistent with the aggregated calculation result obtained by the single call, the main thread determines that the task identifier meets the predetermined condition. If the main thread confirms that the summarized calculation result generated by the multiple times of calling based on the task identifier is inconsistent with the summarized calculation result called once, the main thread determines that the task identifier is not in accordance with the preset condition, and the problems that the calculation result of a single calculation task is incomplete and/or the calculation task results are interfered with each other may exist. A method of idempotent determination based on the task identifiers as a result of computation is described below with reference to equation (2).
f(f(x)) = f(x) (2)
In the above formula (2), x represents a task identifier. The function f (x) represents the aggregated computation result using the task identity as a function. The above formula shows that the result of x being acted upon once by the function f (x) and an infinite number of times is the same. If the result of the action of x once and the result of the action of x infinite times by the function f (x) cannot be guaranteed to be idempotent, the condition that the calculation results of a single calculation task are not complete or the results of a plurality of calculation tasks interfere with each other is shown. Therefore, the accuracy of the summary result of the sub-thread results can be guaranteed, and parallel computing errors caused by incomplete computing results of single computing tasks or mutual interference among computing results of a plurality of computing tasks can be avoided.
At step 214, the terminal device 110 determines whether all sub-threads of the target number of sub-threads complete reporting of the calculation results and whether the main thread completes aggregation of the calculation results. For example, after completing a computation task, the child thread returns the task identifier of the computation task and merges the computation result into the corresponding computation result queue. The main thread can judge whether a single calculation task is completely finished according to the task identification and the corresponding calculation result queue, and the calculation result summarizing method of the main thread is triggered after calculation of all the sub-threads is finished.
At step 216, if the terminal device 110 determines that all the sub-threads in the target number of sub-threads complete reporting of the calculation results and the main thread completes summarizing the calculation results, the summarized calculation results are output.
Methods for aggregating the computation results include, for example: and adding the number of the coordinate points which are reported by the target number of the sub-threads and are located in the designated geo-fence range so as to output the total number of the coordinates which correspond to the current computing task and are located in the designated geo-fence range.
In the above-described aspect, by determining the number of slices so as to divide the array of raw data of the computation task into a plurality of pieces of sliced data based on the performance data of the terminal device and the determined number of child threads, the present disclosure can dynamically decide the number of slices regarding the raw data of the computation task according to the performance of the terminal device and the scale of the computation data. In addition, a target number of sub-threads are sequentially created so as to synchronize a plurality of fragment data, the main thread broadcasts the current computing task for the plurality of sub-threads, and the plurality of sub-threads compute the fragment data corresponding to the current task and report the computing result and the task identifier; and the main thread collects the calculation results based on the task identifiers and determines that all the sub-threads finish calculation and report and the main thread finishes the collection of the calculation results or outputs the results. According to the method and the device, data calculation and result collection can be respectively completed by utilizing the sub-thread and the main thread when mass data calculation is faced, so that the calculation power of the terminal equipment can be fully utilized to perform parallel calculation, the terminal equipment configured with the browser is enabled to have mass data parallel calculation capability quickly without using a threshold, and the browser can still be enabled to be smooth when faced with a calculation task related to mass data and cannot be blocked or slowed down.
In some embodiments, method 200 also includes method 300 for managing a result queue. FIG. 3 shows a flow diagram of a method 300 for managing a result queue according to an embodiment of the present disclosure. It should be understood that the method 300 may be performed, for example, at the electronic device 600 depicted in fig. 6. May also be performed at the terminal device 110 depicted in fig. 1. It should be understood that method 300 may also include additional components, acts not shown, and/or may omit illustrated components, acts, as the scope of the present disclosure is not limited in this respect.
At step 302, the main thread of terminal device 110 creates a corresponding calculation result queue according to the task identifier.
At step 304, after the sub-thread of the terminal device 110 completes one computation task, the reported computation results are merged into the computation result queue.
At step 306, the main thread of the terminal device 110 determines whether a single computation task has been completely completed based on the task identifier and the computation result queue corresponding to the task identifier.
In some embodiments, the method 200 also includes a method 400 for determining a target number of child threads. FIG. 4 shows a flow diagram of a method 400 for determining a target number of child threads in accordance with an embodiment of the present disclosure. It should be understood that the method 400 may be performed, for example, at the electronic device 600 depicted in fig. 6. May also be performed at the terminal device 110 depicted in fig. 1. It should be understood that method 400 may also include additional components, acts not shown, and/or may omit illustrated components, acts, as the scope of the present disclosure is not limited in this respect.
At step 402, the terminal device 110 creates a predetermined number of child threads. The predetermined number of child threads is, for example and without limitation, 5.
At step 404, the terminal device 110 calculates an average time consumed for each of the predetermined number of sub-threads to complete the calculation for the predetermined number of times.
As to the calculation of the number of bookings, it is, for example, not limited to, 1 million complex operations. With respect to complex operations, it includes, for example, calculations to square root, cosine, sine, arcsine, power, and the like. For example, for a predetermined number of child threads created. And calculating the accumulation time of each sub-thread for completing 1 million complex operations, and then calculating the average time of each sub-thread for completing 1 million complex operations respectively based on the accumulation time and the preset number.
At step 406, terminal device 110 determines performance data for the terminal device based on the average time. The performance data of the terminal device is, for example, a coefficient for parallel computing performance evaluation. The following is a description of the determination method of the performance data with reference to formula (3).
K=M/T (3)
In the above formula (3), K represents performance data of the terminal device. M represents a predetermined reference. T represents the calculated average time for each child thread to complete the calculation of the predetermined number of times.
At step 408, terminal device 110 determines whether the performance data is less than a predetermined threshold. Studies have shown that the predetermined threshold is 1.5385 when the predetermined reference is set to 100. When the performance data exceeds the predetermined threshold of 1.5385, it indicates that the better the parallel computing performance of the terminal device 110, and vice versa, the worse the performance.
At step 410, if terminal device 110 determines that the performance data is less than the predetermined threshold, the predetermined number is adjusted so that the performance data for the terminal device is again calculated based on the adjusted predetermined number. For example, if the calculated performance data is less than a predetermined threshold, then the predetermined number is reduced, e.g., less than 5 child threads are created. And then retesting the average time of each sub-thread for completing 1 million complex operations, and determining the performance data of the terminal equipment again based on the retested average time. If terminal device 110 determines that the number of capabilities is greater than or equal to the predetermined threshold, it jumps to step 414.
At step 412, terminal device 110 determines whether the performance data of the terminal device is again calculated to be greater than or equal to a predetermined threshold.
At step 414, if terminal device 110 determines that the performance data of the recalculating terminal device is greater than or equal to the predetermined threshold, it determines that the adjusted predetermined number is the target number of determined child threads. For example, if the current performance data is greater than or equal to the predetermined threshold of 1.5385, the number of currently created child threads associated with the current performance data is taken as the target number of child threads. If terminal device 110 determines that the recalculated terminal device performance data is still less than the predetermined threshold, it jumps to step 410.
By adopting the above means, the method and the device can perform actual measurement and evaluation on the parallel computing performance of the client where the browser is located, and determine the target number of the sub-threads according to the evaluation condition, so that the sub-threads for parallel computing can be set in a matching manner according to the differentiated computing capability of the client.
In some embodiments, the method 200 further includes a method 500 for sub-thread reporting of the computation result and task identification. Fig. 5 shows a flowchart of a method 500 for reporting a computation result and a task identifier by a child thread according to an embodiment of the present disclosure. It should be understood that the method 500 may be performed, for example, at the electronic device 600 depicted in fig. 6. May also be performed at the terminal device 110 depicted in fig. 1. It should be understood that method 500 may also include additional components, acts not shown, and/or may omit illustrated components, acts, as the scope of the present disclosure is not limited in this respect.
At step 502, the terminal device 110 determines whether the child thread received the current computing task that was broadcast. If the broadcasted current computing task is not received, execution continues at step 502.
At step 504, if the terminal device 110 determines that the child thread received the broadcasted current computing task, the input data is computed based on the constructed algorithm to calculate the number of coordinate points that are within the specified geo-fence range.
At step 506, the terminal device 110 determines whether the child thread completes the computation of the current computing task. If it is determined that the child thread has not completed computing the current computing task, the process skips to step 504.
At step 508, if the terminal device 110 determines that the sub-thread completes the computation of the current computation task, the result of the computation on the current computation task is reported to the main thread via the snoop function.
At step 510, the terminal device 110 returns the task identifier corresponding to the current computing task to the main thread.
At step 512, terminal device 110 incorporates the results of the current computational task into the corresponding results queue created by the main thread.
By adopting the means, the parallel computing method and the parallel computing device can accurately and accurately enable the sub-threads to perform parallel computing aiming at the current task.
FIG. 6 schematically illustrates a block diagram of an electronic device (or computing device) 600 suitable for use to implement embodiments of the present disclosure. The device 600 may be a device for implementing the method 200 to 500 shown in fig. 2 to 5. As shown in fig. 6, device 600 includes a Central Processing Unit (CPU) 601 that may perform various appropriate actions and processes in accordance with computer program instructions stored in a Read Only Memory (ROM) 602 or loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM, various programs and data required for the operation of the device 600 may also be stored. The CPU, ROM, and RAM are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in device 600 are connected to input/output (I/O) 605, including: an input unit 606, an output unit 607, a storage unit 608, the central processing unit 601 performing the various methods and processes described above, e.g., performing the methods 200-500-e.g., in some embodiments, the methods 200-500 may be implemented as a computer software program stored on a machine readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM and/or the communication unit 609. When the computer program is loaded into RAM and executed by a CPU, one or more of the operations of methods 200-500 described above may be performed. Alternatively, in other embodiments, the CPU may be configured by any other suitable means (e.g., by way of firmware) to perform one or more acts of the methods 200-500.
It should be further appreciated that the present disclosure may be embodied as methods, apparatus, systems, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for carrying out various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the C language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or step diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each step of the flowchart and/or step diagrams, and combinations of steps in the flowchart and/or step diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor in a voice interaction device, a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or step diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or step diagram step or steps.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or step diagram step or steps.
The flowcharts and step diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or step diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two successive method steps may in fact be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each step of the step diagrams and/or flowchart illustration, and combinations of steps in the step diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
The above are merely alternative embodiments of the present disclosure and are not intended to limit the present disclosure, which may be modified and varied by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (10)

1. A method for browser information processing, comprising:
determining the number of slices for dividing an array of original data of a computing task to be processed by a browser at a terminal device where the browser is located based on performance data of the terminal device and the determined target number of sub threads;
based on the slice number, dividing an array of raw data of the computing task so as to generate a plurality of sliced data, wherein the sliced data is a set of coordinate points;
sequentially creating the target number of sub-threads to synchronize the plurality of sliced data, wherein an algorithm of the sub-threads is determined based on an input parameter of the computing task, the input parameter of the computing task is a geo-fence consisting of a plurality of coordinate points, and the sub-threads are configured to output a computing result by a monitoring function;
the main thread broadcasts the current computing task for the target number of sub-threads, so that the target number of sub-threads can compute the fragment data corresponding to the current task and report a computing result and a task identifier, wherein the task identifier indicates the current computing task;
in response to the main thread determining that the task identifier meets a predetermined condition, summarizing the calculation result based on the task identifier;
and in response to the fact that all the sub-threads in the target number of the sub-threads finish reporting the calculation results and the main thread finishes summarizing the calculation results, outputting the summarized calculation results.
2. The method of claim 1, further comprising:
the main thread, based on the task identification, validates an idempotency for the aggregate of the computation results for determining whether at least one of:
the calculation results of single calculation tasks are not complete; and
the results of a plurality of computing tasks interfere with each other.
3. The method of claim 1, further comprising:
the main thread creates a corresponding calculation result queue according to the task identifier;
after the sub-thread finishes a calculation task, the reported calculation result is merged into the calculation result queue;
and the main thread judges whether a single calculation task is completely completed or not based on the task identification and a calculation result queue corresponding to the task identification.
4. The method of claim 1, further comprising:
and generating a universal unique identification code to be used as the task identifier between the start of the current calculation task, wherein the collected calculation result is the number of coordinate points in a designated geo-fence range.
5. The method of claim 1, wherein the target number of child threads is determined via:
creating a predetermined number of child threads;
calculating the average time consumed by each sub-thread in the preset number of sub-threads to finish the calculation of the preset times;
determining performance data of the terminal equipment based on the average time;
in response to determining that the performance data is less than a predetermined threshold, adjusting the predetermined number so as to recalculate the performance data of the terminal device based on the adjusted predetermined number;
in response to determining that the performance data of the recalculating terminal device is greater than or equal to the predetermined threshold, determining the adjusted predetermined number to be the determined target number of child threads.
6. The method of claim 5, wherein determining a number of slices for partitioning an array of raw data for a computing task to be processed by a browser based on performance data of the terminal device and the determined number of child threads comprises:
determining the data quantity of each fragment data based on the performance data of the terminal equipment and a preset data quantity base number;
determining the number of slices for partitioning the array of raw data of the computing task based on the number of data of each piece of sliced data and the determined target number of sub-threads.
7. The method of claim 5, wherein the predetermined data volume base is 10000, and the algorithm of the sub-thread is used to calculate a straight-line distance for the coordinate point.
8. The method of claim 1, wherein the plurality of child threads computing sharded data corresponding to a current task and reporting the computation results and task identification comprises:
in response to determining that the child thread receives the broadcasted current computing task, computing input data based on the constructed algorithm to calculate a number of coordinate points that are within the specified geo-fence range;
reporting a calculation result related to the current calculation task to the main thread through the monitoring function in response to the fact that the sub-thread completes the calculation of the current calculation task;
returning a task identifier corresponding to the current computing task to the main thread;
and merging the calculation results of the current calculation task into the corresponding calculation result queue created by the main thread.
9. A computing device, comprising:
a memory configured to store one or more computer programs; and
a processor coupled to the memory and configured to execute the one or more programs to cause a metrology device to perform a metrology method in accordance with any one of claims 1-8.
10. A non-transitory machine-readable storage medium having stored thereon machine-readable program instructions configured to cause a metrology apparatus to perform the steps of the metrology method of any one of claims 1-8.
CN202011176025.9A 2020-10-29 2020-10-29 Method, computing device and storage medium for browser information processing Active CN112000909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011176025.9A CN112000909B (en) 2020-10-29 2020-10-29 Method, computing device and storage medium for browser information processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011176025.9A CN112000909B (en) 2020-10-29 2020-10-29 Method, computing device and storage medium for browser information processing

Publications (2)

Publication Number Publication Date
CN112000909A true CN112000909A (en) 2020-11-27
CN112000909B CN112000909B (en) 2021-02-09

Family

ID=73475274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011176025.9A Active CN112000909B (en) 2020-10-29 2020-10-29 Method, computing device and storage medium for browser information processing

Country Status (1)

Country Link
CN (1) CN112000909B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559179A (en) * 2020-12-15 2021-03-26 建信金融科技有限责任公司 Job processing method and device
CN117527880A (en) * 2024-01-05 2024-02-06 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334408A (en) * 2018-01-04 2018-07-27 深圳市天软科技开发有限公司 code execution method, device, terminal device and computer readable storage medium
CN108958951A (en) * 2018-06-08 2018-12-07 武汉斗鱼网络科技有限公司 A kind of optimization method, computer equipment and storage medium
CN109408214A (en) * 2018-11-06 2019-03-01 北京字节跳动网络技术有限公司 A kind of method for parallel processing of data, device, electronic equipment and readable medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334408A (en) * 2018-01-04 2018-07-27 深圳市天软科技开发有限公司 code execution method, device, terminal device and computer readable storage medium
CN108958951A (en) * 2018-06-08 2018-12-07 武汉斗鱼网络科技有限公司 A kind of optimization method, computer equipment and storage medium
CN109408214A (en) * 2018-11-06 2019-03-01 北京字节跳动网络技术有限公司 A kind of method for parallel processing of data, device, electronic equipment and readable medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559179A (en) * 2020-12-15 2021-03-26 建信金融科技有限责任公司 Job processing method and device
CN117527880A (en) * 2024-01-05 2024-02-06 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium
CN117527880B (en) * 2024-01-05 2024-04-09 南京研利科技有限公司 Message management method, device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN112000909B (en) 2021-02-09

Similar Documents

Publication Publication Date Title
US20180121322A1 (en) Methods and Systems for Testing Versions of Applications
CN112000909B (en) Method, computing device and storage medium for browser information processing
US9652349B2 (en) Quality of information assessment in dynamic sensor networks
CN109685144B (en) Method and device for evaluating video model and electronic equipment
CN112311617A (en) Configured data monitoring and alarming method and system
CN110784825A (en) Method and device for generating vehicle running track
CN108572898B (en) Method, device, equipment and storage medium for controlling interface
CN109189509B (en) Interface calling method, interface calling response method and server
CN109831508B (en) Caching method and equipment and storage medium
US20210058811A1 (en) Method and apparatus for detecting time series data
CN108540533A (en) A kind of method and apparatus of response request
CN109597800B (en) Log distribution method and device
CN109982034B (en) Access request processing method and device in video monitoring system
CN111988355A (en) Current limiting method and device, server and server cluster
CN107809737B (en) Method and device for determining network flow of base station
WO2019218977A1 (en) Account clearing and reconciliation method, apparatus, and computer device
CN108563774B (en) GPS data processing method and device
US11455293B2 (en) Counting method, counter and storage medium
CN103051722B (en) A kind ofly determine the method whether page is held as a hostage and relevant device
CN111147289A (en) Alarm association relation determining method, monitoring method, device, medium and equipment
CN113760642A (en) Monitoring processing method and device
US10223189B1 (en) Root cause detection and monitoring for storage systems
CN108804152B (en) Method and device for adjusting configuration parameters
US20170318439A1 (en) Message delivery reliability
CN114579416B (en) Index determination method, device, server and 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
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: Room 821, building 1, No.89, Hongshan South Road, Gulou District, Nanjing City, Jiangsu Province, 210000

Patentee after: Nanjing Yanli Technology Co.,Ltd.

Patentee after: Shanghai shouqianba Internet Technology Co.,Ltd.

Address before: Room 821, building 1, No.89, Hongshan South Road, Gulou District, Nanjing City, Jiangsu Province, 210000

Patentee before: Nanjing Yanli Technology Co.,Ltd.

Patentee before: Shanghai cash bar Internet Technology Co.,Ltd.

CP01 Change in the name or title of a patent holder
TR01 Transfer of patent right

Effective date of registration: 20220311

Address after: 200333 4th floor, building 26, Tiandi Software Park, No. 879, Zhongjiang Road, Putuo District, Shanghai

Patentee after: Shanghai shouqianba Internet Technology Co.,Ltd.

Address before: Room 821, building 1, No.89, Hongshan South Road, Gulou District, Nanjing City, Jiangsu Province, 210000

Patentee before: Nanjing Yanli Technology Co.,Ltd.

Patentee before: Shanghai shouqianba Internet Technology Co., Ltd

TR01 Transfer of patent right