Search

CN-121996372-A - Front-end resource dynamic optimization method and device, electronic equipment and storage medium

CN121996372ACN 121996372 ACN121996372 ACN 121996372ACN-121996372-A

Abstract

The application discloses a front-end resource dynamic optimization method, a device, electronic equipment and a storage medium, and relates to the technical field of intelligent home, wherein the method comprises the steps of obtaining user interaction data; the method comprises the steps of predicting at least one resource which is likely to be accessed by a user based on user interaction data, evaluating the priority of the at least one resource, dynamically scheduling loading of the at least one resource based on the priority of the at least one resource and the current network state, wherein the priority comprises a high priority and a low priority, and loading comprises the steps of preloading the high priority resource and lazy loading the low priority resource. By the method provided by the application, the user interaction data and the resource priority evaluation are dynamically associated with the current network state, so that intelligent coordination of preloading and lazy loading strategies is realized, blind loading of unnecessary resources is effectively avoided, user experience is ensured, bandwidth consumption and memory occupation are greatly reduced, and balance of front-end resource loading efficiency and performance overhead is realized.

Inventors

  • YU GUICHUAN
  • FENG CHAOJUN

Assignees

  • 青岛海尔科技有限公司
  • 海尔优家智能科技(北京)有限公司
  • 海尔智家股份有限公司

Dates

Publication Date
20260508
Application Date
20251225

Claims (10)

  1. 1. The front-end resource dynamic optimization method is characterized by comprising the following steps of: acquiring user interaction data; Predicting at least one resource that a user may access based on the user interaction data, and evaluating a priority of the at least one resource; Dynamically scheduling loading of the at least one resource based on the priority of the at least one resource and the current network state, wherein the priority comprises a high priority and a low priority, and the loading comprises pre-loading the high priority resource and lazy loading the low priority resource.
  2. 2. The method for dynamically optimizing front-end resources according to claim 1, wherein the obtaining user interaction data comprises: Acquiring a mouse moving track, a mouse clicking event and page rolling behavior of a user monitored in real time; and generating the user interaction data based on the mouse moving track, the mouse clicking event and the page rolling behavior.
  3. 3. The method for dynamically optimizing front-end resources according to claim 2, wherein predicting at least one resource that a user may access based on the user interaction data comprises: inputting the user interaction data into a pre-trained behavior prediction model, and outputting a page or a component which is possibly accessed by a user as the at least one resource; The behavior prediction model is a machine learning model which is trained based on user historical interaction data and is used for predicting possible accessed resources or page paths according to a real-time user behavior sequence.
  4. 4. The method of dynamic optimization of front-end resources according to claim 1, wherein said evaluating the priority of said at least one resource comprises: inputting at least one resource which the user possibly accesses into a pre-trained weighted scoring model, and outputting the priority of the at least one resource; The weighted scoring model is calculated through at least one factor of historical access frequency of the resource, link conspicuity degree of the resource in a current page, mouse moving track pointing to the resource, size and loading time consumption of the resource, and real-time bandwidth estimation of the current network state.
  5. 5. The method of dynamic optimization of front-end resources according to claim 1, wherein dynamically scheduling loading of the at least one resource based on the priority of the at least one resource and the current network state comprises: sequencing the at least one resource according to the priority of the at least one resource to generate a resource loading queue; and dynamically adjusting the loading time and sequence of the resources in the resource loading queue according to the current network state.
  6. 6. The method for dynamically optimizing a front-end resource according to claim 5, wherein dynamically adjusting the loading time and order of the resources in the resource loading queue according to the current network state comprises: loading low-priority resources in the resource loading queue under the condition that the current network state is perceived to be in a good state, wherein the good state refers to that the network bandwidth is greater than or equal to a preset threshold value; And under the condition that the current network state is perceived to be in a poor state, only loading the high-priority resource in the resource loading queue, and loading the high-priority resource in a compression format, wherein the poor state means that the network bandwidth is smaller than the preset threshold.
  7. 7. The method of dynamic optimization of front-end resources according to any one of claims 1 to 6, wherein said dynamically scheduling loading of said at least one resource is followed by said dynamically scheduling of said at least one resource based on a priority of said at least one resource and a current network state, said method further comprising: Judging whether the target resource is preloaded or not in response to the fact that a user triggers access to the target resource; invoking the target resource from a local cache if the target resource has been preloaded; In the event that the target resource is not preloaded, a network request is initiated for the target resource to perform loading.
  8. 8. A front-end resource dynamic optimization device, comprising: The acquisition module is used for acquiring user interaction data; an evaluation module for predicting at least one resource that a user may access based on the user interaction data and evaluating a priority of the at least one resource; And the optimizing module is used for dynamically scheduling loading of the at least one resource based on the priority of the at least one resource and the current network state, wherein the priority comprises a high priority and a low priority, and the loading comprises the steps of pre-loading the high priority resource and lazy loading the low priority resource.
  9. 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the front-end resource dynamic optimization method according to any of claims 1 to 7 when executing the computer program.
  10. 10. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the front-end resource dynamic optimization method according to any one of claims 1 to 7.

Description

Front-end resource dynamic optimization method and device, electronic equipment and storage medium Technical Field The present application relates to the field of smart home technologies, and in particular, to a method and apparatus for dynamically optimizing front-end resources, an electronic device, and a storage medium. Background Lazy loading and preloading are two common resource loading strategies in the current front-end performance optimization field. Prior art schemes typically use these two strategies, either independently or simply in combination, for example, to implement lazy loading only on the first off-screen picture to reduce initialization load, or to promote fluency in subsequent navigation by preloading key resources. However, these solutions have significant drawbacks. The simple lazy loading can cause obvious waiting delay to be generated when the user interacts with the subsequent content of the page to influence the experience, and the blind preloading can cause serious waste of network bandwidth and equipment memory because of loading resources which the user cannot access at all. Therefore, a solution is needed to solve the above-mentioned problems. Disclosure of Invention The application provides a front-end resource dynamic optimization method, a front-end resource dynamic optimization device, electronic equipment and a storage medium, which are used for solving the defects in the prior art. The application provides a front-end resource dynamic optimization method, which comprises the following steps: acquiring user interaction data; Predicting at least one resource that a user may access based on the user interaction data, and evaluating a priority of the at least one resource; Dynamically scheduling loading of the at least one resource based on the priority of the at least one resource and the current network state, wherein the priority comprises a high priority and a low priority, and the loading comprises pre-loading the high priority resource and lazy loading the low priority resource. According to the method for dynamically optimizing the front-end resources provided by the application, the acquisition of the user interaction data comprises the following steps: Acquiring a mouse moving track, a mouse clicking event and page rolling behavior of a user monitored in real time; and generating the user interaction data based on the mouse moving track, the mouse clicking event and the page rolling behavior. According to the method for dynamically optimizing the front-end resources provided by the application, the method for predicting at least one resource which is likely to be accessed by a user based on the user interaction data comprises the following steps: inputting the user interaction data into a pre-trained behavior prediction model, and outputting a page or a component which is possibly accessed by a user as the at least one resource; The behavior prediction model is a machine learning model which is trained based on user historical interaction data and is used for predicting possible accessed resources or page paths according to a real-time user behavior sequence. According to the method for dynamically optimizing the front-end resources provided by the application, the step of evaluating the priority of the at least one resource comprises the following steps: inputting at least one resource which the user possibly accesses into a pre-trained weighted scoring model, and outputting the priority of the at least one resource; The weighted scoring model is calculated through at least one factor of historical access frequency of the resource, link conspicuity degree of the resource in a current page, mouse moving track pointing to the resource, size and loading time consumption of the resource, and real-time bandwidth estimation of the current network state. According to the method for dynamically optimizing the front-end resources provided by the application, the loading of the at least one resource is dynamically scheduled based on the priority of the at least one resource and the current network state, and the method comprises the following steps: sequencing the at least one resource according to the priority of the at least one resource to generate a resource loading queue; and dynamically adjusting the loading time and sequence of the resources in the resource loading queue according to the current network state. According to the method for dynamically optimizing the front-end resources provided by the application, the loading time and sequence of the resources in the resource loading queue are dynamically adjusted according to the current network state, and the method comprises the following steps: loading low-priority resources in the resource loading queue under the condition that the current network state is perceived to be in a good state, wherein the good state refers to that the network bandwidth is greater than or equal to a preset threshold value; And under the