Web page progress feedback method and system
By introducing a random number generation function and an expected value to replace the constant increment in the web page progress feedback system, the irregular changes and differences of the progress bar are realized, which solves the problem of lack of speed changes and high performance overhead in the existing technology, and improves the progress. Feedback authenticity and performance efficiency.
Patent Information
- Application Number
- CN202410205868.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-02-26
AI Technical Summary
The existing web page progress feedback system lacks visual speed changes and differences, and requires a large number of operations on web page elements, resulting in large performance overhead.
The random number generation function R is introduced to generate a random increment Δp, and the constant increment v is replaced by discretization and the expected value E[n] to achieve irregular changes and differences in the progress bar and reduce the number of operations on web page elements.
By randomizing progress feedback, visual speed changes and differences are increased, making progress feedback more realistic, reducing the number of operations on web page elements, and reducing performance overhead.
Smart Images

Figure CN118094045B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of web page progress feedback, and in particular to a web page progress feedback method and system. Background Art
[0002] At present, most web page progress feedback systems use progress bars and non-real-time synchronization. Compared with real-time progress synchronization, it has the advantages of not relying on the backend and being easy to implement. It is suitable for scenarios where the waiting time is roughly known and the real-time requirements are not high, such as general interface waiting and static resource loading. There are two common forms of progress bars:
[0003] Let d(s) be the total time for the progress bar to load, L be the total length of the progress bar, f be the update frequency of the progress bar, and update interval t is the update time starting from the starting time 0, t∈[0,d], t=0,ti,2ti,3ti,…, and p is the progress value.
[0004] One is to show the progress at a constant speed. is a constant, and the relationship between progress p and time t is expressed as This progress bar always changes at a constant speed.
[0005] One is to use an easing function to control the progress display. For example, using the "quintic ease-in and ease-out" function, when the time domain is continuous, the function of progress p with respect to t The progress bar controlled by this function starts out faster and then slows down smoothly.
[0006] The existing progress feedback methods, whether uniform or easing functions, require a larger f value to maintain visual continuity. We can approximately consider t to be continuous. Since the function of p with respect to t is continuous, p can also be considered continuous in the value domain. Both methods have the following characteristics:
[0007] In a single display, the progress value changes continuously and predictably with the update time, but the value changes are not random and there will be no pauses;
[0008] When displayed multiple times, the progress trend only depends on the fixed speed or the easing function used, and there is no difference. That is, when the same progress bar is displayed multiple times, the progress changes at the update time are exactly the same each time;
[0009] Since the change of progress value is continuous, the progress bar must be updated by operating the page element (DOM) at each update moment. Summary of the invention
[0010] In order to solve the above technical problems, the present invention provides a web page progress feedback method and system. The following technical solutions are adopted:
[0011] A web page progress feedback method, the web page progress feedback method introduces a random number generation function R, each web page progress update time t generates a random increment Δp, for n∈[0,1], R(n)∈[0,1], the probability density function f(n) of R(n) is a constant, let Δp=R(n);
[0012] The random increment Δp is discretized and the value of the random increment Δp is rounded down to an integer, denoted as Δ And introduce the natural number x, let Make Δp, which is originally constant at every moment, become 0 when the value of x·R(n) is less than 1, and the value is an integer ≤x at other moments;
[0013] Each update time t of the web page progress generates a random variable Δp. The set of all Δp is represented as a random process X(n). The expectation of the random process X(n) is E[n]. The total number of update times c = d·f. The larger c is, the greater the sum of E[n]. and the sum of each Δp The closer, when c is greater than or equal to the set update time total threshold, E[n] replaces v, p=E[n]·t.
[0014] Optional, for random increments The expectation E[n], x∈N, n∈[0,1], n is a continuous random variable, E[n] is the sum of the expectations of each interval.
[0015] By adopting the above technical solution, when the uniform progress is displayed, the relationship between p and t is p = v t, and the progress change at any adjacent time is
[0016] In order to produce irregular speed changes in a single display and differences in multiple displays, Δp needs to be random. Introduce a random number generation function R: for n∈[0,1], R(n)∈[0,1], and the probability density function f(n) of R(n) is a constant, R generates random numbers uniformly in the range [0,1]. Let Δp=R(n).
[0017] In order to produce the speed change, pause and reduce DOM operation of a single display, it is necessary to discretize the increment. The value of R(n) is rounded down to make the value of Δt at some time 0, which is recorded as Δp= In order to make the progress bar speed adjustable by a value similar to v, a natural number x is introduced,
[0018] Each update time t generates a random variable Δp. The set of all Δp can be expressed as a random process X(n). Mathematical expectation is the quantity that describes the average value of a random variable in a random process. It is equal to the central tendency of the random variable. The more random quantities a random process generates, the more accurate the measurement of mathematical expectation. Let the expectation of the random process X(n) be E[n]. The total number of update times c = d·f. The larger c is, the greater the sum of E[n]. and the sum of each Δp The closer. When c is large enough, E[n] is equivalent to v in step 1. At this time, E[n] can be used to replace v, and p = E[n]·t. The value of d cannot be restricted, so a larger value of f can also ensure equivalent accuracy.
[0019] By randomly replacing the regular and continuous progress values at certain moments with 0 values, compensating with larger values at other moments, and measuring the overall speed with the expected E equivalent v, the progress increments are discretized and randomized, introducing fast and slow changes, intermittent and different visual perceptions, making the progress feedback more realistic and closer to empirical cognition. At the same time, the speed control effect similar to that of the existing technical solutions can be obtained by changing the E value.
[0020] Compared with the existing technical solutions, under the same update frequency, this proposal reduces the number of operations on web page elements and reduces certain performance overhead by making the incremental value corresponding to a certain number of update moments 0 and ignoring rendering.
[0021] Optionally, step 1, the progress bar starts and the control parameters are initialized; the update frequency f is set, and after the start, the calculation is performed and the progress is updated f times per second; the expected duration d is set, and the incremental expectation E is calculated according to the update frequency f and the duration d, and the incremental expectation E and the natural number x are calculated;
[0022] Step 2, initialize the progress bar, render the progress bar frame and leave the content blank according to the progress bar length L, set the end flag F to "no", and set the current progress flag P to 0;
[0023] Step 3, create timer I, interval Execute the loop operation Fn in seconds;
[0024] Check whether an external end instruction is received, and if so, mark the end flag position as yes;
[0025] Determine the end mark F and the current progress mark P:
[0026] Step 4, clear timer I, clear the progress bar on the page, and close the progress bar;
[0027] d is the duration of the progress bar, L is the length of the progress bar, f is the update frequency of the progress bar, t is the update time with 0 as the starting time, p is the progress value at a certain update time, v is the average progress increment at each update time, reflecting the average speed of the progress bar, and ti is the update interval.
[0028] Optionally, in step 1, the calculation formula of the incremental expectation E is:
[0029] Calculate incremental expectation Since L is unpredictable, if the length value is directly output at each update time, the impact will be unpredictable. For example, if L is small, but the integer length is increased each time, the progress will suddenly increase. Therefore, replace the numerical parameter L with the proportional parameter 100,
[0030] In step 1, the calculation formula for the natural number x is:
[0031]
[0032] Optionally, in step 3, the following method is used to determine the end flag F and the current progress flag P:
[0033] If F is no, and P≠100, call the browser random number generator Math.random, which is equivalent to the R function, to generate a random number r, round down the value of r×x to get Δp, multiply Δp×L to get the length increment ΔL, update the current progress P=P+ΔL, and output ΔL to the rendering module;
[0034] If F is yes and P≠100, the progress will be terminated in advance. If the last recorded Update current progress And output to the rendering module; if not read, 0.5s is used as the duration to end the remaining progress, and the remaining number of updates is calculate And record and update the current progress And output To the rendering module;
[0035] If P=100, exit the loop operation Fn.
[0036] Optionally, the rendering module receives Ignore the 0 value and fill the reserved interval with a color block of the specified length.
[0037] A web page progress feedback system comprises a parameter management module, a calculation module, a control module and a rendering module; the parameter management module is communicatively connected with the calculation module, the calculation module is communicatively connected with the control module, and the rendering module is communicatively connected with the calculation module and the control module respectively;
[0038] The parameter management module manages the input web page progress feedback parameters, which include progress bar size, display duration, progress bar position and fill color;
[0039] Manage built-in parameters, including update frequency f, current progress flag P, end flag F and fixed increment;
[0040] The calculation module calculates the intermediate parameters and the increment of each progress update using a web page progress feedback method according to the input parameters and the built-in parameters;
[0041] The control module controls the timer 1 to cyclically call the calculation module and output the result to the rendering module. It receives external instructions and provides the functions of immediate termination, reset, and obtaining the current progress to the outside.
[0042] The rendering module ignores the 0 value according to each calculation result of the calculation module and renders a color block of corresponding length to the page.
[0043] Optionally, the parameter management module is implemented based on the local storage module of the browser, corresponding to the hard disk of the computer; the calculation module is implemented based on the JavaScript engine of the browser, corresponding to the CPU of the computer; the control module is based on the browser engine, corresponding to the memory of the computer; the rendering module is based on the rendering engine of the browser, corresponding to the GPU of the computer.
[0044] In summary, the present invention includes at least one of the following beneficial technical effects:
[0045] The present invention can provide a web page progress feedback method and system, by randomly replacing the regular and continuous progress values at certain moments with 0 values and compensating with larger values at other moments, and measuring the overall speed with the expected E equivalent v, thereby discretizing and randomizing the progress increments, introducing fast and slow changes, intermittent and different visual perceptions, making the progress feedback more realistic and closer to empirical cognition, and at the same time, by changing the E value, a speed control effect similar to that of the prior art solution can be obtained.
[0046] Compared with the existing technical solutions, at the same update frequency, by making the incremental value corresponding to a certain number of update moments 0 and ignoring rendering, the number of operations on web page elements is reduced, thereby reducing a certain performance overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of a web page progress feedback method of the present invention;
[0048] Figure 2It is a schematic diagram of the component connection principle of a web page progress feedback system of the present invention. DETAILED DESCRIPTION
[0049] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0050] The embodiment of the invention discloses a web page progress feedback method and system.
[0051] Reference Figure 1 A web page progress feedback method, the web page progress feedback method introduces a random number generation function R, each web page progress update time t generates a random increment Δp, for n∈[0,1], R(n)∈[0,1], the probability density function f(n) of R(n) is a constant, let Δp=R(n);
[0052] The random increment Δp is discretized and the value of the random increment Δp is rounded down to an integer, which is recorded as And introduce the natural number x, let Make Δp, which is originally constant at every moment, become 0 when the value of x·R(n) is less than 1, and the value is an integer ≤x at other moments;
[0053] Each update time t of the web page progress generates a random variable Δp. The set of all Δp is represented as a random process X(n). The expectation of the random process X(n) is E[n]. The total number of update times c = d·f. The larger c is, the greater the sum of E[n]. and the sum of each Δp The closer, when c is greater than or equal to the set update time total threshold, E[n] replaces v, p=E[n]·t.
[0054] The specific value of c is found in the following steps.
[0055] For random increments The expectation E[n], x∈N, n∈[0,1], n is a continuous random variable, E[n] is the sum of the expectations of each interval.
[0056] When the uniform progress is displayed, the relationship between p and t is p = v t, and the progress change at any adjacent time is
[0057] In order to produce irregular speed changes in a single display and differences in multiple displays, Δp needs to be random. Introduce a random number generation function R: for n∈[0,1], R(n)∈[0,1], and the probability density function f(n) of R(n) is a constant, R generates random numbers uniformly in the range [0,1]. Let Δp=R(n).
[0058] In order to produce the speed change, pause and reduce DOM operation of a single display, it is necessary to discretize the increment. The value of R(n) is rounded down to make the value of Δt at some time 0, which is recorded as In order to make the progress bar speed adjustable by a value similar to v, a natural number x is introduced,
[0059] Each update time t generates a random variable Δp. The set of all Δp can be expressed as a random process X(n). Mathematical expectation is the quantity that describes the average value of a random variable in a random process. It is equal to the central tendency of the random variable. The more random quantities a random process generates, the more accurate the measurement of mathematical expectation. Let the expectation of the random process X(n) be E[n]. The total number of update times c = d·f. The larger c is, the greater the sum of E[n]. and the sum of each Δp The closer. When c is large enough, E[n] is equivalent to v in step 1. At this time, E[n] can be used to replace v, and p = E[n]·t. The value of d cannot be restricted, so a larger value of f can also ensure equivalent accuracy.
[0060] For random variables The expectation E[n], x∈N, n∈[0,1], n is a continuous random variable, E[n] can be obtained by summing the expectations of each interval. Consider the natural number x separately:
[0061] When x>1, x=2, the value range of n is divided into three continuous intervals. The probability density function f(n) of each interval is a constant function, and the mathematical expectation of each interval is denoted as E[s].
[0062]
[0063] f(n)f(n)=0f(n)=1f(n)=2
[0064]
[0065]
[0066] When x=3:
[0067]
[0068] f(n)f(n)=0f(n)=1f(n)=2f(n)=3
[0069]
[0070] Extending to the general case, introduce a positive integer ɑ. If x∈(ɑ,ɑ+1), ɑ∈Z:
[0071]
[0072] The first item is 0, is an arithmetic progression, with common difference ɑ1 represents the first term, n represents the number of terms, and the sum of the sequence thereby
[0073]
[0074] When x<1, f(n)=0,
[0075] When x=1, f(n)=1,
[0076] So only consider x>1.
[0077] The relationship between E[n] and x is:
[0078]
[0079] Since E[n](x) is monotonically increasing on x∈[ɑ,ɑ+1), then
[0080] Given the expectation E[n] = m (m>0). By It can be seen that 2·m<ɑ<2·m+1, because the value of 2m is rounded up It must fall within the interval (2·m,2·m+1), so take By the relation Available thereby
[0081] That is, the progress increment generated at each update moment It can be obtained from the expectation E[n] which is equivalent to the growth rate v.
[0082] In order to evaluate the accuracy of the expectation E[n] of the random process X(n), the Monte Carlo method is used to estimate the expected value Es[n] by setting a certain number of sample values, that is, the total number of update moments c. The accuracy of this random process is evaluated by comparing the difference D[n] = |Es[n]-Er[n]| between Es[n] and the true expected value Er[n]. The estimated expected value Es[n] is the average of the sum of random values. For the coefficient x, the change of its value does not affect the function characteristics of the random value function, does not affect the expected accuracy but only affects the value size. The expected accuracy is only related to c. By changing the value of c, the change trend of D[n] can be obtained, thereby determining the value range of c. Let Er[n] = m = 0.5, Through computer simulation, the accuracy of the expected value under different c values is:
[0083]
[0084]
[0085] It can be seen that when c = 500, D[n] = 0.024, the expected value deviation rate is <5%, and it shows an overall downward trend as c continues to increase. On the other hand, the current mainstream browser refresh rate is 60Hz, and the progress update frequency is set to the refresh rate, f = 60. Considering c ≥ 600, then That is, the expected (maximum) duration of the progress bar is ≥ 10s, which is within the normal range. Therefore, taking into account both accuracy and practical implementation, the total threshold of update time is set to 600. When c ≥ 600, E[n] replaces v.
[0086] By randomly replacing the regular and continuous progress values at certain moments with 0 values, compensating with larger values at other moments, and measuring the overall speed with the expected E equivalent v, the progress increments are discretized and randomized, introducing fast and slow changes, intermittent and different visual perceptions, making the progress feedback more realistic and closer to empirical cognition. At the same time, the speed control effect similar to that of the existing technical solutions can be obtained by changing the E value.
[0087] Compared with the existing technical solutions, under the same update frequency, this proposal reduces the number of operations on web page elements and reduces certain performance overhead by making the incremental value corresponding to a certain number of update moments 0 and ignoring rendering.
[0088] Step 1, the progress bar starts and the control parameters are initialized; the update frequency f is set, and after the start, the calculation is performed and the progress is updated f times per second; the expected duration d is set, and the incremental expectation E is calculated based on the update frequency f and the duration d, and the incremental expectation E and the natural number x are calculated;
[0089] Step 2, initialize the progress bar, render the progress bar frame and leave the content blank according to the progress bar length L, set the end flag F to "no", and set the current progress flag P to 0;
[0090] Step 3, create timer I, interval Execute the loop operation Fn in seconds;
[0091] Check whether an external end instruction is received, and if so, mark the end flag position as yes;
[0092] Determine the end mark F and the current progress mark P:
[0093] Step 4, clear timer I, clear the progress bar on the page, and close the progress bar;
[0094] d is the duration of the progress bar, L is the length of the progress bar, f is the update frequency of the progress bar, t is the update time with 0 as the starting time, p is the progress value at a certain update time, v is the average progress increment at each update time, reflecting the average speed of the progress bar, and ti is the update interval.
[0095] In step 1, the calculation formula of the incremental expectation E is:
[0096] Calculate incremental expectation Since L is unpredictable, if the length value is directly output at each update time, the impact will be unpredictable. For example, if L is small, but the integer length is increased each time, the progress will suddenly increase. Therefore, replace the numerical parameter L with the proportional parameter 100,
[0097] In step 1, the calculation formula for the natural number x is:
[0098]
[0099] In step 3, the following method is used to determine the end mark F and the current progress mark P:
[0100] If F is no, and P≠100, call the browser random number generator Math.random, which is equivalent to the R function, to generate a random number r, round down the value of r×x to get Δp, multiply Δp×L to get the length increment ΔL, update the current progress P=P+ΔL, and output ΔL to the rendering module;
[0101] If F is yes and P≠100, the progress will be terminated in advance. If the last recorded Update current progress And output to the rendering module; if not read, 0.5s is used as the duration to end the remaining progress, and the remaining number of updates is calculate And record and update the current progress And output To the rendering module;
[0102] If P=100, exit the loop operation Fn.
[0103] Optionally, the rendering module receives Ignore the 0 value and fill the reserved interval with a color block of the specified length.
[0104] Reference Figure 2, a web page progress feedback system, comprising a parameter management module, a calculation module, a control module and a rendering module; the parameter management module is communicatively connected with the calculation module, the calculation module is communicatively connected with the control module, and the rendering module is communicatively connected with the calculation module and the control module respectively;
[0105] The parameter management module manages the input web page progress feedback parameters, which include progress bar size, display duration, progress bar position and fill color;
[0106] Manage built-in parameters, including update frequency f, current progress flag P, end flag F and fixed increment;
[0107] The calculation module calculates the intermediate parameters and the increment of each progress update using a web page progress feedback method based on the input parameters and built-in parameters;
[0108] The control module controls the timer I to call the calculation module cyclically and output the results to the rendering module. It receives external instructions and provides the functions of immediate end, reset, and obtaining the current progress to the outside.
[0109] The rendering module ignores the 0 value according to each calculation result of the calculation module and renders a color block of corresponding length to the page.
[0110] The parameter management module is implemented based on the local storage module of the browser, corresponding to the hard disk of the computer; the calculation module is implemented based on the JavaScript engine of the browser, corresponding to the CPU of the computer; the control module is based on the browser engine, corresponding to the memory of the computer; the rendering module is based on the rendering engine of the browser, corresponding to the GPU of the computer.
[0111] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A web page progress feedback method, characterized in that: The web page progress feedback method introduces a random number generation function R. Each update time t of the web page progress generates a random increment Δp. For n∈[0,1], R(n)∈[0,1], the probability density function f(n) of R(n) is a constant. Let Δp=R(n); The random increment Δp is discretized and the value of the random increment Δp is rounded down to an integer, denoted as Δ And introduce the natural number x, let Make Δp, which is originally constant at every moment, become 0 when the value of x·R(n) is less than 1, and the value is an integer ≤x at other moments; Each update time t of the web page progress generates a random variable Δp. The set of all Δp is represented as a random process X(n). The expectation of the random process X(n) is E[n]. The total number of update times c = d·f. The larger c is, the greater the sum of E[n]. and the sum of each Δp The closer, when c is greater than or equal to the set update time total threshold, E[n] replaces v, p = E[n]·t; For random increments The expectation E[n], x∈N, n∈[0,1], n is a continuous random variable, E[n] is the sum of the expectations of each interval.
2. A web page progress feedback method according to claim 1, characterized in that: The following steps are involved: Step 1, the progress bar starts and the control parameters are initialized; the update frequency f is set, and after the start, the calculation is performed and the progress is updated f times per second; the expected duration d is set, and the incremental expectation E is calculated based on the update frequency f and the duration d, and the incremental expectation E and the natural number x are calculated; Step 2, initialize the progress bar, render the progress bar frame and leave the content blank according to the progress bar length L, set the end flag F to "no", and set the current progress flag P to 0; Step 3, create timer I, interval Execute the loop operation Fn in seconds; Check whether an external end instruction is received, and if so, mark the end flag position as yes; Determine the end mark F and the current progress mark P: Step 4, clear timer I, clear the progress bar on the page, and close the progress bar; d is the duration of the progress bar, L is the length of the progress bar, f is the update frequency of the progress bar, t is the update time with 0 as the starting time, p is the progress value at a certain update time, v is the average progress increment at each update time, reflecting the average speed of the progress bar, and ti is the update interval.
3. A web page progress feedback method according to claim 2, characterized in that: In step 1, the calculation formula of the incremental expectation E is:
4. A web page progress feedback method according to claim 3, characterized in that: In step 1, the calculation formula for the natural number x is:
5. A web page progress feedback method according to claim 4, characterized in that: In step 3, the following method is used to determine the end mark F and the current progress mark P: If F is no, and P≠100, call the browser random number generator Math.random, which is equivalent to the R function, to generate a random number r, round down the value of r×x to get Δp, multiply Δp×L to get the length increment ΔL, update the current progress P=P+ΔL, and output ΔL to the rendering module; If F is yes and P≠100, the progress will be terminated in advance. If the last recorded Update current progress And output To the rendering module; If not read, 0.5s is used as the duration to end the remaining progress, and the remaining number of updates is calculate And record and update the current progress And output To the rendering module; If P=100, exit the loop operation Fn.
6. A web page progress feedback method according to claim 5, characterized in that: The rendering module receives , ignore the 0 value, and fill the reserved interval with a color block of the specified length.
7. A web page progress feedback method according to claim 5, characterized in that: The total update time threshold is 600.
8. A web page progress feedback system, characterized by: It includes a parameter management module, a calculation module, a control module and a rendering module; the parameter management module is connected to the calculation module in communication, the calculation module is connected to the control module in communication, and the rendering module is connected to the calculation module and the control module in communication respectively; The parameter management module manages the input web page progress feedback parameters, which include progress bar size, display duration, progress bar position and fill color; Manage built-in parameters, including update frequency f, current progress flag P, end flag F and fixed increment; The calculation module calculates the intermediate parameters and the increment of each progress update according to the input parameters and the built-in parameters using the method described in any one of claims 1 to 7; The control module controls the timer 1 to cyclically call the calculation module and output the result to the rendering module; receives external instructions, and provides the external with functions of immediately ending, resetting, and obtaining the current progress; The rendering module ignores the 0 value according to each calculation result of the calculation module and renders a color block of corresponding length to the page.
9. A web page progress feedback system according to claim 8, characterized in that: The parameter management module is implemented based on the local storage module of the browser, corresponding to the hard disk of the computer; the calculation module is implemented based on the JavaScript engine of the browser, corresponding to the CPU of the computer; the control module is based on the browser engine, corresponding to the memory of the computer; the rendering module is based on the rendering engine of the browser, corresponding to the GPU of the computer.
