CN113849758A - Webpage index generation method and device, electronic equipment and storage medium - Google Patents
Webpage index generation method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113849758A CN113849758A CN202111087682.0A CN202111087682A CN113849758A CN 113849758 A CN113849758 A CN 113849758A CN 202111087682 A CN202111087682 A CN 202111087682A CN 113849758 A CN113849758 A CN 113849758A
- Authority
- CN
- China
- Prior art keywords
- time
- webpage
- loading
- acquiring
- api
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 76
- 230000004044 response Effects 0.000 claims abstract description 14
- 230000008569 process Effects 0.000 claims description 27
- 238000004590 computer program Methods 0.000 claims description 13
- 239000008186 active pharmaceutical agent Substances 0.000 claims description 6
- 238000013473 artificial intelligence Methods 0.000 abstract description 6
- 238000005457 optimization Methods 0.000 abstract description 5
- 230000006870 function Effects 0.000 description 16
- 238000012545 processing Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 8
- 238000004422 calculation algorithm Methods 0.000 description 7
- 238000009877 rendering Methods 0.000 description 6
- 230000001960 triggered effect Effects 0.000 description 5
- 238000001514 detection method Methods 0.000 description 4
- 230000002452 interceptive effect Effects 0.000 description 4
- 230000003993 interaction Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000033228 biological regulation Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003924 mental process Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
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)
- Information Transfer Between Computers (AREA)
Abstract
The disclosure provides a method and a device for generating webpage indexes, electronic equipment and a storage medium, and relates to the field of computers, in particular to the technical field of artificial intelligence such as intelligent search. The specific implementation scheme is as follows: in response to detecting a webpage loading event, loading a webpage corresponding to the target webpage address; acquiring first time for loading an Application Programming Interface (API) in a webpage; acquiring second time for completing webpage loading; acquiring a target idle time period of the main thread from the time between the first time and the second time; and generating a webpage index corresponding to the webpage according to the target idle time period. Therefore, the generated webpage indexes can more accurately measure the webpage performance, so that the webpage optimization is more accurate.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a web page index, an electronic device, and a storage medium.
Background
At present, the webpage performance plays a very important role in user satisfaction and user retention, even the conversion rate and the service target are affected, and the measurement of the webpage performance usually depends on the performance index taking the user as the center. However, the web page loading is a process, a single "time point" does not exist, the performance of the web page can be fully reflected, and a plurality of more critical "time points" can influence the "fast" or "slow" feeling of the web page by the user.
The web page loading speed and the response speed of the web page to the user action are important factors influencing the performance of the web page.
Disclosure of Invention
The disclosure provides a method, a device, equipment and a storage medium for generating webpage indexes.
According to an aspect of the present disclosure, a method for generating a webpage index is provided, including:
in response to detecting a webpage loading event, loading a webpage corresponding to the target webpage address;
acquiring first time when an Application Programming Interface (API) in the webpage is loaded;
acquiring second time for completing webpage loading;
acquiring a target idle time period of a main thread from between the first time and the second time; and generating a webpage index corresponding to the webpage according to the target idle time period.
According to another aspect of the present disclosure, there is provided a web page indicator generating apparatus, including:
the loading module is used for responding to the detected webpage loading event and loading the webpage corresponding to the target webpage address;
the first acquisition module is used for acquiring the first time when the loading of the application programming interface API in the webpage is finished;
the second acquisition module is used for acquiring second time for completing the webpage loading;
a third obtaining module, configured to obtain a target idle time period of the main thread from between the first time and the second time; and
and the generating module is used for generating the webpage indexes corresponding to the webpage according to the target idle time period.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of generating a web page indicator of one aspect or another aspect of the above embodiments.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing thereon a computer program for causing a computer to execute the method for generating a web page indicator according to the above one aspect or another aspect embodiment.
According to another aspect of the present disclosure, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the steps of the method for generating a web page indicator according to one aspect or another aspect of the present disclosure are implemented.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a flow diagram of a method of generating web page metrics according to one embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a web page loading process according to one embodiment of the present disclosure;
FIG. 3 is a flow diagram of a method for generating web page metrics in accordance with another embodiment of the present disclosure;
FIG. 4 is a flow diagram of a method for generating web page metrics in accordance with another embodiment of the present disclosure;
FIG. 5 is a flow diagram of a method for generating web page metrics in accordance with another embodiment of the present disclosure;
FIG. 6 is a flow diagram of a method for generating web page metrics in accordance with another embodiment of the present disclosure;
FIG. 7 is a diagram of a specific example of a method for generating a web page indicator according to an embodiment of the present disclosure;
FIG. 8 is a block diagram illustration of an apparatus for generating a web page indicator according to one embodiment of the present disclosure; and
FIG. 9 is a block diagram of an electronic device for implementing a method for generating a web page indicator according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
A method, an apparatus, an electronic device, and a storage medium for generating a web page indicator according to an embodiment of the present disclosure are described below with reference to the drawings.
Intelligent search is a new generation of search engines that incorporate artificial intelligence techniques. The system can provide functions of traditional quick retrieval, relevance sequencing and the like, and also can provide functions of user role registration, automatic user interest identification, semantic understanding of contents, intelligent informatization filtering, pushing and the like.
Artificial intelligence is the subject of research on the use of computers to simulate certain mental processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.) of humans, both in the hardware and software domain. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology comprises a computer vision technology, a voice recognition technology, a natural language processing technology, deep learning, a big data processing technology, a knowledge map technology and the like.
The method for generating the webpage index provided by the embodiment of the present disclosure may be executed by an electronic device, where the electronic device may be a PC (Personal Computer), a mobile phone, a tablet Computer, a server, or the like, and is not limited herein.
In the disclosed embodiment, the electronic device may be provided with a processing component, a storage component and a driving component. Optionally, the driving component and the processing component may be integrated, the storage component may store an operating system, an application program, or other program modules, and the processing component implements the method for generating the web page indicator provided in the embodiment of the present disclosure by executing the application program stored in the storage component.
Fig. 1 is a schematic flow chart of a method for generating a web page indicator according to an embodiment of the present disclosure.
The method for generating the webpage index according to the embodiment of the disclosure can be further executed by the device for generating the webpage index provided by the embodiment of the disclosure, and the device can be configured in the electronic equipment to load the webpage corresponding to the target webpage address in response to the detection of the webpage loading event, acquire the first time when the Application Programming Interface (API) in the webpage is loaded and the second time when the webpage is loaded, acquire the target idle time period of the main thread from the first time to the second time, and generate the webpage index corresponding to the webpage according to the target idle time period, so that the webpage performance can be accurately measured, and the webpage can be more accurately optimized.
As a possible situation, the method for generating the web page index according to the embodiment of the present disclosure may also be executed at a server, where the server may be a cloud server, and the method for generating the web page index may be executed at the cloud server.
As shown in fig. 1, the method for generating the web page indicator may include:
It should be noted that the web page described in this embodiment may be a web page loaded through a browser, where a user (related person) may input (write) a target web page address into an address bar of the browser through an electronic device, so that the browser loads a web page corresponding to the target web page address.
In the embodiment of the disclosure, the electronic device may detect whether the webpage loading event is triggered in real time through a related API (Application Programming Interface), so that the electronic device can respond to the webpage loading event in time when detecting the webpage loading event.
Specifically, when the electronic device detects a web page loading event through the relevant API, the electronic device may load a web page corresponding to the target web page address in response to the web page loading event.
As a possible scenario, the user may also enter the target web page address by clicking a web page link of the browser interface.
In the embodiment of the present disclosure, referring to fig. 2, in the process of loading the web page corresponding to the target web page address, the web page may undergo a process of completing white screen rendering, partial rendering and final loading and may be interacted, in this process, html (Document Object Model) in the main Document may be loaded first, after the preparation of a DOM (Document Object Model) node in the main Document is completed, a domcantonentloaded event may be triggered, at this time, only one DOM root element may be in the page, which corresponds to a first vertical line in the waterfall stream (a first vertical line from left to right in fig. 2), when all link resources in the main Document are loaded, an onload event may be triggered, which corresponds to a second vertical line in the waterfall stream (a second vertical line from left to right in fig. 2), and then (JavaScript, script, language) may execute a trigger interface, a waterfall script, a main frame script, and an interactive process, And loading other types of resources such as styles and the like until the resources are completely loaded and page rendering is completed. At this point, the user may interact with it (i.e., the user may interact with the web page), for example, when clicking on a link address in the web page, the page may jump.
In the embodiment of the present disclosure, a first time when the API loading of the application programming interface in the web page is completed may be obtained by collecting an SDK (Software Development Kit). It should be noted that the acquisition SDK described in this embodiment may be pre-installed in the browser and may be initialized when the browser starts to load a web page.
Specifically, in the process of loading the web page, the electronic device may obtain, through the function provided by the acquisition SDK, a first time when the loading of the application programming interface API in the web page is completed.
It should be noted that the first time described in this embodiment may be the time after all the API in the web page is loaded.
And 103, acquiring a second time for completing webpage loading.
In the embodiment of the present disclosure, when all of the other types of resources such as an application programming interface API, a Script, a picture, a video, and a style are loaded, that is, when all types of resources such as an XHR (XMLHttpRequest object, that is, an API interface), a Script (Script), an IMG (picture), and a Stylesheet (style) are loaded, the web page completes the loading process, that is, the web page is loaded completely.
Specifically, when the web page loading is completed, the electronic device may obtain the second time for completing the web page loading through the function provided by the acquisition SDK.
And 104, acquiring a target idle time period of the main thread from the first time to the second time. It should be noted that the main thread described in this embodiment may be the main thread of the JS in the web page described above, and the target idle period described in this embodiment may be the first fixed period of time (e.g., 500ms) without a long task found between the first time and the second time.
Specifically, after the first time and the second time are obtained, the electronic device may obtain a target idle time period of the main thread from between the first time and the second time according to a preset obtaining policy. The preset acquisition strategy can be calibrated according to actual conditions.
As a possible case, the electronic device may further obtain, by the function provided by the collecting SDK, the target idle period of the main thread from between the first time and the second time.
And 105, generating a webpage index corresponding to the webpage according to the target idle time period.
It should be noted that the Web page indicator described in this embodiment may be a Time To Interactive (TTI) indicator, where the TTI indicator may be a non-standardized Web (World Wide Web or World Wide Web) performance metric that describes when a page or application contains useful content and when a main thread is idle and free To respond To user interaction.
In the embodiment of the disclosure, the webpage indexes corresponding to the webpage can be generated according to a preset generation algorithm and a target idle time period, wherein the preset generation algorithm can be calibrated according to actual conditions,
specifically, after the target idle time period is obtained, the electronic device may generate a webpage index (e.g., an interactive time index) corresponding to the webpage according to a preset generation algorithm and the target idle time period.
As a possible situation, the electronic device may further generate a web page index corresponding to the web page according to the target idle time period by acquiring the function provided by the SDK.
In the embodiment of the disclosure, a webpage corresponding to a target webpage address is loaded in response to a detected webpage loading event, a first time for completing loading of an application programming interface API in the webpage and a second time for completing loading of the webpage are obtained, then a target idle time period of a main thread is obtained between the first time and the second time, and finally a webpage index corresponding to the webpage is generated according to the target idle time period. Therefore, the generated webpage indexes can more accurately measure the webpage performance, so that the webpage optimization is more accurate.
To clearly illustrate the previous embodiment, in an embodiment of the present disclosure, the method for generating a webpage index may further include determining that a webpage loading event is detected if a webpage loading request sent by a user is received, where the webpage loading request includes a target webpage address.
In the embodiment of the disclosure, a user may create a page loading request through a function provided in an address bar of a browser (for example, inputting a target web page address into the address bar of the browser and triggering a loading function), and send the page loading request to the browser, and when the electronic device receives the web page loading request through the browser, it may be determined that a web page loading event is detected. Therefore, the webpage loading request of the user can be responded in time, and the user experience is improved.
Specifically, the user may input a target web page address in an address bar of the browser and trigger access, at which point the electronic device may receive a web page loading request through the browser and determine that a web page loading event is detected.
As a possible scenario, the user may also access the target web page by clicking a link in the browser interface, wherein when the user clicks the link, the electronic device may receive a web page loading request through the browser and determine that a web page loading event is detected.
Further, in an embodiment of the present disclosure, the API may be multiple, as shown in fig. 3, acquiring a first time when the API loading of the application programming interface in the web page is completed may include:
In this disclosure, in the process of loading the API, the acquiring SDK may sequentially obtain the loading completion time of the currently loaded API, establish an association relationship between the API and the loading completion time corresponding to the API, and store the association relationship in the queue. The APIs in the API loading time queue and the loading completion times corresponding to the APIs may be arranged according to the loading sequence.
It should be noted that the API load time queue described in this embodiment may be stored in the browser, so as to facilitate call-out use.
Specifically, in the process of loading the web page, the electronic device may detect whether an API loading time queue is generated in the browser in real time, and when it is determined that the API loading time queue is generated in the browser, obtain the API loading time queue, and obtain API loading completion time corresponding to a tail of the API loading time queue, where the API loading completion time is used as the first time.
It should be noted that the API load completion time described in this embodiment may refer to a load end time in the API load start end time.
Therefore, the first time can be accurately determined, and a basis is provided for generating the webpage index.
In an embodiment of the present disclosure, as shown in fig. 4, acquiring the second time when the webpage loading is completed may include:
And step 402, taking the current time as the second time.
Specifically, in the process of loading the web page, the electronic device may detect in real time whether the web page is not loaded with data within a preset time period, and when it is detected that the web page is not loaded with data within the preset time period, it is indicated that the loading of the web page is completed.
Therefore, the second time can be accurately determined, and a basis is provided for generating the webpage index.
In one embodiment of the present disclosure, as shown in fig. 5, obtaining the target idle period of the main thread from between the first time and the second time may include:
In the embodiment of the present disclosure, between the first time and the second time described above, one or more longtasks may exist in the main thread, and a specific period between the first time and the second time without a long task (for example, a period of 500ms without a long task) may be taken as an idle period.
Among them, a task of more than 50ms may be a long task.
Specifically, after obtaining the first time and the second time, the electronic device may obtain the idle time period from between the first time and the second time through the acquisition SDK, and generate an idle time period set.
It should be noted that the specific time period described in this embodiment may be calibrated according to actual situations and requirements, and is not limited herein.
Specifically, after acquiring the idle time period set, the electronic device may use an idle time period in the idle time period set near the first time as a target idle time period, that is, a first specific time period (e.g., 500ms) without a long task, which is found between the first time and the second time, as the target idle time period.
Therefore, the target idle time period can be accurately determined, a basis is provided for generating the webpage index, and the problem that the main thread is too early when the main thread is idle as the interactive time (namely, the webpage index) before all API interface resources are loaded in the page rendering process is solved.
Further, in an embodiment of the present disclosure, as shown in fig. 6, acquiring the target idle period of the main thread from between the first time and the second time may further include:
In the embodiment of the present disclosure, after the loading of the web page is completed, the user may close the loaded web page through the electronic device, or operate the browser through the electronic device to perform page jump, for example, click a jump link in the web page, or input a new address in an address bar of the browser and trigger a loading function.
Specifically, after obtaining the idle time period set, the electronic device may determine whether the idle time period set is empty through a relevant API, and if so, may obtain a third time when the page is skipped or closed, that is, a current time when the page is skipped or closed.
Specifically, after the third time is obtained, the electronic device may obtain the idle time period of the main thread in the webpage loading process again between the first time and the third time through the acquisition SDK, so as to regenerate the idle time period set.
Therefore, a bottom-pocketing mechanism for generating the webpage indexes is realized, and the recall rate of the webpage indexes is improved.
In one embodiment of the disclosure, generating a web page index corresponding to a web page according to a target idle time period may include acquiring a start time of the target idle time period, and using the start time as the web page index.
Specifically, after the target idle time period is obtained, the electronic device may obtain the start time of the target idle time period through the acquisition SDK, and use the start time as a web page indicator. Therefore, a reasonable webpage index can be generated, so that the measurement of the webpage performance is more accurate, and the webpage can be better optimized.
In order to make the generation method of the web page indicator of the embodiment of the present disclosure more clearly understood by those skilled in the art, referring to fig. 7, when accessing the target web page address, the SDK (for example, collecting the SDK) initialization can be firstly carried out, and the time (r) of completing the loading of the XHR interface (API interface) resource can be found through the initialized SDK, and find the time when the loading of all types of resources (XHR, Script, IMG, Stylesheet) is completed (two), finally find the 500ms period of the first No Longtask (without long task) between (one) and (two), and the starting point of the period is used as a webpage index (c), if No No Longtask (No long task) 500ms period is found between (r) and (c), the time (r) when the page jumps or closes can be found, and the 500ms period of the first No Longtask (without long task) can be found between (r) and (r), and the starting point of the period is used as the index of the web page.
According to the method for generating the webpage index, firstly, in response to the detection of a webpage loading event, a webpage corresponding to a target webpage address is loaded, a first time for completing the loading of an Application Programming Interface (API) in the webpage and a second time for completing the loading of the webpage are obtained, then a target idle time period of a main thread is obtained between the first time and the second time, and finally the webpage index corresponding to the webpage is generated according to the target idle time period. Therefore, the generated webpage indexes can more accurately measure the webpage performance, so that the webpage optimization is more accurate.
Fig. 8 is a schematic structural diagram of a device for generating a web page indicator according to an embodiment of the present disclosure.
The device for generating the webpage index can be configured in the electronic equipment to realize that a webpage corresponding to a target webpage address is loaded in response to the detection of a webpage loading event, a first time for completing the loading of an application programming interface API in the webpage and a second time for completing the loading of the webpage are obtained, then a target idle time period of a main thread is obtained between the first time and the second time, and the webpage index corresponding to the webpage is generated according to the target idle time period, so that the webpage performance can be accurately weighed, and the webpage optimization is more accurate.
As shown in fig. 8, the apparatus 800 for generating a web page indicator may include: a loading module 810, a first obtaining module 820, a second obtaining module 830, a third obtaining module 840 and a generating module 850.
The loading module 810 is configured to load a webpage corresponding to the target webpage address in response to detecting a webpage loading event. The target webpage address can be a webpage address based on an HTTP channel.
It should be noted that the web page described in this embodiment may be a web page loaded through a browser, where a user (related person) may input (write) a target web page address into an address bar of the browser through the loading module 810, so that the browser loads a web page corresponding to the target web page address.
In the embodiment of the present disclosure, the loading module 810 may detect whether a web page loading event is triggered in real time through a relevant API, so that the loading module 810 can respond to the web page loading event in time when detecting the web page loading event.
Specifically, when the loading module 810 detects a web page loading event through the relevant API, the web page corresponding to the target web page address may be loaded in response to the web page loading event.
As a possible scenario, the user may also enter the target web page address by clicking a web page link of the browser interface.
The first obtaining module 820 is configured to obtain a first time when loading of an application programming interface API in a web page is completed.
In the embodiment of the present disclosure, referring to fig. 2, in the process of loading the web page corresponding to the target web page address, the web page may undergo a process of completing white screen, partial rendering, and final loading, and may be interacted with each other, in this process, html may be loaded first to a main document index, a DOM node in the main document may trigger a domecontentloaded event after preparation is completed, at this time, there may be only one DOM root element in the page corresponding to a first vertical line in a waterfall stream (a first vertical line from left to right in fig. 2), when all link resources are loaded in the main document, an onload event may be triggered, a second vertical line in the waterfall stream (a second vertical line from left to right in fig. 2) may be corresponding to the first vertical line, then the main frame may perform loading of other types of resources such as an initiation interface, a JS, a picture, a style, and the like, until all resources are loaded, and finishing page rendering. At this time, the user may interact with the web page, for example, when clicking a link address in the web page, the page may jump.
In this disclosure, the first obtaining module 820 may obtain the first time when the loading of the API in the web page is completed by collecting the SDK. It should be noted that the acquisition SDK described in this embodiment may be pre-installed in the browser and may be initialized when the browser starts to load a web page.
Specifically, in the process of loading the web page, the first obtaining module 820 may obtain the first time for completing the loading of the API in the web page through the function provided by the collecting SDK.
It should be noted that the first time described in this embodiment may be the time after all the API in the web page is loaded.
The second obtaining module 830 is configured to obtain a second time when the webpage loading is completed.
In the embodiment of the present disclosure, when all of the other types of resources such as an application programming interface API, a Script, a picture, a video, and a style are loaded, that is, when all types of resources such as an XHR (XMLHttpRequest object, that is, an API interface), a Script (Script), an IMG (picture), and a Stylesheet (style) are loaded, the web page completes the loading process, that is, the web page is loaded completely.
Specifically, when the web page loading is completed, the second obtaining module 830 may obtain the second time when the web page loading is completed through the function provided by the collecting SDK.
The third obtaining module 840 is configured to obtain a target idle period of the main thread from between the first time and the second time. It should be noted that the main thread described in this embodiment may be the main thread of the JS in the web page described above, and the target idle period described in this embodiment may be the first fixed period of time (e.g., 500ms) without a long task found between the first time and the second time.
Specifically, after the second obtaining module 830 obtains the second time, the third obtaining module 840 may obtain a target idle time period of the main thread from between the first time and the second time according to a preset obtaining policy. The preset acquisition strategy can be calibrated according to actual conditions.
As a possible scenario, the third obtaining module 840 may further obtain the target idle time period of the main thread from between the first time and the second time through the function provided by the collecting SDK.
And the generating module 850 is configured to generate a webpage index corresponding to the webpage according to the target idle time period.
In the embodiment of the present disclosure, the generating module 850 may generate the webpage index corresponding to the webpage according to a preset generating algorithm and a target idle time period, wherein the preset generating algorithm may be calibrated according to an actual situation,
specifically, after the third obtaining module 840 obtains the target idle time period, the generating module 850 may generate a webpage index corresponding to the webpage according to a preset generating algorithm and the target idle time period.
As a possible scenario, the generating module 850 may further generate the web page index corresponding to the web page according to the target idle time period by collecting the functions provided by the SDK.
In the embodiment of the disclosure, in response to the detection of a webpage loading event, the loading module loads a webpage corresponding to a target webpage address, the first acquisition module acquires a first time for completing the loading of an application programming interface API in the webpage, the second acquisition module acquires a second time for completing the loading of the webpage, the third acquisition module acquires a target idle time period of the main thread from between the first time and the second time, and the generation module generates a webpage index corresponding to the webpage according to the target idle time period, so that the webpage performance can be measured more accurately, and the webpage can be optimized more accurately.
In an embodiment of the present disclosure, as shown in fig. 8, the apparatus 800 for generating a web page indicator may further include: the determining module 860 is configured to determine that a web page loading event is detected if a web page loading request sent by a user is received, where the web page loading request includes a target web page address.
In an embodiment of the disclosure, the API is multiple, and the first obtaining module 820 is specifically configured to: acquiring an API loading time queue, wherein the API loading time queue comprises loading completion time corresponding to each API in a plurality of APIs; and acquiring API loading completion time corresponding to the tail of the API loading time queue, and taking the API loading completion time as the first time.
In an embodiment of the present disclosure, the second obtaining module 830 is specifically configured to: if the webpage does not load data within a preset time period, acquiring the current time; and taking the current time as the second time.
In an embodiment of the disclosure, the third obtaining module 840 is specifically configured to: acquiring an idle time period of a main thread in a webpage loading process from between a first time and a second time to generate an idle time period set; and taking the idle time periods adjacent to the first time in the idle time period set as target idle time periods.
In an embodiment of the disclosure, the generating module 850 is specifically configured to: and acquiring the starting time of the target idle time period, and taking the starting time as a webpage index.
In an embodiment of the disclosure, the third obtaining module 840 is further configured to: if the idle time period set is empty, acquiring third time when the page jumps or is closed; and from the first time to the third time, the idle time periods of the main threads in the webpage loading process are obtained again, so that the idle time period set is regenerated.
It should be noted that the explanation of the embodiment of the method for generating a web page index is also applicable to the apparatus for generating a web page index of the embodiment, and details are not repeated here.
The device for generating the webpage index, disclosed by the embodiment of the disclosure, loads a webpage corresponding to a target webpage address in response to a detected webpage loading event through a loading module, acquires a first time for completing loading of an application programming interface API in the webpage through a first acquisition module, acquires a second time for completing loading of the webpage through a second acquisition module, acquires a target idle time period of a main thread from between the first time and the second time through a third acquisition module, and finally generates the webpage index corresponding to the webpage according to the target idle time period through a generation module. Therefore, the generated webpage indexes can more accurately measure the webpage performance, so that the webpage optimization is more accurate.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 9 illustrates a schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 9, the apparatus 900 includes a computing unit 901, which can perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The calculation unit 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
A number of components in the device 900 are connected to the I/O interface 905, including: an input unit 906 such as a keyboard, a mouse, and the like; an output unit 907 such as various types of displays, speakers, and the like; a storage unit 908 such as a magnetic disk, optical disk, or the like; and a communication unit 909 such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 909 allows the device 900 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 901 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 901 performs the respective methods and processes described above, such as the generation method of the web page index. For example, in some embodiments, the method of generating the web page indicator may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 900 via ROM 902 and/or communications unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the method for generating a web page indicator described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the generation method of the web page indicator by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.
Claims (17)
1. A method for generating webpage indexes comprises the following steps:
in response to detecting a webpage loading event, loading a webpage corresponding to the target webpage address;
acquiring first time for loading an Application Programming Interface (API) in the webpage;
acquiring second time for completing webpage loading;
acquiring a target idle time period of a main thread from between the first time and the second time; and
and generating a webpage index corresponding to the webpage according to the target idle time period.
2. The method of claim 1, further comprising:
and if a webpage loading request sent by a user is received, determining that the webpage loading event is detected, wherein the webpage loading request comprises the target webpage address.
3. The method of claim 1, wherein the API is plural, and the obtaining a first time when the API loading in the web page is completed comprises:
acquiring an API loading time queue, wherein the API loading time queue comprises loading completion time corresponding to each API in a plurality of APIs;
and acquiring API loading completion time corresponding to the tail of the API loading time queue, and taking the API loading completion time as the first time.
4. The method of claim 1, wherein the obtaining the second time at which the web page loading is complete comprises:
if the webpage is not loaded with data within a preset time period, acquiring the current time;
and taking the current time as the second time.
5. The method of claim 1, wherein said obtaining a target idle period for a main thread from between the first time and the second time comprises:
acquiring an idle time period of the main thread in the webpage loading process from the time between the first time and the second time to generate an idle time period set;
and taking the idle time periods close to the first time in the idle time period set as the target idle time period.
6. The method of claim 1, wherein the generating a web page indicator corresponding to the web page according to the target idle time period comprises:
and acquiring the starting time of the target idle time period, and taking the starting time as the webpage index.
7. The method of claim 5, wherein said obtaining a target idle period for a main thread from between said first time and said second time further comprises:
if the idle time period set is empty, acquiring third time when the page jumps or is closed;
and re-acquiring the idle time period of the main thread in the webpage loading process from the time between the first time and the third time to regenerate an idle time period set.
8. An apparatus for generating a web page indicator, comprising:
the loading module is used for responding to the detected webpage loading event and loading the webpage corresponding to the target webpage address;
the first acquisition module is used for acquiring the first time when the loading of the application programming interface API in the webpage is finished;
the second acquisition module is used for acquiring second time for completing the webpage loading;
a third obtaining module, configured to obtain a target idle time period of the main thread from between the first time and the second time; and
and the generating module is used for generating the webpage indexes corresponding to the webpage according to the target idle time period.
9. The apparatus of claim 8, further comprising:
and the determining module is used for determining that the webpage loading event is detected if a webpage loading request sent by a user is received, wherein the webpage loading request comprises the target webpage address.
10. The apparatus according to claim 8, wherein the API is plural, and the first obtaining module is specifically configured to:
acquiring an API loading time queue, wherein the API loading time queue comprises loading completion time corresponding to each API in a plurality of APIs;
and acquiring API loading completion time corresponding to the tail of the API loading time queue, and taking the API loading completion time as the first time.
11. The apparatus according to claim 8, wherein the second obtaining module is specifically configured to:
if the webpage is not loaded with data within a preset time period, acquiring the current time;
and taking the current time as the second time.
12. The apparatus according to claim 8, wherein the third obtaining module is specifically configured to:
acquiring an idle time period of the main thread in the webpage loading process from the time between the first time and the second time to generate an idle time period set;
and taking the idle time periods close to the first time in the idle time period set as the target idle time period.
13. The apparatus of claim 8, wherein the generating module is specifically configured to:
and acquiring the starting time of the target idle time period, and taking the starting time as the webpage index.
14. The apparatus of claim 12, wherein the third obtaining means is further configured to:
if the idle time period set is empty, acquiring third time when the page jumps or is closed;
and re-acquiring the idle time period of the main thread in the webpage loading process from the time between the first time and the third time to regenerate an idle time period set.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of generating a web page indicator of any of claims 1-7.
16. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of generating a web page indicator according to any one of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, carries out the steps of the method of generating a web page indicator according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111087682.0A CN113849758A (en) | 2021-09-16 | 2021-09-16 | Webpage index generation method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111087682.0A CN113849758A (en) | 2021-09-16 | 2021-09-16 | Webpage index generation method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113849758A true CN113849758A (en) | 2021-12-28 |
Family
ID=78974397
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111087682.0A Pending CN113849758A (en) | 2021-09-16 | 2021-09-16 | Webpage index generation method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113849758A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024060867A1 (en) * | 2022-09-22 | 2024-03-28 | 深圳Tcl新技术有限公司 | Webpage index information acquisition method and apparatus, computer device, and storage medium |
WO2024152521A1 (en) * | 2023-01-17 | 2024-07-25 | 中兴通讯股份有限公司 | Operation time delay determination method, electronic device and readable storage medium |
-
2021
- 2021-09-16 CN CN202111087682.0A patent/CN113849758A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024060867A1 (en) * | 2022-09-22 | 2024-03-28 | 深圳Tcl新技术有限公司 | Webpage index information acquisition method and apparatus, computer device, and storage medium |
WO2024152521A1 (en) * | 2023-01-17 | 2024-07-25 | 中兴通讯股份有限公司 | Operation time delay determination method, electronic device and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110717121B (en) | Method and device for determining first screen time of page | |
CN105786455B (en) | Data processing method and device and terminal | |
CN115879469B (en) | Text data processing method, model training method, device and medium | |
CN112559378A (en) | Automatic driving algorithm evaluation method and device and scene library generation method and device | |
CN113849758A (en) | Webpage index generation method and device, electronic equipment and storage medium | |
CN114218890A (en) | Page rendering method and device, electronic equipment and storage medium | |
CN113656533A (en) | Tree control processing method and device and electronic equipment | |
CN113190746A (en) | Recommendation model evaluation method and device and electronic equipment | |
CN114141236B (en) | Language model updating method and device, electronic equipment and storage medium | |
CN113032251B (en) | Method, device and storage medium for determining service quality of application program | |
CN114998963A (en) | Image detection method and method for training image detection model | |
CN114071192A (en) | Information acquisition method, terminal, server, electronic device, and storage medium | |
CN113867634A (en) | Data reading method and device, electronic equipment and storage medium | |
CN113344620A (en) | Method, device and storage medium for issuing welfare information | |
US11841891B2 (en) | Mapping webpages to page groups | |
CN114390366B (en) | Video processing method and device | |
US11947620B1 (en) | Interfaces for automatically mapping webpages to page groups | |
CN113836939B (en) | Text-based data analysis method and device | |
CN113434378B (en) | Webpage stability detection method and device, electronic equipment and readable storage medium | |
CN114328154A (en) | Attribution method, device, equipment and storage medium of page loading performance | |
CN116820656A (en) | Large screen interface generation method, device, equipment and storage medium | |
CN117331796A (en) | Code adoption rate acquisition method and device, electronic equipment and storage medium | |
CN116628383A (en) | Page jump method, device, electronic equipment and storage medium | |
CN115904899A (en) | Operation record generation method, operation record acquisition method, operation record generation device, operation record acquisition device and operation record acquisition medium | |
CN116860130A (en) | Data visualization method, device, electronic equipment 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 |