Page performance optimization method and device, electronic equipment, medium and program product
Through the duration prediction model and large-model analysis, combined with the resource combination model, the optimization strategy is selected, which solves the problem of poor page performance optimization in the existing technology, and achieves a significant reduction in page loading time and an improvement in user experience.
Patent Information
- Application Number
- CN202411404849.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-10-09
AI Technical Summary
Existing page performance optimization methods cannot effectively improve the user experience, the page loading time optimization effect is not obvious, and the interaction of optimization strategies may lead to performance degradation.
The duration prediction model and large-scale model are used to predict resource loading time and perform performance bottleneck analysis, multiple resource optimization loading strategies are generated, and these strategies are comprehensively evaluated through the resource combination model, and the most suitable strategy combination is selected to optimize page loading.
Reduces unnecessary resource optimization loading strategies, reduces potential performance problems, significantly reduces page loading time, and improves user experience.
Smart Images

Figure CN119166926A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular to a page performance optimization method, device, electronic device, medium and program product. Background Art
[0002] As the complexity of web pages and applications continues to increase, front-end performance issues such as page loading time and interaction delay have become key factors affecting user experience. Front-end performance optimization is a complex task that requires consideration of many factors and the adoption of corresponding strategies for optimization. In order to reduce interaction delays, the user's waiting time can be reduced, and the user's experience of using web pages and applications can be better improved. Therefore, it is crucial to choose the right optimization strategy to improve page loading time and provide users with a higher experience.
[0003] In the prior art, the optimization method for page performance usually uses a machine learning model to obtain and execute an optimization strategy for the front end. The specific process is: after obtaining the front-end performance data of the page, it is input into a performance optimization model based on machine learning to obtain an optimization strategy for the front end and automatically execute it, thereby reducing the page loading time.
[0004] However, existing page performance optimization methods are not effective in reducing page loading time and cannot effectively improve the user experience of using the page. Summary of the invention
[0005] The present application provides a page performance optimization method, device, electronic device, medium and program product to solve the technical problem that the page performance optimization method in the prior art has no obvious optimization effect on page performance and cannot effectively improve the user experience of using the page.
[0006] In a first aspect, the present application provides a method for optimizing page performance, comprising:
[0007] Inputting the resource information to be loaded and the initial loading strategy into a duration prediction model, and obtaining a first predicted duration output by the duration prediction model, wherein the duration prediction model is pre-trained based on the sample resource information, the sample initial loading strategy, and the first sample loading duration;
[0008] Inputting the first predicted duration, the information of the resources to be loaded, and the initial loading strategy into a large model, and obtaining a plurality of resource optimization loading strategies output by the large model;
[0009] Input the multiple resource optimization loading strategies and the information of the resources to be loaded into a resource combination model, and obtain a resource optimization loading strategy combination output by the resource combination model, wherein the resource combination model is pre-trained according to a sample resource optimization loading strategy combination and a corresponding second sample loading duration;
[0010] The resource optimization loading strategy combination is applied to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
[0011] Optionally, the resource information to be loaded includes resource quantity, resource name and resource type.
[0012] Optionally, the resource optimization loading strategy combination includes at least one of the following:
[0013] Static resource compression strategy, caching strategy, code adjustment strategy, and resource loading order strategy.
[0014] Optionally, after inputting the multiple resource optimization loading strategies into the resource combination model and obtaining the resource optimization loading strategy combination output by the resource combination model, the method further includes:
[0015] Inputting the resource optimization loading strategy combination and the to-be-loaded resource information into the duration prediction model, and obtaining a second predicted duration output by the duration prediction model;
[0016] Correspondingly, after the resource optimization loading strategy combination is applied to load the resource to be loaded corresponding to the resource information to be loaded in the target page, the method further includes:
[0017] Obtaining the actual loading time of the target page;
[0018] If the difference between the loading duration and the second predicted duration exceeds a preset duration, the duration prediction model is retrained.
[0019] Optionally, before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, the method includes:
[0020] Obtaining multiple sample resource information and the sample initial loading strategy and first sample loading duration corresponding to each resource sample information;
[0021] Creating a training set and a validation set according to the multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each resource sample information;
[0022] Based on the training set, a plurality of different types of first initial models are trained respectively to obtain a plurality of initial duration prediction models, wherein the plurality of different types of initial models include at least two of a linear regression model, a random forest model, a gradient boosting tree model, and a neural network model;
[0023] The accuracy of each initial duration prediction model is determined using the validation set, and the initial duration prediction model with the highest accuracy is determined as the duration prediction model.
[0024] Optionally, before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, the method includes:
[0025] For each sample resource information, the sample resource information and the corresponding sample initial loading strategy and the first sample loading duration are input into the large model to obtain multiple sample resource optimization loading strategies output by the large model;
[0026] Combining multiple sample resource optimization loading strategies to generate multiple groups of sample resource optimization loading strategy combinations;
[0027] Execute the plurality of groups of sample resource optimization loading strategy combinations to load the sample resources corresponding to the sample resource information, and obtain the second sample duration corresponding to each group of sample resource optimization loading strategy combinations;
[0028] The second initial model is trained according to each sample resource information, each group of sample resource optimization loading strategy combination and the corresponding second sample duration to obtain a resource combination model.
[0029] In a second aspect, the present application provides a page performance optimization device, comprising:
[0030] A first acquisition module, used to input the resource information to be loaded and the initial loading strategy into a duration prediction model, and obtain a first predicted duration output by the duration prediction model, wherein the duration prediction model is pre-trained based on the sample resource information, the sample initial loading strategy, and the first sample loading duration;
[0031] A second acquisition module is used to input the first predicted duration, the information of the resources to be loaded, and the initial loading strategy into a large model, and obtain multiple resource optimization loading strategies output by the large model;
[0032] A third acquisition module is used to input the multiple resource optimization loading strategies and the information of the resources to be loaded into a resource combination model, and obtain the resource optimization loading strategy combination output by the resource combination model, wherein the resource combination model is pre-trained according to the sample resource optimization loading strategy combination and the corresponding second sample loading duration;
[0033] The application module is used to apply the resource optimization loading strategy combination to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
[0034] Optionally, the resource information to be loaded includes resource quantity, resource name and resource type.
[0035] Optionally, the resource optimization loading strategy combination includes at least one of the following:
[0036] Static resource compression strategy, caching strategy, code adjustment strategy, and resource loading order strategy.
[0037] Optionally, the third acquisition module, after inputting the multiple resource optimization loading strategies into the resource combination model and acquiring the resource optimization loading strategy combination output by the resource combination model, is further used to:
[0038] Inputting the resource optimization loading strategy combination and the to-be-loaded resource information into the duration prediction model, and obtaining a second predicted duration output by the duration prediction model;
[0039] Correspondingly, after the resource optimization loading strategy combination is applied to load the resource to be loaded corresponding to the resource information to be loaded in the target page, the method further includes:
[0040] Obtaining the actual loading time of the target page;
[0041] If the difference between the loading duration and the second predicted duration exceeds a preset duration, the duration prediction model is retrained.
[0042] Optionally, the page performance optimization device further includes a processing module, which is used for: before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model:
[0043] Obtaining multiple sample resource information and the sample initial loading strategy and first sample loading duration corresponding to each resource sample information;
[0044] Creating a training set and a validation set according to the multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each resource sample information;
[0045] Based on the training set, a plurality of different types of first initial models are trained respectively to obtain a plurality of initial duration prediction models, wherein the plurality of different types of initial models include at least two of a linear regression model, a random forest model, a gradient boosting tree model, and a neural network model;
[0046] The accuracy of each initial duration prediction model is determined using the validation set, and the initial duration prediction model with the highest accuracy is determined as the duration prediction model.
[0047] Optionally, the processing module, before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, is further configured to:
[0048] For each sample resource information, the sample resource information and the corresponding sample initial loading strategy and the first sample loading duration are input into the large model to obtain multiple sample resource optimization loading strategies output by the large model;
[0049] Combining multiple sample resource optimization loading strategies to generate multiple groups of sample resource optimization loading strategy combinations;
[0050] Execute the plurality of groups of sample resource optimization loading strategy combinations to load the sample resources corresponding to the sample resource information, and obtain the second sample duration corresponding to each group of sample resource optimization loading strategy combinations;
[0051] The second initial model is trained according to each sample resource information, each group of sample resource optimization loading strategy combination and the corresponding second sample duration to obtain a resource combination model.
[0052] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0053] Memory stores computer-executable instructions;
[0054] The processor executes the computer-executable instructions stored in the memory to implement the page performance optimization method as described in the first aspect and various possible implementations of the first aspect.
[0055] In a fourth aspect, the present application provides a computer-readable storage medium, comprising computer execution instructions. When a processor executes the computer execution instructions, the page performance optimization method as described in the first aspect and various possible implementations of the first aspect is performed.
[0056] In a fifth aspect, the present application provides a program product, which includes a computer program, and the computer program is executed by a processor to implement the page performance optimization method as described in the first aspect and various possible implementation methods of the first aspect.
[0057] The page performance optimization method, device, electronic device, medium and program product provided by the present application, first, by using the duration prediction model, according to the information of the resources to be loaded and the initial loading strategy, the resource loading time (i.e., the first predicted duration) is predicted; then, the large model will perform performance bottleneck analysis based on the predicted loading time, the information of the resources to be loaded and the initial loading strategy, and identify the key factors that may affect the front-end performance, such as insufficient network bandwidth, resource dependency conflicts or loading order problems under specific conditions. According to the analysis results, the large model will output a variety of resource optimization loading strategies to improve the overall front-end performance; then, these optimization strategies are comprehensively evaluated using the resource combination model. The model considers multiple factors, including the advantages of each strategy, potential interactions and performance under different conditions, to determine the strategy combination that best suits the current page and user environment. This process not only reduces unnecessary resource optimization loading strategies, but also reduces potential performance problems; finally, the optimized resource loading strategy combination is applied to the target page, which effectively reduces the page loading time, reduces the user waiting time, and improves the user's experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0059] Figure 1 The process of the page performance optimization method provided in the embodiment of the present application Figure 1 ;
[0060] Figure 2 The process of the page performance optimization method provided in the embodiment of the present application Figure 2 ;
[0061] Figure 3 A schematic diagram of the structure of a page performance optimization device provided in an embodiment of the present application;
[0062] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0063] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0064] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0065] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0066] As the complexity of web pages and applications continues to increase, front-end performance issues such as page loading time and interaction delay have become key factors affecting user experience. Front-end performance optimization is a complex task that requires comprehensive consideration of multiple factors, including resource loading order, network latency, script execution time, image and media file size, and server response time. By formulating an effective optimization strategy, interaction delays can be significantly reduced, reducing user waiting time, thereby improving their experience of using web pages and applications. Therefore, choosing the right optimization strategy is particularly important, especially in the ever-changing network environment and user needs.
[0067] In the prior art, the optimization method for page performance usually uses a machine learning model to obtain and execute an optimization strategy for the front end. The specific process is: after obtaining the front-end performance data of the page, it is input into a performance optimization model based on machine learning to further identify performance bottlenecks and potential optimization points, thereby generating a specific optimization strategy and automatically executing it to achieve page performance optimization.
[0068] However, existing page performance optimization methods do not have obvious optimization effects on page performance. For example, the interaction of different combinations of optimization strategies may lead to unexpected performance problems, that is, certain optimizations may cause performance degradation rather than improvement under certain conditions, thereby failing to effectively improve the user experience of using the page.
[0069] Based on this, the present application proposes a page performance optimization method, device, equipment, medium and program product. Since the large model output includes multiple resource optimization loading strategies, and the effect of each resource optimization strategy on the front-end performance is interactive, multiple resource optimization loading strategies may reduce the front-end performance under special circumstances. Therefore, before executing the resource optimization loading strategy, the generated multiple resource optimization loading strategies can be selected by using the resource combination model, and the resource optimization loading strategy combination can be output, that is, firstly, the resource loading time (i.e., the first predicted duration) is predicted according to the resource information to be loaded and the initial loading strategy using the duration prediction model; afterwards, the large model performs performance bottleneck analysis according to the predicted resource loading time, the resource information to be loaded and the initial loading strategy, so as to output multiple resource optimization loading strategies to improve the front-end performance; further, the resource combination model is used to optimize and select multiple resource optimization loading strategies to output a resource optimization loading strategy combination with better performance improvement effect, and execute it in the target page. In this way, unnecessary resource optimization loading strategies are reduced, potential performance problems are reduced, page loading time is minimized, the optimization effect of page performance is improved, and a better experience is provided for users.
[0070] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0071] Figure 1 The process of the page performance optimization method provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the method includes:
[0072] S101: Input the to-be-loaded resource information and the initial loading strategy into a duration prediction model, and obtain a first predicted duration output by the duration prediction model.
[0073] The duration prediction model is trained in advance according to sample resource information, sample initial loading strategy and first sample loading duration.
[0074] It should be noted that the resource information to be loaded includes resource quantity, resource name and resource type. Resource quantity refers to the total number of resources to be loaded; resource name refers to the name or uniform resource locator of each resource, which can be used for subsequent loading and management; resource type can include pictures, videos, scripts and style sheets, etc.
[0075] It can be understood that by inputting the to-be-loaded resource information consisting of resource quantity, resource name and resource type and the initial loading strategy into the trained duration prediction model, the duration prediction model can predict and output the corresponding resource loading duration, i.e., the first predicted duration, based on the learned relationship between the to-be-loaded resource information and the initial loading strategy and the loading time. The accurate first predicted duration can provide a basis for the subsequent large model to perform performance bottleneck analysis.
[0076] S102: Input the first predicted duration, information of resources to be loaded, and the initial loading strategy into the big model, and obtain multiple resource optimization loading strategies output by the big model.
[0077] It can be understood that the first predicted duration, the information of resources to be loaded, and the initial loading strategy are input into the big model. The big model identifies potential reasons for the extension of loading time and evaluates the key factors affecting performance, such as whether some resources depend on the loading of other resources or whether the current loading order causes delayed loading of other key resources, and then outputs multiple resource optimization loading strategies to improve page performance.
[0078] S103: Input multiple resource optimization loading strategies and information of resources to be loaded into a resource combination model, and obtain a resource optimization loading strategy combination output by the resource combination model.
[0079] The resource combination model is trained in advance according to the sample resource optimization loading strategy combination and the corresponding second sample loading duration.
[0080] Optionally, the resource optimization loading strategy combination includes at least one of a static resource compression strategy, a cache strategy, a code adjustment strategy, and a resource loading sequence strategy.
[0081] It should be noted that the static resource compression strategy is to reduce the resource size by compressing static resources, such as scripts, cascading style sheets, images and other resources, significantly shorten the page loading time and improve the user experience; the cache strategy is to automatically generate and deploy cache configuration files, such as service worker scripts, to optimize resource cache, so that users can load pages faster on subsequent visits and reduce network request time; the code adjustment strategy is to remove redundant code to reduce the parsing and rendering time of web pages, for example, removing unused cascading style sheets or reducing the number of queries of the document object model.
[0082] It can be understood that after multiple resource optimization loading strategies and information about resources to be loaded are input into the trained resource combination model, the resource combination model will analyze the relationship between the multiple optimization loading strategies and the resource information to be loaded, and generate an optimal resource optimization loading strategy combination, i.e., a resource optimization loading strategy combination, including at least one of a static resource compression strategy, a cache strategy, a code adjustment strategy, and a resource loading sequence strategy, to effectively reduce page loading time and improve user experience.
[0083] S104: Apply a resource optimization loading strategy combination to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
[0084] Optionally, after the resource combination model outputs the resource optimization loading strategy combination, these resource optimization loading strategy combinations can also be fed back to the developer for further optimization, and the resource optimization loading strategy combinations can be further tested and adjusted to maximize the target page performance optimization effect.
[0085] It should be noted that before applying the resource optimization loading strategy combination in the target page, in order to prevent possible negative impacts and ensure the normal operation of the page function, an original code backup of the current page will be automatically created, and automatic testing will be performed after the resource optimization loading strategy combination is generated to ensure that the page function is not affected.
[0086] It is understandable that the combination of resource optimization loading strategies obtained in this way and applied in the target page can effectively improve the loading time of resources, enable users to see content faster, and improve the overall browsing experience.
[0087] The embodiment of the present application provides a method for optimizing page performance. First, by using a duration prediction model, the resource loading time (i.e., the first predicted duration) is predicted according to the information of the resources to be loaded and the initial loading strategy; then, the large model will perform performance bottleneck analysis based on the predicted loading time, the information of the resources to be loaded, and the initial loading strategy, and identify key factors that may affect the front-end performance, such as insufficient network bandwidth, resource dependency conflicts, or loading order problems under specific conditions. According to the analysis results, the large model will output a variety of resource optimization loading strategies to improve the overall front-end performance; then, these optimization strategies are comprehensively evaluated using a resource combination model. The model considers multiple factors, including the advantages of each strategy, potential interactions, and performance under different conditions, to determine the strategy combination that best suits the current page and user environment. This process not only reduces unnecessary resource optimization loading strategies, but also reduces potential performance problems; finally, the optimized resource loading strategy combination is applied to the target page to achieve an optimization effect that improves page performance and improves the user experience.
[0088] It should be noted that after inputting multiple resource optimization loading strategies into the resource combination model and obtaining the resource optimization loading strategy combination output by the resource combination model, it is also necessary to use the prediction model to obtain the predicted duration of the resource optimization loading strategy combination, so as to compare it with the actual duration to monitor the page performance in real time. The specific process is as follows:
[0089] The resource optimization loading strategy combination and the information of resources to be loaded are input into the duration prediction model to obtain a second predicted duration output by the duration prediction model.
[0090] Among them, the second predicted duration is the time required for the page to load the resource information to be loaded, which is predicted by the duration prediction model after the resource optimization loading strategy combination selected by the application is applied.
[0091] It can be understood that the resource optimization loading strategy combination and the information of the resources to be loaded are input into the duration prediction model to obtain the second predicted duration output by the duration prediction model, and the actual loading duration is subsequently obtained to provide a basis for determining the accuracy of the duration prediction model.
[0092] Furthermore, after obtaining the second predicted duration, it is also necessary to obtain the actual duration after the resource optimization loading strategy combination. The specific process is as follows:
[0093] The actual loading time of the target page is obtained; if the difference between the loading time and the second predicted time exceeds the preset time, the time prediction model is retrained.
[0094] It is understandable that by obtaining the actual loading time of the resource optimization loading strategy combination in the target page and comparing it with the second predicted time, the accuracy of the current time prediction model can be judged. If the difference between the loading time and the second predicted time exceeds the preset time, it indicates that the accuracy of the current time prediction model is low, or a new performance bottleneck has appeared in the current target page, so the time prediction model needs to be retrained using a new data set. Through this continuous feedback and training, the time prediction model can adapt to new page performance changes, improve its prediction accuracy, and further ensure the effectiveness and adaptability of the optimization strategy.
[0095] For example, if the second predicted duration output by the duration prediction model is 2 seconds and the preset duration is 1 second, but the actual loading time of the target page obtained is 2.5 seconds, that is, the difference between the loading time and the second predicted duration is 0.5 seconds, which is less than the preset duration of 1 second, then it indicates that the current duration prediction model has a high accuracy and can continue to be used; correspondingly, if the actual loading time of the target page is 4 seconds, that is, the difference between the loading time and the second predicted duration is 2 seconds, which is greater than the preset duration of 1 second, then it indicates that the current duration prediction model has a low accuracy and the duration prediction model needs to be retrained to improve the prediction accuracy.
[0096] Figure 2 The process of the page performance optimization method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, this embodiment is Figure 1 Based on the embodiment, the process of determining the duration prediction model is described in detail, which specifically includes the following steps:
[0097] S201. Obtain multiple sample resource information and the sample initial loading strategy and first sample loading duration corresponding to each sample resource information.
[0098] Optionally, the sample initial loading strategy can be obtained through an automated tool or script integrated in a web page. Specifically, the script can be directly added to the header or middle part of a Hypertext Markup Language (HTML) file; the script can also be integrated into a framework such as React, Vue, Angular, etc., and the script can be loaded and executed through the component lifecycle method; or a specific browser extension can be installed for the target web page to be monitored, etc., which is not specifically shown in this embodiment.
[0099] It should be noted that after obtaining the sample initial loading strategy, it is also necessary to extract and clean the sample initial loading strategy, and retain the key features that have an important impact on page performance prediction and optimization through analysis and filtering. The feature extraction method can be a random forest model or a decision tree model, and the embodiment of the present application does not make specific restrictions here.
[0100] Optionally, the extracted features may be standardized (eg, normalized) to ensure the stability and effectiveness of the market prediction model during the training process.
[0101] It can be understood that by obtaining multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each sample resource information, a solid data foundation can be provided for the subsequent training of the duration prediction model.
[0102] S202: Create a training set and a validation set according to multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each resource sample information.
[0103] It can be understood that multiple sample resource information and the sample initial loading strategy corresponding to each resource sample information are taken as input, the first sample loading time is used as the sample label, and the sample data is divided into a training set and a validation set according to a preset ratio (such as 70% for the training set and 30% for the validation set).
[0104] S203: training a plurality of first initial models of different types based on the training set to obtain a plurality of initial duration prediction models.
[0105] Among them, the multiple different types of initial models include at least two of a linear regression model, a random forest model, a gradient boosting tree model, and a neural network model.
[0106] It can be understood that by training a plurality of first initial models of different types based on the training set, better horizontal comparison can be performed to further improve the accuracy of duration prediction.
[0107] S204: Determine the accuracy of each initial duration prediction model using the validation set, and determine the initial duration prediction model with the highest accuracy as the duration prediction model.
[0108] It can be understood that the prediction accuracy of each initial duration prediction model is verified and compared using the validation set, and the initial duration prediction model with the highest accuracy is selected as the duration prediction model to improve the reliability of the prediction.
[0109] In one feasible approach, in addition to determining the duration prediction model, the resource combination model also needs to be pre-trained so that the resource combination model can output a better optimized resource strategy. The specific process is as follows:
[0110] First, for each sample resource information, the sample resource information and the corresponding sample initial loading strategy and the first sample loading duration are input into the large model to obtain multiple sample resource optimization loading strategies output by the large model; then, the multiple sample resource optimization loading strategies are combined to generate multiple groups of sample resource optimization loading strategy combinations; then, the multiple groups of sample resource optimization loading strategy combinations are executed to load the sample resources corresponding to the sample resource information to obtain the second sample duration corresponding to each group of sample resource optimization loading strategy combinations; finally, according to each sample resource information, each group of sample resource optimization loading strategy combinations and the corresponding second sample duration, the second initial model is trained to obtain a resource combination model.
[0111] Among them, the second initial model can be a reinforcement learning model or an adversarial network model, and the embodiment of the present application does not make any specific restrictions here.
[0112] Optionally, in some special scenarios, you can also use A / B testing to verify the effect of different resource optimization strategies on page performance, and finally obtain a combination of resource optimization loading strategies. The following will be explained in detail through specific examples:
[0113] First, define the test goal: for example, the goal is to reduce page loading time; then, create a test group: based on the generated multiple resource optimization loading strategies, design an A / B test plan (Group A (control group): apply the original loading strategy. Group B (experimental group): use different combinations of multiple resource optimization loading strategies generated by the large model); then, randomly assign users: randomly assign users to the control group or the experimental group. Usually the test will distribute traffic equally to each group, for example, 50% of users use the control group and 50% of users use the experimental group; finally, monitor and collect performance indicators of the two solutions, such as page loading time. Compare the two sets of data and determine which strategy is more effective through statistical analysis. If the experimental group's solution performs better in reducing page loading time, it can be determined that the optimization strategy of Group B is effective.
[0114] It can be understood that, first, the sample resource information and the corresponding sample initial loading strategy and the first sample loading time are input into the large model. The large model identifies potential reasons for prolonged loading time, evaluates key factors affecting performance, and outputs multiple sample resource optimization loading strategies to improve page performance; then, based on multiple sample resource optimization loading strategies, multiple sample resource optimization loading strategies are randomly combined to generate multiple groups of sample resource optimization loading strategy combinations to explore the impact of different strategy combinations on resource loading performance; then, for each group of sample resource optimization loading strategy combinations, the loading operation is performed, and the actual loading time, i.e., the second sample time, is recorded to provide a data basis for subsequent training of the second initial model; finally, each sample resource information, each group of sample resource optimization loading strategy combinations, and the corresponding second sample time are input into the second initial model for training. The second initial model captures the relationship between the loading strategy combination and the loading time and the interaction of multiple optimization methods to ultimately obtain a resource combination model with better training effect. In this way, different strategies are combined to enable the model to adapt to various loading conditions and resource types. The model is then verified and adjusted through actual loading time data, which improves the accuracy of the resource combination model to generate optimization strategies, further reduces page loading time, and improves user experience.
[0115] Figure 3 This is a schematic diagram of the structure of the page performance optimization device provided in the embodiment of the present application. Figure 3 As shown, the page energy optimization device 30 includes: a first acquisition module 301, a second acquisition module 302, a third acquisition module 303 and an application module 304.
[0116] The first acquisition module 301 is used to input the resource information to be loaded and the initial loading strategy into the duration prediction model, and obtain the first predicted duration output by the duration prediction model, where the duration prediction model is trained in advance according to the sample resource information, the sample initial loading strategy and the first sample loading duration;
[0117] The second acquisition module 302 is used to input the first predicted duration, the information of the resources to be loaded, and the initial loading strategy into the big model, and obtain multiple resource optimization loading strategies output by the big model;
[0118] The third acquisition module 303 is used to input multiple resource optimization loading strategies and information of resources to be loaded into the resource combination model, and obtain the resource optimization loading strategy combination output by the resource combination model, where the resource combination model is pre-trained according to the sample resource optimization loading strategy combination and the corresponding second sample loading duration;
[0119] The application module 304 is used to apply the resource optimization loading strategy combination to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
[0120] Optionally, the resource information to be loaded includes resource quantity, resource name and resource type.
[0121] Optionally, the resource optimization loading strategy combination includes at least one of the following: static resource compression strategy, cache strategy, code adjustment strategy, and resource loading order strategy.
[0122] Optionally, the third acquisition module 303, after inputting multiple resource optimization loading strategies into the resource combination model and acquiring the resource optimization loading strategy combination output by the resource combination model, is further used to:
[0123] Inputting the resource optimization loading strategy combination and the information of the resources to be loaded into the duration prediction model, and obtaining the second predicted duration output by the duration prediction model;
[0124] Correspondingly, the third acquisition module 303, after applying the resource optimization loading strategy combination to load the to-be-loaded resource corresponding to the to-be-loaded resource information in the target page, is further used to:
[0125] Get the actual loading time of the target page;
[0126] If the difference between the loading duration and the second predicted duration exceeds the preset duration, the duration prediction model is retrained.
[0127] Optionally, the page performance optimization device further includes a processing module 305, which is used for: before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model:
[0128] Obtaining multiple sample resource information and the sample initial loading strategy and first sample loading duration corresponding to each resource sample information;
[0129] Creating a training set and a validation set according to the multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each resource sample information;
[0130] Based on the training set, multiple different types of first initial models are trained respectively to obtain multiple initial duration prediction models, where the multiple different types of initial models include at least two of a linear regression model, a random forest model, a gradient boosting tree model, and a neural network model;
[0131] The validation set is used to determine the accuracy of each initial duration prediction model, and the initial duration prediction model with the highest accuracy is determined as the duration prediction model.
[0132] Optionally, the processing module 305, before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, is further configured to:
[0133] For each sample resource information, the sample resource information and the corresponding sample initial loading strategy and the first sample loading duration are input into the large model to obtain multiple sample resource optimization loading strategies output by the large model;
[0134] Combining multiple sample resource optimization loading strategies to generate multiple groups of sample resource optimization loading strategy combinations;
[0135] Execute multiple groups of sample resource optimization loading strategy combinations to load sample resources corresponding to the sample resource information, and obtain the second sample duration corresponding to each group of sample resource optimization loading strategy combinations;
[0136] The second initial model is trained according to each sample resource information, each group of sample resource optimization loading strategy combination and the corresponding second sample duration to obtain a resource combination model.
[0137] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 40 provided in the embodiment of the present application includes: at least one processor 401 and a memory 402. The electronic device 40 also includes a communication component 403. The processor 401, the memory 402 and the communication component 403 are connected via a bus 404.
[0138] In a specific implementation process, at least one processor 401 executes the computer execution instructions stored in the memory 402, so that at least one processor 401 executes the above-mentioned page performance optimization method.
[0139] The specific implementation process of the processor 401 can be found in the above-mentioned method embodiment, and its implementation principle and technical effect are similar, so the embodiments of the present application will not be repeated here.
[0140] The electronic device provided in the embodiment of the present application is used to execute the page performance optimization method provided in any of the above method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0141] In the above Figure 4 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0142] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0143] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0144] The present application also provides a computer program product, including a computer program, which implements the above-mentioned page performance optimization method when executed by a processor.
[0145] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above-mentioned page performance optimization method is implemented.
[0146] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0147] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0148] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0149] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0150] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0151] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0152] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0153] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0154] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0155] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0156] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0157] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application can essentially or in other words contribute to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0158] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0159] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0160] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A page performance optimization method, characterized in that: Inputting the resource information to be loaded and the initial loading strategy into a duration prediction model, and obtaining a first predicted duration output by the duration prediction model, wherein the duration prediction model is pre-trained based on the sample resource information, the sample initial loading strategy, and the first sample loading duration; Inputting the first predicted duration, the information of the resources to be loaded, and the initial loading strategy into a large model, and obtaining a plurality of resource optimization loading strategies output by the large model; Input the multiple resource optimization loading strategies and the information of the resources to be loaded into a resource combination model, and obtain a resource optimization loading strategy combination output by the resource combination model, wherein the resource combination model is pre-trained according to a sample resource optimization loading strategy combination and a corresponding second sample loading duration; The resource optimization loading strategy combination is applied to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
2. The method according to claim 1, characterized in that The resource information to be loaded includes resource quantity, resource name and resource type.
3. The method according to claim 1 or 2, characterized in that: The resource optimization loading strategy combination includes at least one of the following: Static resource compression strategy, caching strategy, code adjustment strategy, and resource loading order strategy.
4. The method according to claim 1 or 2, characterized in that: After inputting the plurality of resource optimization loading strategies into the resource combination model and obtaining the resource optimization loading strategy combination output by the resource combination model, the method further includes: Inputting the resource optimization loading strategy combination and the to-be-loaded resource information into the duration prediction model, and obtaining a second predicted duration output by the duration prediction model; Correspondingly, after the resource optimization loading strategy combination is applied to load the resource to be loaded corresponding to the resource information to be loaded in the target page, the method further includes: Obtaining the actual loading time of the target page; If the difference between the loading duration and the second predicted duration exceeds a preset duration, the duration prediction model is retrained.
5. The method according to claim 1 or 2, characterized in that: Before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, the method includes: Obtaining multiple sample resource information and the sample initial loading strategy and first sample loading duration corresponding to each resource sample information; Creating a training set and a validation set according to the multiple sample resource information and the sample initial loading strategy and the first sample loading duration corresponding to each resource sample information; Based on the training set, a plurality of different types of first initial models are trained respectively to obtain a plurality of initial duration prediction models, wherein the plurality of different types of initial models include at least two of a linear regression model, a random forest model, a gradient boosting tree model, and a neural network model; The accuracy of each initial duration prediction model is determined using the validation set, and the initial duration prediction model with the highest accuracy is determined as the duration prediction model.
6. The method according to claim 5, characterized in that Before inputting the to-be-loaded resource information and the initial loading strategy into the duration prediction model and obtaining the first predicted duration output by the duration prediction model, the method includes: For each sample resource information, the sample resource information and the corresponding sample initial loading strategy and the first sample loading duration are input into the large model to obtain multiple sample resource optimization loading strategies output by the large model; Combining multiple sample resource optimization loading strategies to generate multiple groups of sample resource optimization loading strategy combinations; Execute the plurality of groups of sample resource optimization loading strategy combinations to load the sample resources corresponding to the sample resource information, and obtain the second sample duration corresponding to each group of sample resource optimization loading strategy combinations; The second initial model is trained according to each sample resource information, each group of sample resource optimization loading strategy combination and the corresponding second sample duration to obtain the resource combination model.
7. A page performance optimization device, characterized in that: include: A first acquisition module, used to input the resource information to be loaded and the initial loading strategy into a duration prediction model, and obtain a first predicted duration output by the duration prediction model, wherein the duration prediction model is pre-trained based on the sample resource information, the sample initial loading strategy, and the first sample loading duration; A second acquisition module is used to input the first predicted duration, the information of the resources to be loaded, and the initial loading strategy into a large model, and obtain multiple resource optimization loading strategies output by the large model; A third acquisition module is used to input the multiple resource optimization loading strategies and the information of the resources to be loaded into a resource combination model, and obtain the resource optimization loading strategy combination output by the resource combination model, wherein the resource combination model is pre-trained according to the sample resource optimization loading strategy combination and the corresponding second sample loading duration; The application module is used to apply the resource optimization loading strategy combination to load the to-be-loaded resources corresponding to the to-be-loaded resource information in the target page, so as to optimize the target page.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the page performance optimization method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the page performance optimization method according to any one of claims 1 to 6.
10. A computer program product, characterized in that It includes a computer program, characterized in that when the computer program is executed by a processor, it is used to implement the page performance optimization method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Front-end webpage performance automatic optimization method, device and equipment and readable storage medium
CN117556160A
Method of suggestion of content retrieved from a set of information sources
US20170139939A1
