Method, device, medium and equipment for improving loading speed of mini program interface

By calling the preloaded network request thread and rendering thread in parallel when the applet loads the request, the data required for the applet interface is obtained and cached in advance, the problem of long loading time of applets is solved, and the response speed and user experience are significantly improved.

CN119536848BActive Publication Date: 2025-05-02BEIJING FENYANG TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510097520.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-05-02
Estimated Expiration
2045-01-22

AI Technical Summary

Technical Problem

The loading time of existing technology is long, affecting the user experience.

Method used

When receiving the applet interface loading request, the preload network request thread and the rendering thread are called in parallel, and the preload network request information is obtained through the preload network request thread, the preload network request is sent to the server, and the mapping relationship between the prerequisite parameter information and the request result is saved. The rendering thread loads and displays the applet interface based on this information after the resource is initialized.

Benefits of technology

It significantly improves the response speed of the mini program, reduces the user's waiting interface loading time, makes the mini program interface display more quickly, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536848B_ABST
    Figure CN119536848B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, medium and equipment for improving the loading speed of a mini-program interface, and relates to the field of computer technology. The method includes: upon receiving a mini-program interface loading request, calling a preloading network request thread and a rendering thread in parallel, wherein the preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, sends a preloading network request to the server corresponding to the mini-program interface based on the pre-request parameter information, and saves the mapping relationship between the pre-request parameter information and the request result after receiving the request result returned by the server; after the rendering thread initializes the resources of the mini-program interface, obtains the request result corresponding to the pre-request parameter information from the mapping relationship saved by the pre-request network request thread based on the pre-request parameter information, and loads and displays the mini-program interface based on the request result. The present application solves the technical problem of long mini-program loading time in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a method, device, medium and equipment for improving the loading speed of a mini-program interface. Background Art

[0002] With the rapid development of mobile Internet, people's demand for convenient and efficient applications is growing. In this context, the rise of mini-programs (Applications) has become a new solution. With its lightweight, convenient, and installation-free features, mini-programs provide users with a more convenient mobile Internet service experience and are regarded as an important entry point for exploring the new era of mobile Internet.

[0003] The user experience of current mini programs is crucial to users. However, many mini programs have delays in loading, causing users to wait too long, affecting the user experience.

[0004] With respect to the technical problem of long loading time of mini programs in the above-mentioned prior art, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method, device, medium and equipment for improving the loading speed of a mini-program interface, so as to at least solve the technical problem of long loading time of mini-programs in the prior art.

[0006] According to one aspect of an embodiment of the present application, a method for improving the loading speed of a mini-program interface is provided, the method comprising: when a mini-program interface loading request is received, calling a preloading network request thread and a rendering thread in parallel; the preloading network request thread obtains pre-request parameter information required for the mini-program interface loading request, and sends a preloading network request to a server corresponding to the mini-program interface based on the pre-request parameter information, and after receiving the request result returned by the server, saves the mapping relationship between the pre-request parameter information and the request result; after the rendering thread performs resource initialization on the mini-program interface, it obtains the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information, and loads and displays the mini-program interface based on the request result.

[0007] Based on any of the above embodiments, before calling the preloading network request thread, it also includes:

[0008] Generate a preloaded network request JS file in the directory where the mini-program interface is located.

[0009] Based on any of the above embodiments, the calling of the rendering thread includes:

[0010] Based on the mini-program interface loading request, the page routing framework captures the routing intent and obtains the application name and page routing;

[0011] The preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, including:

[0012] Obtain the application name and page route parsed by the rendering thread, and determine whether there is a preloaded network request JS file on the mini program interface;

[0013] When there is a preloaded network request JS file in the mini-program interface, the system basic parameters are obtained and passed to the JS file to generate the pre-request parameter information based on the system basic parameters.

[0014] Based on any of the above embodiments, generating the pre-request parameter information based on the system basic parameters includes:

[0015] The JS file generates http request basic parameters and http request service-specific parameters based on the system basic parameters, and uses the http request basic parameters and http request service-specific parameters as the pre-request parameter information.

[0016] On the basis of any of the above embodiments, after receiving the request result returned by the server, saving the mapping relationship between the pre-request parameter information and the request result includes:

[0017] When the request result is received, a first Hash value of the pre-request parameter information is calculated, and a mapping relationship between the first Hash value and the request result is saved.

[0018] On the basis of any of the above embodiments, obtaining a request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information includes:

[0019] The initiated business network request calculates a second hash value of a business network request parameter in the business network request;

[0020] According to the second Hash value, a request result corresponding to the first Hash value that is the same as the second Hash value is obtained in the mapping relationship, and returned to the service and the cache is updated.

[0021] On the basis of any of the above embodiments, obtaining the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information further includes:

[0022] When the request result corresponding to the first hash value is not found in the mapping relationship according to the second hash value, determine whether a preloaded network request with the same hash value is being executed. If a preloaded network request with the same hash value is being executed, wait for the preloaded network request to return the request result; if no preloaded network request with the same hash value is being executed, initiate the business network request again.

[0023] According to another aspect of an embodiment of the present application, a device for improving the loading speed of a mini-program interface is provided, the device comprising:

[0024] A parameter construction module, used to call the preloading network request thread and the rendering thread in parallel when receiving a mini-program interface loading request, wherein the preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request;

[0025] A request sending module, used to send a preload network request to a server corresponding to the mini-program interface based on the pre-request parameter information;

[0026] A data cache module, used for saving the mapping relationship between the pre-request parameter information and the request result after receiving the request result returned by the server;

[0027] An interface loading module is used to obtain the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information after the rendering thread initializes the resources of the mini-program interface, and load and display the mini-program interface based on the request result.

[0028] According to another aspect of an embodiment of the present application, a storage medium is provided, the storage medium including a stored program, wherein when the program is running, a device where the storage medium is located is controlled to execute the method described in any of the above embodiments.

[0029] According to another aspect of an embodiment of the present application, a computing device is provided, including a processor, wherein the processor is used to run a program, wherein when the program is run, the method described in any of the above embodiments is executed.

[0030] In an embodiment of the present application, the initialization of the mini-program interface container and the preloading network request can be executed in parallel. By using the preloading network request method, data can be obtained and cached in advance to accelerate the display speed of the mini-program interface. Through this method, the response speed of the mini-program can be significantly improved, the user experience can be improved, the time users spend waiting for the interface to load can be reduced, and the mini-program interface can be displayed more quickly, thereby solving the technical problem of the long loading time of the mini-program in the prior art. Therefore, user satisfaction with the mini-program can be enhanced, greatly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0032] Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) according to a method for improving the loading speed of a mini-program interface according to an embodiment of the present application;

[0033] Figure 2 is a flow chart of a method for improving the loading speed of a mini-program interface according to an embodiment of the present application;

[0034] Figure 3 is a flowchart of another method for improving the loading speed of the mini-program interface according to an embodiment of the present application;

[0035] Figure 4 It is a structural diagram of a device for improving the loading speed of a mini-program interface according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0038] Example 1

[0039] According to an embodiment of the present application, a method embodiment for improving the loading speed of a mini-program interface is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.

[0040] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) showing a method for improving the loading speed of a mini-program interface. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (shown as 102a, 102b, ..., 102n in the figure) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions.

[0041] This application runs in the above operating environment as follows Figure 2 A method for improving the loading speed of the mini program interface is shown. Figure 2 is a flowchart of a method for improving the loading speed of a mini-program interface according to an embodiment of the present application, which can be applied to Figure 1 Computer terminal shown.

[0042] See also Figure 2 As shown, methods for improving the loading speed of the mini program interface may include:

[0043] Step S201: When a mini-program interface loading request is received, a preloading network request thread and a rendering thread are called in parallel.

[0044] In some embodiments, before calling the preload network request thread, a preload network request JS file can also be generated in the directory where the mini-program interface is located. If the developer uses the ability to preload network requests, he first needs to generate a prefetch.js file in the directory where the page is located. The JS file includes the following core code units:

[0045] Basic parameter assembly unit, used to generate basic parameters of http request;

[0046] Business parameter assembly function, used to generate http request business-specific parameters;

[0047] The http request scheduling unit initiates a request to the server according to the results of the execution of the basic parameter assembly unit and the business parameter assembly function;

[0048] The above code resources will be packaged into the release file along with the mini program release.

[0049] Step S202: The preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, sends the pre-request network request to the server corresponding to the above-mentioned mini-program interface based on the pre-request parameter information, and after receiving the request result returned by the server, saves the mapping relationship between the pre-request parameter information and the request result.

[0050] In some embodiments, the rendering thread is called, which can be specifically based on the loading request of the above-mentioned mini-program interface, the page routing framework captures the routing intent, parses the parameters to obtain the application name (App Name) and page route (Page Route), and assembles the parameters.

[0051] In some embodiments, the preloaded network request thread obtains the pre-request parameter information required for the mini-program interface loading request, which can be done by obtaining the application name and page route parsed by the rendering thread, and judging whether the mini-program interface has a pre-loaded network request JS file; when it is determined that the mini-program interface has a pre-loaded network request JS file, it obtains the basic system parameters, such as the system version, language, account, etc., passes them to the JS file, processes the pre-loaded parameters, and generates the pre-request parameter information based on the basic system parameters. When it is determined that the mini-program interface does not have a pre-loaded network request JS file, no subsequent actions are performed.

[0052] In some embodiments, the pre-request parameter information is generated based on system basic parameters. The JS file can generate http request basic parameters and http request service-specific parameters based on the system basic parameters, and use the http request basic parameters and http request service-specific parameters as the pre-request parameter information.

[0053] Step S203: After the rendering thread initializes the resources of the mini-program interface, it obtains the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information, and loads and displays the mini-program interface based on the request result.

[0054] In some embodiments, after receiving the request result returned by the server, the preloaded network request thread saves the mapping relationship between the pre-request parameter information and the request result. The mapping relationship between the first hash value and the request result can be saved by calculating the first hash value of the pre-request parameter information when the request result is received.

[0055] In some embodiments, based on the pre-request parameter information, a request result corresponding to the pre-request parameter information is obtained from the mapping relationship saved by the preloaded network request thread. The second hash value of the business network request parameter in the business network request can be calculated by initiating a business network request; according to the second hash value, the request result corresponding to the first hash value that is the same as the second hash value is obtained in the mapping relationship, returned to the business and the cache is updated.

[0056] Optionally, the first hash value and the second hash value may be MD5 values ​​or other encrypted values.

[0057] In some embodiments, based on the pre-request parameter information, the request result corresponding to the pre-request parameter information is obtained from the mapping relationship saved by the pre-loading network request thread. When the request result corresponding to the first hash value is not found in the mapping relationship according to the second hash value, it is also possible to determine whether a pre-loading network request with the same hash value is being executed. If a pre-loading network request with the same hash value is being executed, wait for the pre-loading network request to return the request result; if no pre-loading network request with the same hash value is being executed, initiate the business network request again.

[0058] In some embodiments, the mini-program interface is loaded and displayed based on the request result, which can be specifically performed by

[0059] Parse the data, build the data structure required for interface rendering, and then pass it to webview for rendering and updating the interface to realize interface loading and display.

[0060] In an embodiment of the present application, the initialization of the mini-program interface container and the preloading network request can be executed in parallel. By using the preloading network request method, data can be obtained and cached in advance to accelerate the display speed of the mini-program interface. Through this method, the response speed of the mini-program can be significantly improved, the user experience can be improved, the time users spend waiting for the interface to load can be reduced, and the mini-program interface can be displayed more quickly, thereby solving the technical problem of the long loading time of the mini-program in the prior art. Therefore, user satisfaction with the mini-program can be enhanced, greatly improving the user experience.

[0061] Compared with the traditional applet loading process, the applet container is initialized first, the corresponding resources are loaded, and then the resource loading is completed, and then the business network request is initiated to obtain the data required for the interface, which leads to slow loading of the applet and poor user experience. This application optimizes the applet loading process, and executes the initialization of the applet interface container and the network data request in parallel to obtain the data required for the interface and cache it, which can greatly reduce the time users spend waiting for the interface to load and make the applet interface display faster. It can enhance user satisfaction with the applet and greatly improve user experience.

[0062] In some embodiments, another method for improving the loading speed of the mini-program interface is also provided.

[0063] See also Figure 3 As shown, methods for improving the loading speed of the mini program interface may include:

[0064] When executing step 3101, execute step 3201 in parallel.

[0065] Step 3101, call the preload network request thread, and go to step 3102;

[0066] Step 3102, check whether the interface supports preloading network request threads, if yes, go to step 3103, if not, end the process;

[0067] Step 3103: Encapsulate pre-request basic parameters, and then go to step 3104;

[0068] Step 3104: Encapsulate the request service-specific parameters, and then go to step 3105;

[0069] Step 3105, calculate the MD5 value of the pre-request parameter information, and then go to step 3106;

[0070] Step 3106: Schedule HTTP to initiate a preload network request, and then go to step 3107;

[0071] Step 3107: Receive the returned request result and put the request result into the cache.

[0072] Step 3108, determine whether there is a request result corresponding to the preloaded network request, if yes, go to step 3109, if no, go to step 3110;

[0073] Step 3109: Feedback the request result, and then go to step 3205;

[0074] Step 3110: determine whether to issue a preload network request. If yes, go to step 3111. If no, send the service request again.

[0075] Step 3111, put the callback into the waiting queue, wait for the preload network request to return the request result, and then go to step 3205.

[0076] Step 3201, call and render thread, then go to step 3202;

[0077] Step 3202, webview container is initialized, and then go to step 3203;

[0078] Step 3203: Load resources, run business logic, and then go to step 3204;

[0079] Step 3204: initiate a service request to the preloaded network request thread, and then go to 3108;

[0080] Step 3205: Render the interface based on the request result.

[0081] This application is the first to achieve a deep integration of the preloaded network request framework and the mini-program startup process in the mini-program technology stack. By optimizing the startup process at the mini-program engine level, there is no need to intrude and modify the business code, and there is no need to rewrite the mini-program page jump API, which greatly improves the compatibility and stability of the technical solution.

[0082] This application significantly improves the loading performance of the mini-program by preloading the network request and executing it in parallel with the mini-program startup. This parallel processing mechanism fully utilizes the processing power of modern devices, effectively shortens the user's waiting time, and thus greatly improves the user experience.

[0083] The data caching function of this application is responsible for data storage, extraction and validity verification. Through data caching and validity verification, we ensure that users can get fast and accurate services even in an unstable network environment, greatly enhancing the practicality and reliability of the mini program technology stack.

[0084] This application greatly simplifies the development process by ensuring the consistency of network request parameters between pre-requests and online production environments. Developers can focus on the business logic and function implementation of the mini-program without having to worry about complex parameter construction and network request management. This focus on core business allows developers to customize preloading logic according to specific business needs, which is a more proactive and flexible preloading strategy.

[0085] 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 preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method for improving the loading speed of the mini-program interface according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0087] Example 2

[0088] According to an embodiment of the present application, a device for improving the loading speed of a mini-program interface is also provided for implementing the above method for improving the loading speed of a mini-program interface. The device is implemented in software or hardware. Figure 1 The computer terminal.

[0089] like Figure 4 As shown, the device 400 for improving the loading speed of the mini-program interface includes: a parameter construction module 401, a request sending module 402, a data cache module 403 and an interface loading module 404. Among them:

[0090] The parameter construction module 401 is used to call the preloading network request thread and the rendering thread in parallel when receiving the mini-program interface loading request, wherein the preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request;

[0091] A request sending module 402, configured to send a preload network request to a server corresponding to the mini-program interface based on the pre-request parameter information;

[0092] The data cache module 403 is used to save the mapping relationship between the pre-request parameter information and the request result after receiving the request result returned by the server;

[0093] The interface loading module 404 is used to obtain the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information after the rendering thread initializes the resources of the mini-program interface, and load and display the mini-program interface based on the request result.

[0094] Here, it should be noted that the above parameter construction module 401, request sending module 402, data cache module 403 and interface loading module 404 correspond to steps S201 to S203 in Example 1, and the examples and application scenarios implemented by the above four modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.

[0095] Optionally, before calling the preloading network request thread, the method further includes:

[0096] Generate a preloaded network request JS file in the directory where the mini-program interface is located.

[0097] Optionally, calling the rendering thread includes:

[0098] Based on the mini-program interface loading request, the page routing framework captures the routing intent and obtains the application name and page routing;

[0099] The preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, including:

[0100] Obtain the application name and page route parsed by the rendering thread, and determine whether there is a preloaded network request JS file on the mini program interface;

[0101] When there is a preloaded network request JS file in the mini-program interface, the system basic parameters are obtained and passed to the JS file to generate the pre-request parameter information based on the system basic parameters.

[0102] Optionally, generating the pre-request parameter information based on the system basic parameters includes:

[0103] The JS file generates http request basic parameters and http request service-specific parameters based on the system basic parameters, and uses the http request basic parameters and http request service-specific parameters as the pre-request parameter information.

[0104] Optionally, after receiving the request result returned by the server, saving the mapping relationship between the pre-request parameter information and the request result includes:

[0105] When the request result is received, a first Hash value of the pre-request parameter information is calculated, and a mapping relationship between the first Hash value and the request result is saved.

[0106] Optionally, obtaining a request result corresponding to the pre-request parameter information from the mapping relationship saved by the preload network request thread based on the pre-request parameter information includes:

[0107] The initiated business network request calculates a second hash value of a business network request parameter in the business network request;

[0108] According to the second Hash value, a request result corresponding to the first Hash value that is the same as the second Hash value is obtained in the mapping relationship, and returned to the service and the cache is updated.

[0109] Optionally, obtaining a request result corresponding to the pre-request parameter information from the mapping relationship saved by the preload network request thread based on the pre-request parameter information further includes:

[0110] When the request result corresponding to the first hash value is not found in the mapping relationship according to the second hash value, determine whether a preloaded network request with the same hash value is being executed. If a preloaded network request with the same hash value is being executed, wait for the preloaded network request to return the request result; if no preloaded network request with the same hash value is being executed, initiate the business network request again.

[0111] Example 3

[0112] The embodiment of the present application may provide a computing device, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computing device may also be replaced by a terminal device such as a mobile terminal. Optionally, in this embodiment, the computer device may implement the method for improving the loading speed of the mini-program interface.

[0113] Optionally, in this embodiment, the computing device may be located in at least one network device among a plurality of network devices of a computer network.

[0114] Optionally, in this embodiment, the computing device includes one or more processors, memory, and transmission device. Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for improving the loading speed of the mini-program interface in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method for improving the loading speed of the mini-program interface.

[0115] Optionally, the memory may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computing device 120 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0116] In this embodiment, the initialization of the mini-program interface container and the preloading network request can be performed in parallel. By preloading the network request, data can be obtained and cached in advance to accelerate the display speed of the mini-program interface. Through this method, the response speed of the mini-program can be significantly improved, the user experience can be improved, the time users spend waiting for the interface to load can be reduced, and the mini-program interface can be displayed more quickly, thereby solving the technical problem of the long loading time of the mini-program in the prior art. Therefore, user satisfaction with the mini-program can be enhanced, greatly improving the user experience.

[0117] Furthermore, in this embodiment, when the processor in the computing device runs the stored program code, any method step listed in Embodiment 1 may be executed, which will not be described in detail due to space limitations.

[0118] Example 4

[0119] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the method for improving the loading speed of the mini-program interface.

[0120] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0121] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: when a request to load a mini-program interface is received, a preloading network request thread and a rendering thread are called in parallel, wherein the preloading network request thread obtains pre-request parameter information required for the mini-program interface loading request, and sends a preloading network request to a server corresponding to the mini-program interface based on the pre-request parameter information, and after receiving the request result returned by the server, saves the mapping relationship between the pre-request parameter information and the request result; after the rendering thread initializes resources for the mini-program interface, obtains the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information, and loads and displays the mini-program interface based on the request result.

[0122] Furthermore, in this embodiment, the storage medium is configured to store program codes for executing any one of the method steps listed in Embodiment 1, which will not be described in detail due to space limitations.

[0123] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0124] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0125] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, 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 through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0126] 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 solution of this embodiment.

[0127] 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0128] If the integrated unit 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, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. 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, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium 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.

[0129] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for improving the loading speed of a mini program interface, characterized in that: The method includes: When receiving a Mini Program interface loading request, the preloading network request thread and rendering thread are called in parallel; The preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, sends the pre-loading network request to the server corresponding to the mini-program interface based on the pre-request parameter information, and saves the mapping relationship between the pre-request parameter information and the request result after receiving the request result returned by the server; After the rendering thread performs resource initialization on the mini-program interface, the rendering thread obtains the request result corresponding to the pre-request parameter information from the mapping relationship saved by the pre-loading network request thread based on the pre-request parameter information, and loads and displays the mini-program interface based on the request result; Before calling the preloading network request thread, it also includes: Generate a preloaded network request JS file in the directory where the mini-program interface is located; Calling the rendering thread includes: Based on the mini-program interface loading request, the page routing framework captures the routing intent and obtains the application name and page routing; The preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request, including: Obtain the application name and page route parsed by the rendering thread, and determine whether there is a preloaded network request JS file on the mini program interface; When there is a preloaded network request JS file in the mini-program interface, obtain the basic system parameters and pass them to the JS file to generate the pre-request parameter information based on the basic system parameters; Generating the pre-request parameter information based on the system basic parameters includes: The JS file generates http request basic parameters and http request service-specific parameters based on the system basic parameters, and uses the http request basic parameters and http request service-specific parameters as the pre-request parameter information; After receiving the request result returned by the server, the mapping relationship between the pre-request parameter information and the request result is saved, including: When the request result is received, a first Hash value of the pre-request parameter information is calculated, and a mapping relationship between the first Hash value and the request result is saved.

2. The method according to claim 1, characterized in that: Obtaining a request result corresponding to the pre-request parameter information from the mapping relationship saved by the pre-loading network request thread based on the pre-request parameter information includes: The initiated business network request calculates a second hash value of a business network request parameter in the business network request; According to the second Hash value, a request result corresponding to the first Hash value that is the same as the second Hash value is obtained in the mapping relationship, and returned to the service and the cache is updated.

3. The method according to claim 2, characterized in that Acquiring a request result corresponding to the pre-request parameter information from the mapping relationship saved by the pre-load network request thread based on the pre-request parameter information, further comprising: When the request result corresponding to the first hash value is not found in the mapping relationship according to the second hash value, determine whether a preloaded network request with the same hash value is being executed. If a preloaded network request with the same hash value is being executed, wait for the preloaded network request to return the request result; if no preloaded network request with the same hash value is being executed, initiate the business network request again.

4. A device for improving the loading speed of a mini-program interface, the device adopts the method according to any one of claims 1 to 3, characterized in that: The device includes: A parameter construction module, used to call the preloading network request thread and the rendering thread in parallel when receiving a mini-program interface loading request, wherein the preloading network request thread obtains the pre-request parameter information required for the mini-program interface loading request; A request sending module, used to send a preload network request to a server corresponding to the mini-program interface based on the pre-request parameter information; A data cache module, used for saving the mapping relationship between the pre-request parameter information and the request result after receiving the request result returned by the server; An interface loading module is used to obtain the request result corresponding to the pre-request parameter information from the mapping relationship saved by the preloading network request thread based on the pre-request parameter information after the rendering thread initializes the resources of the mini-program interface, and load and display the mini-program interface based on the request result.

5. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 3.

6. A computing device comprising a processor, characterized in that: The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 3 when running.

Citation Information

Patent Citations

  • Applet cold start method and device, computer equipment and storage medium

    CN111399938A