File loading method and apparatus

By monitoring the user's historical browsing behavior and combining reinforcement learning algorithms, the optimal JavaScript loading sequence is generated, which solves the problems of slow resource loading, blocked rendering and resource conflict during page loading, achieving faster page loading and better user experience.

WO2025119342A1PCT designated stage expired Publication Date: 2025-06-12CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
PCT/CN2024/137492
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-06
Filing Date
2024-12-06
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

The prior art has problems such as slow resource loading, blocking rendering and resource conflicts during page loading, which affects the user experience.

Method used

By monitoring user historical browsing behavior, combining reinforcement learning algorithms, predict user needs, and generate the optimal JavaScript loading sequence to achieve a combination of resource preloading and on-demand loading.

Benefits of technology

Reduces page loading time, avoids blocking rendering, avoids resource conflicts between different scripts, ensures that the page runs normally, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024137492_12062025_PF_FP_ABST
    Figure CN2024137492_12062025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of file loading, and relates to a file loading method and apparatus, and an electronic device and a storage medium. The method comprises: monitoring historical browsing behaviors of a user; setting different reporting modes and different reporting occasions; acquiring a historical browsing trajectory of the user by means of monitoring the historical browsing behaviors of the user, cleaning and analyzing event-tracking data, classifying the historical browsing behaviors of the user, and determining actual requirements of the user by means of statistics; mapping the actual requirements of the user to a state space and a behavior space in reinforcement learning, predicting a user behavior, and outputting requirement weights of the user in respect of different resources; and generating an initialized resource loading sequence on the basis of the historical browsing trajectory of the user, combining the predicted user behavior with weights under different user behaviors, and performing multiple rounds of iterations by means of a user behavior prediction module, so as to obtain a resource loading order sequence. By means of the method, apparatus, electronic device and storage medium of the present invention, file loading time is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

File loading method and device

[0001] This application claims priority to Chinese patent application number CN202311666484.9, filed on December 6, 2023, entitled “A file loading method and device,” the entire text of which is hereby incorporated by reference. Technical Field

[0002] The present invention belongs to the technical field of file loading, and in particular relates to a file loading method, device, electronic device and storage medium. Background Art

[0003] Due to the rapid development of current Internet technology, excessive HTTP (Hypertext Transfer Protocol) requests, long-term occupation of JavaScript threads, and congestion during resource loading have caused slow page loading, affecting user experience. Currently, there are many front-end performance optimization solutions, such as resource compression and merging, network connection and resource loading optimization, etc. In the process of loading front-end pages, most inventions focus on the design of data identifiers to quickly find caches and resource modules, but there are few related inventions for JavaScript resource loading through recording and prediction of user behavior and actual needs, which is the motivation for the invention of this invention.

[0004] The related inventions of existing page loading optimization are generally divided into resource data identification design, cache query operation, and DOM (Document Object Model) tree construction method, which improves the page loading speed and thus enhances the user experience. Patent CN112181532A designs a page resource loading solution, obtains the preloading parameters of the page resource according to the page resource loading request, and obtains the resource file according to whether the preloading parameters meet the preloading conditions, including obtaining from the local and loading the page resources corresponding to the preloading parameters from the resource file. Patent CN111666497A mainly designs the access instructions of the page, and searches for related files in the pre-stored resource database based on the access instructions. The above patents focus on the design of the resource side and the rendering side, and focus on how to efficiently obtain resources to optimize user needs and experience.

[0005] Patent CN110377361A designs different data representations and displays corresponding data based on the data representation, thereby saving memory space and improving the user experience. Patent CN116225567A collects user behavior to predict the results of preloading pages and uses a multi-layer perceptron for prediction. However, the multi-layer perceptron may suffer from overfitting and difficulty in parameter debugging as the number of layers increases. The above patents mainly conduct invention research on preloading resource selection, but give less consideration to user behavior and needs.

[0006] In the existing page rendering context, related inventions involving user behavior are generally divided into strategies such as embedded point design, real visual interface scrolling detection, and recording of user operation trajectories. Most of these inventions focus on recording user operation behaviors, and less on predicting user behaviors. Therefore, the present invention proposes a hybrid loading method for JavaScript files based on user behavior, which combines resource preloading and on-demand loading methods through modules such as user historical behavior perception, user actual demand acquisition, user behavior prediction, and resource loading sequence decision-making to obtain the final resource loading sequence. During the page loading process, a portion of JavaScript files are preloaded according to the resource loading sequence, and other files are loaded on demand to achieve more accurate resource loading control and optimization. Summary of the Invention

[0007] In view of the above shortcomings of the existing technology, the purpose of the invention is to provide a cloud desktop repeated keystroke processing method, device, electronic device and storage medium, combining the user's historical behavior trajectory with reinforcement learning to make reasonable resource loading predictions, thereby obtaining the optimal JavaScript loading sequence. This method can reduce the page loading time while avoiding blocking rendering, thereby avoiding resource conflicts between different scripts, ensuring the normal operation of the page, and improving the user experience.

[0008] A first aspect of the present invention provides a file loading method, comprising:

[0009] Use code tracking to monitor user browsing history, including page jumps, clicks, scrolling, searches, and dwell time.

[0010] Set different reporting methods and timings for different user historical browsing behaviors;

[0011] By monitoring the user's historical browsing behavior to obtain the user's historical browsing trajectory, the buried data is cleaned and analyzed, and the user's historical browsing behavior is classified, and the actual user needs are confirmed through statistics;

[0012] Mapping the actual user needs into the state space and behavior space in reinforcement learning, predicting user behavior, and outputting the user's demand weights for different resources;

[0013] An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times through the user behavior prediction module to obtain the resource loading sequence.

[0014] Furthermore, in the above-mentioned file loading method, a code tracking method is used to monitor the user's historical browsing behavior, including:

[0015] Manually add tracking code at key behavior nodes;

[0016] For user click, scroll, and search behaviors, use JavaScript event listeners and callback functions to introduce tracking scripts.

[0017] For the stay time, user_id and user_name are used to represent the user ID and user name respectively, page_path and page_title are used to represent the path and page title of the current page, and event_type, act_tag, begin_time, and end_time are used to represent the current event type, resource tag, start time, and end time.

[0018] Furthermore, in the above-mentioned file loading method, different reporting methods and reporting timings are set for different user historical browsing behaviors, including:

[0019] Page jump behavior is reported synchronously using the WebSocket reporting mechanism. The front-end and back-end establish a persistent connection, and the front-end transmits the relevant data of the user page jump to the server.

[0020] Click behavior and search behavior are reported asynchronously using the Batch mechanism. The Batch mechanism caches the user tracks collected by the front-end using a data queue and reports when the data volume reaches the data_threshold threshold.

[0021] Scrolling and dwelling behaviors, corresponding to resources reaching the preset virtual viewport of the page, and users staying on a resource for longer than the preset time, are reported using the Beacon API to report performance data;

[0022] For the reported content, a unified field identifier and table structure are used.

[0023] Furthermore, in the above-mentioned file loading method, the embedded data is cleaned and analyzed, and the user's historical browsing behavior is classified, and the actual user needs are confirmed through statistics, including:

[0024] Clean the collected data of users' historical browsing behavior;

[0025] Classify the cleaned data according to the preset resource type;

[0026] For all resources, sort them from smallest to largest by begin_time to represent the user's behavior trajectory at the time level. After classification, sort the resources by stay time to determine the user's interest preference for the same resource.

[0027] The cleaning of collected user historical browsing behavior data includes deleting duplicate records and searching for outliers. The rules for deleting duplicate records are as follows:

[0028] During scrolling, delete the user behavior data related to page rendering on the first screen;

[0029] If there is scrolling behavior and stay behavior data for the same resource, only the stay user behavior data is retained;

[0030] If there are click behavior and stay behavior data for the same resource, only the click behavior data will be retained;

[0031] If there are search behavior and stay behavior data for the same resource, only the search behavior data will be retained;

[0032] The operation of searching for outliers determines whether the residence time is greater than a preset threshold.

[0033] Furthermore, in the above-mentioned file loading method, the actual user needs are mapped into the state space and behavior space in reinforcement learning, and the user behavior is predicted to output the weights of different user behaviors, including:

[0034] Mapping actual user needs into a reinforcement learning state space, where the state space is characterized by uniform resource tags. Resource tags include at least scripts, style sheets, JSON, XML, images, and audio and video files. The number of resources depends on the environment and resources of the current user browsing the page.

[0035] The behavior space is defined as the user browsing behavior in the actual needs of the user, and the user browsing behavior is expressed as A = {a1, a2, ..., a n}, where A represents the browsing resource collection of the current user, a n Indicates the nth resource browsed by the user;

[0036] Predict user behavior based on behavior space and state space, and output the weights of different user behaviors.

[0037] Furthermore, in the above-mentioned file loading method, an initial resource loading sequence is generated based on the user's historical browsing trajectory, the predicted user behavior is combined with the weights of different user behaviors, and the initial resource loading sequence is iterated multiple times by the user behavior prediction module to obtain a resource loading sequence, including:

[0038] The reward function is defined as: Among them, R represents the reward generated under the current resource loading sequence, Indicates the time when the user browses to resource i, Indicates the time when the front-end page finishes loading resource i. represents the difference between the user browsing and rendering time of resource i, and the reward function is the sum of the time differences of all resources;

[0039] The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times through the user behavior prediction module. The reward function is used to test the user experience of the resource loading sequence, and finally the optimal resource loading decision sequence is output.

[0040] Furthermore, in the above-mentioned file loading method, the preset resource types include:

[0041] act_tag1: JavaScript script file;

[0042] act_tag2: css style sheet file;

[0043] act_tag3: JSON file;

[0044] act_tag4: XML file;

[0045] act_tag5: image file. The file types of image files include at least: jpg, png, and gif;

[0046] act_tag6: audio file. The file types of audio files include at least: mp3, opp;

[0047] act_tag7: video file. The file types of video files include at least: mp4 and webm;

[0048] act_tag8: other files. The file types of other files include at least: PDF files, SVG vector files, data files, and compressed files.

[0049] A second aspect of the present invention provides a file loading device, comprising:

[0050] Monitoring module: used to monitor user browsing history by using code tracking, including page jumps, clicks, scrolling, searches, and dwell time.

[0051] Setting module: used to set different reporting methods and reporting timings for different user historical browsing behaviors;

[0052] Statistics module: used to obtain user browsing history by monitoring user browsing behavior, clean and analyze buried data, classify user browsing history, and confirm user actual needs through statistics;

[0053] Prediction module and output module: used to map the actual user demand into the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources;

[0054] Acquisition module: used to generate an initial resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.

[0055] A third aspect of the present invention further provides an electronic device, comprising: a processor and a memory;

[0056] The processor is configured to execute any one of the file loading methods described above by calling the program or instruction stored in the memory.

[0057] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute any one of the file loading methods described above.

[0058] The beneficial effects of the present invention are as follows: the present invention monitors user historical browsing behavior by adopting code burying method, and the user historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time; different reporting methods and reporting timings are set for different user historical browsing behaviors; the user historical browsing trajectory is obtained by monitoring the user historical browsing behavior, the buried data is cleaned and analyzed, and the user historical browsing behavior is classified, and the actual needs of the user are confirmed by statistics; the actual needs of the user are mapped to the state space and behavior space in reinforcement learning, the user behavior is predicted, and the user's demand weight for different resources is output; according to the user's historical browsing trajectory, an initialization resource loading sequence is generated, the predicted user behavior is combined with the weight of the user's different behaviors, and the initialization resource loading sequence is iterated for multiple rounds through the user behavior prediction module to obtain a resource loading order sequence. The present invention combines the user's historical behavior trajectory with reinforcement learning to perform reasonable resource loading prediction, thereby obtaining the optimal JavaScript loading sequence. This method can reduce the time of page loading while avoiding blocking rendering, thereby avoiding resource conflicts of different scripts, ensuring the normal operation of the page, and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The accompanying drawings are only for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. Throughout the drawings, the same reference numerals represent the same components. Obviously, the drawings described below are only some of the embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings.

[0060] FIG1 is a diagram of a file loading method according to an embodiment of the present invention;

[0061] FIG2 is a schematic diagram of monitoring a user's historical browsing behavior according to an embodiment of the present invention;

[0062] FIG3 is a second diagram of a file loading method provided by an embodiment of the present invention;

[0063] FIG4 is a diagram of a file loading device provided by an embodiment of the present invention;

[0064] FIG5 is a schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0065] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the scope of protection of the present invention.

[0066] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0067] In the description of this invention, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The terms "mounted," "connected," and "connected" should be interpreted broadly, meaning, for example, fixed, removable, or integral; mechanical or electrical; direct or indirect through an intermediary; and internal communication between two components. Those skilled in the art will understand the specific meanings of these terms in this invention on a case-by-case basis.

[0068] Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, like numbers in different figures represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with certain aspects of the present invention, as detailed in the appended claims.

[0069] The present invention proposes a file loading method, device, electronic device and storage medium, which combine user historical behavior trajectories with reinforcement learning to perform reasonable resource loading predictions, thereby obtaining an optimal JavaScript loading sequence. This method can reduce page loading time while avoiding blocking rendering, thereby avoiding resource conflicts between different scripts, ensuring normal page operation, and improving user experience.

[0070] Method Example

[0071] Before introducing the present invention, the professional terms involved in the present invention are first introduced.

[0072] JavaScript (JS): A lightweight, function-first, interpreted or just-in-time compiled programming language. Based on prototype programming, JavaScript is a multi-paradigm dynamic scripting language that supports object-oriented, imperative, declarative, and functional programming paradigms. Its main functions include embedding dynamic text in HTML (Hypertext Markup Language) pages, responding to browser events, and reading and writing HTML elements. As an advanced scripting language for the web, JavaScript is widely used in front-end application development.

[0073] Reinforcement Learning (RL): As a branch of machine learning, RL is used to describe and solve the problem of maximizing rewards or achieving specific goals by learning strategies during the interaction between an intelligent agent and the environment.

[0074] Preloading: As a performance optimization technology, resource preloading requests and loads all required resources locally in advance. During the web page loading process, such resources are directly obtained from the cache, providing users with a better experience and reducing waiting time during page loading.

[0075] On-demand loading: As part of performance optimization, on-demand loading loads the corresponding code based on the user's current needs. A browser can only make a limited number of requests at a time. Loading the code for all functions at once can cause the homepage to remain blank for extended periods when entering a single-page system. In JavaScript, loading actions are often triggered by user actions or scheduled tasks to optimize the user experience.

[0076] FIG1 is a diagram of a file loading method provided by an embodiment of the present invention.

[0077] FIG2 is a schematic diagram of monitoring a user's historical browsing behavior according to an embodiment of the present invention.

[0078] In a first aspect of the present invention, a file loading method is proposed, which includes five steps S1 to S5, as shown in FIG1 and FIG2 :

[0079] S1: Use code tracking to monitor user browsing history, including page jumps, clicks, scrolling, searches, and dwell time.

[0080] Specifically, in the embodiments of the present invention, a code tracking method is used on the front end to monitor the user's historical browsing behavior. It should be understood that page jump behavior is the starting point for the user to browse the current page, click and search behavior indicate that the user has a strong interest in a certain resource, and scrolling behavior can be monitored by monitoring the user's scrolling operations on the page to understand the user's reading and browsing behavior. The dwell time can be used to measure user interest.

[0081] S2: Set different reporting methods and reporting times for different users' historical browsing behaviors.

[0082] Specifically, in an embodiment of the present invention, different reporting methods and reporting timings are set for page jump behavior, click behavior, scrolling behavior, search behavior and dwell time. For example, page jump behavior is reported synchronously using the WebSocket reporting mechanism, and the front and back ends establish a long connection, and the front end transmits relevant data of the user's page jump to the server.

[0083] S3: Obtain the user's historical browsing trajectory by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics.

[0084] Specifically, in an embodiment of the present invention, a method for cleaning, analyzing, and classifying user behaviors of buried data and confirming actual user needs through statistics is described in detail below.

[0085] S4: Map the user's actual needs into the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources.

[0086] Specifically, in an embodiment of the present invention, a method for mapping actual user needs into a state space and behavior space in reinforcement learning, predicting user behavior, and outputting user demand weights for different resources is described in detail below.

[0087] S5: Generate an initial resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading sequence.

[0088] Specifically, in an embodiment of the present invention, an initialization resource loading sequence is generated based on the user's historical browsing trajectory, the predicted user behavior is combined with the weights of different user behaviors, and the initialization resource loading sequence is iterated multiple times through the user behavior prediction module. The method for obtaining the resource loading sequence is described in detail below.

[0089] Furthermore, in the above-mentioned file loading method, a code tracking method is used to monitor the user's historical browsing behavior, including:

[0090] Manually add tracking code at key behavior nodes;

[0091] For user click, scroll, and search behaviors, use JavaScript event listeners and callback functions to introduce tracking scripts.

[0092] For the stay time, user_id and user_name are used to represent the user ID and user name respectively, page_path and page_title are used to represent the path and page title of the current page, and event_type, act_tag, begin_time, and end_time are used to represent the current event type, resource tag, start time, and end time.

[0093] Specifically, in the embodiment of the present invention, a code embedding method is used to monitor the user's historical browsing behavior, and the method of adding embedding codes is different for different behaviors.

[0094] Furthermore, in the above-mentioned file loading method, different reporting methods and reporting timings are set for different user historical browsing behaviors, including:

[0095] Page jump behavior is reported synchronously using the WebSocket reporting mechanism. The front-end and back-end establish a persistent connection, and the front-end transmits the relevant data of the user page jump to the server.

[0096] Click and search behaviors are reported asynchronously using the Batch mechanism. The Batch mechanism caches user trajectories collected by the front-end using a data queue and reports when the data volume reaches the data_threshold threshold.

[0097] Scrolling and dwelling behaviors, corresponding to resources reaching the preset virtual viewport of the page, and users staying on a resource for longer than the preset time, are reported using the Beacon API to report performance data;

[0098] For the reported content, a unified field identifier and table structure are used.

[0099] Specifically, in an embodiment of the present invention, data is reported when the data volume reaches the threshold value data_threshold. Since the user's interactive operations may be large, batch reporting is used to reduce the number of network requests. The Beacon API is used to report such key performance data. As a new feature of HTML5, it allows data to be sent to the server before the page is unloaded. Data can be sent even if the page has been closed, and it does not affect the loading speed of the page.

[0100] It should be understood that the present invention sets different reporting times and methods for tracking points, sets specific reporting methods for different user behaviors and JavaScript resource types, takes into account the front-end pressure in the front-end rendering process, can better decouple business operations from behavior collection, and uses HTML5 and other related technologies for reporting, avoiding unnecessary server processing and bandwidth consumption, saving resources and costs, not blocking the main thread or delaying the unloading of the page, and not affecting the user experience when browsing the page.

[0101] FIG3 is a second diagram of a file loading method provided by an embodiment of the present invention.

[0102] Furthermore, in the above-mentioned file loading method, the user browsing trajectory is obtained by collecting the user's historical browsing behavior, the buried data is cleaned and analyzed, and the user's historical browsing behavior is classified. The actual user needs are confirmed through statistics. In conjunction with Figure 3, the method includes three steps S31 to S33:

[0103] S31: Clean the collected data of user historical browsing behavior.

[0104] Specifically, in an embodiment of the present invention, a method for cleaning the collected buried data of the user's historical browsing behavior includes: deleting duplicate records and searching for abnormal values.

[0105] S32: Classify the cleaned data according to preset resource types.

[0106] Specifically, in the embodiment of the present invention, the preset resource types include the following eight types:

[0107] act_tag1: JavaScript script file;

[0108] act_tag2: css style sheet file;

[0109] act_tag3: JSON file;

[0110] act_tag4: XML file;

[0111] act_tag5: image file. The file types of image files include at least: jpg, png, and gif;

[0112] act_tag6: audio file. The file types of audio files include at least: mp3, opp;

[0113] act_tag7: video file. The file types of video files include at least: mp4 and webm;

[0114] act_tag8: other files. The file types of other files include at least: PDF files, SVG vector files, data files, and compressed files.

[0115] S33: Sort all resources by begin_time from small to large to represent the user's behavior trajectory at the time level; sort the classified resources by stay time to determine the user's interest preference for the same resource.

[0116] Specifically, in an embodiment of the present invention, all resources are sorted from small to large according to begin_time, indicating the user's behavior trajectory at the time level; at the same time, the resources after data classification are sorted according to the residence time, so as to determine the user's interest preference under the same resource.

[0117] The cleaning of collected user historical browsing behavior data includes deleting duplicate records and searching for outliers. The rules for deleting duplicate records are as follows:

[0118] During scrolling, delete the user behavior data related to page rendering on the first screen;

[0119] If there is scrolling behavior and stay behavior data for the same resource, only the stay user behavior data is retained;

[0120] If there are click behavior and stay behavior data for the same resource, only the click behavior data will be retained;

[0121] If there are search behavior and stay behavior data for the same resource, only the search behavior data will be retained;

[0122] The operation of searching for outliers determines whether the residence time is greater than a preset threshold.

[0123] Specifically, in the embodiment of the present invention, for the operation of abnormal values, it is mainly determined whether the residence time is greater than 5 seconds, that is, end_time-begin_time>5. It should be understood that the size of the preset threshold is flexibly set according to actual conditions, and this does not limit the scope of protection of the present invention.

[0124] It should be understood that the present invention can effectively improve data quality, reduce misleading analysis, and more accurately obtain user behavior through methods such as data cleaning, classification, and sorting. The cleaned and classified data is more standardized and accurate, and the data is complete and reasonable, which can reduce subsequent data processing and save computing resources and time.

[0125] Furthermore, in the above-mentioned file loading method, the actual user needs are mapped into the state space and behavior space in reinforcement learning, and the user behavior is predicted to output the weights of different user behaviors, including:

[0126] Mapping actual user needs into a reinforcement learning state space, where the state space is characterized by uniform resource tags. Resource tags include at least scripts, style sheets, JSON, XML, images, and audio and video files. The number of resources depends on the environment and resources of the current user browsing the page.

[0127] The behavior space is defined as the user browsing behavior in the actual needs of the user, and the user browsing behavior is expressed as A = {a1, a2, ..., a n}, where A represents the browsing resource collection of the current user, a n Indicates the nth resource browsed by the user;

[0128] Predict user behavior based on behavior space and state space, and output the weights of different user behaviors.

[0129] Specifically, in the embodiment of the present invention, the state space is used to represent the set of characteristics or states of the user and the environment, and the user browsing behavior represents the browsing behavior actually required by the user. The user browsing behavior can be expressed as A = {a1, a2, ..., a n}, where A represents the browsing resource collection of the current user, a n Indicates the nth resource browsed by the user, predicts the user behavior based on the behavior space and state space, and outputs the weights of different user behaviors.

[0130] Furthermore, in the above-mentioned file loading method, an initial resource loading sequence is generated based on the user's historical browsing trajectory, the predicted user behavior is combined with the weights of different user behaviors, and the initial resource loading sequence is iterated multiple times by the user behavior prediction module to obtain a resource loading sequence, including:

[0131] The reward function is defined as: Among them, R represents the reward generated under the current resource loading sequence, Indicates the time when the user browses to resource i, Indicates the time when the front-end page finishes loading resource i. represents the difference between the user browsing and rendering time of resource i, and the reward function is the sum of the time differences of all resources;

[0132] The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times through the user behavior prediction module. The reward function is used to test the user experience of the resource loading sequence, and finally the optimal resource loading decision sequence is output.

[0133] It should be understood that this invention combines historical user behavior with reinforcement learning, employing a lightweight iterative approach and predictive algorithms to perform a weighted analysis of user behavior and derive a resource-related loading order. Lightweight reinforcement learning applied to user behavior offers the advantages of high computational efficiency, ease of implementation, and debugging, enabling developers to better apply algorithms to development. Furthermore, lightweight learning offers low response times and the ability to make real-time decisions based on the environment, which is particularly effective for time-sensitive applications.

[0134] In summary: the present invention can start from the aspects of user behavior collection, behavior data reporting, related data cleaning, and user trajectory prediction. It can effectively predict the loading of JavaScript related resources based on the user's historical behavior trajectory, and make reasonable resource loading order decisions based on different page resources and user behavior habits. It has a low response time, does not block the main thread loading, reduces unnecessary resource loss, and improves the user's browsing experience.

[0135] Device embodiment

[0136] FIG4 is a diagram of a file loading device provided by an embodiment of the present invention.

[0137] A second aspect of the present invention provides a file loading device, which includes:

[0138] Monitoring module 41: used to monitor the user's historical browsing behavior by using code tracking, the user's historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time;

[0139] Setting module 42: used to set different reporting methods and reporting times for different user historical browsing behaviors;

[0140] Statistics module 43: used to obtain the user's historical browsing trajectory by monitoring the user's historical browsing behavior, clean and analyze the buried data, classify the user's historical browsing behavior, and confirm the user's actual needs through statistics;

[0141] Prediction module 44 and output module 45: used to map the user's actual needs into the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources;

[0142] Acquisition module 46: used to generate an initialization resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initialization resource loading sequence multiple times through the user behavior prediction module to obtain a resource loading order sequence.

[0143] FIG5 is a schematic block diagram of an electronic device provided by an embodiment of the present invention.

[0144] As shown in Figure 5 , the electronic device includes at least one processor 501, at least one memory 502, and at least one communication interface 503. The various components within the electronic device are coupled together via a bus system 504. Communication interface 503 is used to transmit information with external devices. It will be understood that bus system 504 is used to facilitate communication between these components. In addition to a data bus, bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in Figure 5 , all of these buses are labeled as bus system 504.

[0145] It can be understood that the memory 502 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.

[0146] In some embodiments, the memory 502 stores the following elements, executable units or data structures, or a subset or an extended set thereof: an operating system and application programs.

[0147] The operating system includes various system programs, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and handle hardware-based tasks. The application program includes various application programs, such as media players and browsers, which are used to implement various application services. A program that implements any of the file loading methods provided in the embodiments of the present invention can be included in the application program.

[0148] In an embodiment of the present invention, the processor 501 calls a program or instruction stored in the memory 502, specifically, a program or instruction stored in an application, and the processor 501 is used to execute the steps of each embodiment of a file loading method provided in an embodiment of the present invention.

[0149] Use code tracking to monitor user browsing history, including page jumps, clicks, scrolling, searches, and dwell time.

[0150] Set different reporting methods and timings for different user historical browsing behaviors;

[0151] By monitoring the user's historical browsing behavior to obtain the user's historical browsing trajectory, the buried data is cleaned and analyzed, and the user's historical browsing behavior is classified, and the actual user needs are confirmed through statistics;

[0152] Mapping the actual user needs into the state space and behavior space in reinforcement learning, predicting user behavior, and outputting the user's demand weights for different resources;

[0153] An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times through the user behavior prediction module to obtain the resource loading sequence.

[0154] Any of the file loading methods provided in an embodiment of the present invention can be applied to the processor 501, or implemented by the processor 501. The processor 501 can be an integrated circuit chip having signal processing capabilities. During implementation, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 501 or instructions in the form of software. The above-mentioned processor 501 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0155] The steps of any method in the file loading method provided in the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software units in the decoding processor. The software units can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 502, and processor 501 reads the information in memory 502 and, in conjunction with its hardware, completes the steps of the method.

[0156] Those skilled in the art will appreciate that although some embodiments described herein include some features and not others included in other embodiments, the combination of features from different embodiments is intended to be within the scope of the invention and to form different embodiments.

[0157] Those skilled in the art will appreciate that the description of each embodiment has its own focus, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0158] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations shall fall within the scope defined by the appended claims. The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and such modifications or substitutions shall be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

[0159] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A file loading method, characterized in that: include: Use code tracking to monitor user browsing history, including page jumps, clicks, scrolling, searches, and dwell time. Set different reporting methods and timings for different user historical browsing behaviors; Obtain the user's historical browsing track by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics; Mapping the actual needs of the user into the state space and behavior space in reinforcement learning, predicting the user's behavior, and outputting the user's demand weights for different resources; An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior and the weights of different user behaviors are combined together. The initial resource loading sequence is iterated multiple times through the user behavior prediction module to obtain a resource loading order sequence.

2. A file loading method according to claim 1, characterized in that: Use code tracking to monitor user browsing history, including: Manually add tracking code at key behavior nodes; For the user's click behavior, scroll behavior, and search behavior, use event listeners and callback functions in JavaScript to introduce tracking scripts; For the stay time, user_id and user_name are used to represent the user ID and user name, page_path and page_title are used to represent the path and page title of the current page, and event_type, act_tag, begin_time, and end_time are used to represent the current event type, resource tag, start time, and end time.

3. A file loading method according to claim 1, characterized in that: The different reporting methods and reporting times are set for different user historical browsing behaviors, including: The page jump behavior is reported synchronously using the WebSocket reporting mechanism, and the front-end and back-end establish a long connection. The front-end transmits the relevant data of the user page jump to the server; The click behavior and the search behavior are asynchronously reported using a batch mechanism. The batch mechanism caches the user tracks collected by the front end using a data queue and reports when the data volume reaches a threshold value data_threshold; The scrolling behavior and the dwelling behavior correspond to the resource reaching the preset virtual viewing area of ​​the page and the user dwelling on a resource for more than the preset time, and the performance data is reported by using the Beacon API; For the reported content, a unified field identifier and table structure are used.

4. A file loading method according to claim 1, characterized in that: The above mentioned cleaning and analyzing of the buried data and classification of the user's historical browsing behavior, and confirming the user's actual needs through statistics, include: Clean the collected data of users' historical browsing behavior; Classify the cleaned data according to the preset resource type; For all resources, sort them from small to large according to begin_time to represent the user's behavior trajectory at the time level. Sort the classified resources according to the stay time to determine the user's interest preference for the same resource; Among them, cleaning the collected user historical browsing behavior data includes deleting duplicate records and searching for abnormal values. The deletion rules for duplicate records are as follows: During scrolling, delete the user behavior data related to the first screen of page rendering; If there are scrolling behavior and stay behavior data for the same resource, only the stay user behavior data is retained; If there are click behavior and stay behavior data for the same resource, only the click behavior data will be retained; If there are search behavior and stay behavior data for the same resource, only the search behavior data is retained; The operation of searching for outliers determines whether the residence time is greater than a preset threshold.

5. A file loading method according to claim 1, characterized in that: The actual needs of the user are mapped into the state space and behavior space in reinforcement learning, and the weights of different user behaviors are output by predicting the user behavior, including: Mapping the actual needs of users into the state space of reinforcement learning, where the state space is characterized by uniform resource tags. Resource tags include at least: scripts, style sheets, JSON, XML, pictures, audio and video files, etc. The amount of resources depends on the environment and resources of the current user browsing page; The behavior space is defined as the user browsing behavior in the actual needs of the user. The user browsing behavior is represented by A = {a1, a2, …, a n }, where A represents the browsing resource collection of the current user, a n Indicates the nth resource browsed by the user; Predict user behavior based on behavior space and state space, and output the weights of different user behaviors.

6. A file loading method according to claim 1, characterized in that: The initialization resource loading sequence is generated according to the user's historical browsing trajectory, the predicted user behavior and the weights of different user behaviors are combined, and the initialization resource loading sequence is iterated multiple times through the user behavior prediction module to obtain the resource loading sequence, including: The reward function is defined as: Among them, R represents the reward generated under the current resource loading sequence, Indicates the time when the user browses to resource i. Indicates the time when the front-end page finishes loading resource i. represents the difference between the user browsing and rendering time of resource i, and the reward function is the sum of the time differences of all resources; The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times through the user behavior prediction module. The reward function tests the user experience of the resource loading sequence, and finally outputs the optimal resource loading decision sequence.

7. A file loading method according to claim 4, characterized in that: The preset resource types include: act_tag1: JavaScript script file; act_tag2: css style sheet file; act_tag3: JSON file; act_tag4: XML file; act_tag5: picture file. The file types of picture files include at least: jpg, png and gif; act_tag6: audio file. The file types of audio files include at least: mp3, opp; act_tag7: video file. The file types of video files include at least: mp4 and webm; act_tag8: other files. The file types of other files include at least: PDF files, SVG vector files, data files, and compressed files.

8. A file loading device, characterized in that: include: Monitoring module: used to monitor the user's historical browsing behavior by using code tracking, and the user's historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time; Setting module: used to set different reporting methods and reporting times for different user historical browsing behaviors; Statistics module: used to obtain the user's historical browsing track by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics; Prediction module and output module: used to map the actual needs of the user into the state space and behavior space in reinforcement learning, predict the user behavior, and output the user's demand weights for different resources; Acquisition module: used to generate an initialization resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initialization resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.

9. An electronic device, characterized in that: include: Processor and memory; The processor is used to execute a file loading method as described in any one of claims 1 to 7 by calling the program or instruction stored in the memory.

10. A computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute a file loading method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Information recommendation method, device and equipment

    CN110532479A

  • Data burying point processing method and device and related equipment

    CN113268695A

  • User behavior burying point construction method and system

    CN113689257A

  • Webpage acceleration processing method and system

    CN116484134A

  • File loading method and device

    CN117873583A

Cited By

  • Virtual list dynamic rendering method, system, equipment and medium

    CN121350372A

  • Front-end user behavior prediction method and device based on artificial intelligence technology

    CN121387683A

  • Chart display method and device for machine data and storage medium

    CN121901472A