Application startup optimization method and device

By loading intercepting and preprocessing the application's view controller and loading page elements in time, the long startup time caused by simultaneously loading the view controller in the existing technology is solved, and the rapid startup and user experience improvement of the application is achieved .

CN113391847BActive Publication Date: 2024-12-06BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010163723.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-10
Publication Date
2024-12-06
Estimated Expiration
2040-03-10

AI Technical Summary

Technical Problem

In the prior art, the startup time of the application program is relatively long, mainly due to the delay caused by the simultaneous loading of all view controllers, resulting in poor user experience and limited optimization space for executable files.

Method used

By obtaining the view controller of the application to be started, using the load permission file for load interception and preprocessing, loading page elements in time, delaying the loading of view controllers that are not needed immediately, and avoiding loading all view controllers at the same time.

Benefits of technology

It effectively reduces the startup time of the application, improves the user experience, and achieves the effect of starting in seconds without modifying existing code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113391847B_ABST
    Figure CN113391847B_ABST
Patent Text Reader

Abstract

The present invention discloses an application startup optimization method and device, and relates to the field of computer technology. A specific implementation of the method includes: according to an application startup request, obtaining at least one view controller corresponding to the application to be started; intercepting the loading of at least one view controller, using the loading permission file corresponding to the application to be started, and pre-processing the loading of at least one view controller; according to the loading pre-processing result, loading the page element corresponding to at least one view controller. This implementation can achieve the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for optimizing the startup of an application program. Background Art

[0002] The application startup time refers to the time from when the user clicks the application icon to when the application is fully displayed. Usually, the startup speed of an application determines the user's first impression of the application, so the startup speed of an application is an important criterion for evaluating the quality of an application. For example, if an application can be started within 0.25s, it means that the startup performance of the application is good, so how to optimize the startup speed of the application is of great significance.

[0003] The factors that determine the startup speed of an application are: the size of the executable file and the optimization from the time the executable file is loaded to the time the page is fully displayed. Existing solutions are mainly optimization solutions before the main function (such as the main function), that is, optimization of the executable file, such as deleting useless code, integrating similar codes, and avoiding time-consuming operations in the load function (that is, the method called by the system after the class is loaded during the startup process).

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: for applications, the amount of code that can be deleted is relatively small, most of the business codes have been optimized, and a large number of business needs also determine that the executable file of the application cannot be reduced to an ideal range. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides an application startup optimization method and device, which can avoid the problem of long startup time caused by simultaneous loading of all view controllers in the prior art, reduce the application startup time, and improve the user experience.

[0006] To achieve the above objective, according to a first aspect of an embodiment of the present invention, a method for optimizing the startup of an application is provided.

[0007] A method for optimizing the startup of an application program according to an embodiment of the present invention comprises: obtaining, according to an application startup request, at least one view controller corresponding to the application program to be started; intercepting the loading of the at least one view controller, and performing loading preprocessing on the at least one view controller using a loading permission file corresponding to the application program to be started; and loading a page element corresponding to the at least one view controller according to the loading preprocessing result.

[0008] Optionally, intercepting the loading of the at least one view controller includes: when the at least one view controller is loaded, calling a preset code instead of calling the loading code corresponding to the at least one view controller to complete the interception of the loading of the at least one view controller.

[0009] Optionally, the loading preprocessing of the at least one view controller is performed using the loading permission file corresponding to the application to be started, including: filtering out view controllers that need to be delayed loading and view controllers that need to be directly loaded from the at least one view controller according to the loading permission file corresponding to the application to be started; and obtaining the delayed loading time of the view controller that needs to be delayed loading.

[0010] Optionally, loading the page elements corresponding to the at least one view controller according to the loading preprocessing result includes: directly calling the loading code corresponding to the view controller that needs to be directly loaded, so as to complete the loading of the page elements corresponding to the view controller that needs to be directly loaded; and calling the loading code corresponding to the view controller that needs to be delayed loading according to the delayed loading time of the view controller that needs to be delayed loading, so as to complete the loading of the page elements corresponding to the view controller that needs to be delayed loading.

[0011] Optionally, before using the loading permission file corresponding to the application to be started to perform load preprocessing on the at least one view controller, the method also includes: loading the loading permission file corresponding to the application to be started into the memory; and after loading the page element corresponding to the at least one view controller according to the loading preprocessing result, the method also includes: removing the loading permission file corresponding to the application to be started from the memory.

[0012] Optionally, before performing load preprocessing on the at least one view controller using the load permission file corresponding to the application to be started, the method further includes: pre-creating a load permission file corresponding to the application to be started.

[0013] To achieve the above objective, according to a second aspect of an embodiment of the present invention, a device for optimizing the startup of an application is provided.

[0014] An application startup optimization device according to an embodiment of the present invention includes: an acquisition module, used to acquire at least one view controller corresponding to the application to be started according to an application startup request; a processing module, used to intercept the loading of the at least one view controller, and perform loading preprocessing on the at least one view controller using a loading permission file corresponding to the application to be started; and a loading module, used to load a page element corresponding to the at least one view controller according to the loading preprocessing result.

[0015] Optionally, the processing module is further used to: when the at least one view controller is loaded, call a preset code instead of calling the loading code corresponding to the at least one view controller to complete the loading interception of the at least one view controller.

[0016] Optionally, the processing module is also used to: filter out view controllers that need to be delayed loaded and view controllers that need to be directly loaded from the at least one view controller according to the loading permission file corresponding to the application to be started; and obtain the delayed loading time of the view controller that needs to be delayed loaded.

[0017] Optionally, the loading module is also used to: directly call the loading code corresponding to the view controller that needs to be loaded directly, so as to complete the loading of the page elements corresponding to the view controller that needs to be loaded directly; and call the loading code corresponding to the view controller that needs to be loaded late according to the delayed loading time of the view controller that needs to be loaded late, so as to complete the loading of the page elements corresponding to the view controller that needs to be loaded late.

[0018] Optionally, the processing module is further used to: load the loading permission file corresponding to the application to be started into the memory; and remove the loading permission file corresponding to the application to be started from the memory.

[0019] Optionally, the processing module is further used to: pre-create a loading permission file corresponding to the application to be started.

[0020] To achieve the above objective, according to a third aspect of an embodiment of the present invention, an electronic device is provided.

[0021] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the startup optimization method of the application according to the embodiment of the present invention.

[0022] To achieve the above objective, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided.

[0023] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the startup optimization method of an application program according to an embodiment of the present invention is implemented.

[0024] An embodiment of the above invention has the following advantages or beneficial effects: each view controller to be launched is loaded and intercepted, and then each view controller is pre-processed for loading using a pre-created loading permission file, so that each view controller can be loaded according to the loading pre-processing result, thereby achieving the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.

[0025] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0027] Figure 1 is a schematic diagram of main steps of a method for optimizing application startup according to an embodiment of the present invention;

[0028] Figure 2 is a schematic diagram of the main process of the application startup optimization method according to an embodiment of the present invention;

[0029] Figure 3 is a schematic diagram of loading a view controller according to an embodiment of the present invention;

[0030] Figure 4 is a schematic diagram of main modules of an application startup optimization device according to an embodiment of the present invention;

[0031] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0032] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] At present, application development pays more attention to user experience, mainly that users can use the application smoothly and users can start the application quickly. Among them, the smoothness of the use process depends on many factors, such as network, image loading, etc., which requires developers to write robust code. Therefore, the startup speed of the application is an important criterion for evaluating the quality of an application. For example, if an application can be started within 0.25s, it means that the startup performance of the application is relatively good, so how to optimize the startup speed of the application is of great significance.

[0035] The startup time of an application refers to the time from when the user clicks the application icon to when the application is fully displayed. Factors that determine the startup speed of an application are: the size of the executable file and the optimization from when the executable file is loaded to when the page is fully displayed. The existing solution mainly optimizes the executable file, but for applications, the amount of code that can be deleted is relatively small, most of the business code has been optimized, and a large number of business needs also determine that the executable file of the application cannot be reduced to the ideal range.

[0036] In order to solve the above problems, an embodiment of the present invention provides a method for optimizing the startup of an application program, which can reduce the startup time of the application program and give the user a feeling of startup in one second. Figure 1 FIG. 1 is a schematic diagram of the main steps of the startup optimization method of an application according to an embodiment of the present invention. Figure 1 As shown, the main steps of the application startup optimization method of the embodiment of the present invention may include:

[0037] Step S101, acquiring at least one view controller corresponding to the application to be started according to the application start request;

[0038] Step S102, intercepting the loading of at least one view controller, and performing loading preprocessing on the at least one view controller using the loading permission file corresponding to the application to be started;

[0039] Step S103: loading a page element corresponding to at least one view controller according to the loading preprocessing result.

[0040] In the application startup optimization method of the embodiment of the present invention, when an application startup request is received, the application to be started is determined. For example, when a user clicks on the icon of an application, it can be determined that the application to be started is the application. After the application to be started is determined, at least one view controller corresponding to the application to be started can be obtained. Among them, the view controller refers to a controller that can display a page. An application can contain multiple pages, and each page is equivalent to a controller. Since starting an application is equivalent to displaying the page corresponding to the application, after the application to be started is determined, the view controller corresponding to the application can be obtained.

[0041] In the startup method of the prior art application, after obtaining the view controller of the application to be started, the view controller is directly loaded, so that there will be a situation where multiple view controllers need to be loaded at the same time, but when a user opens an application, a page of the application is presented to the user, so other pages do not need to be loaded at the first time, that is to say, loading one view controller of the application is sufficient, and all view controllers of the application do not need to be loaded. In summary, the prior art simultaneously loads all view controllers corresponding to the application, which will increase the startup time of the application. Therefore, in step S102, at least one view controller corresponding to the application to be started is loaded and intercepted, and then the loading permission file corresponding to the application to be started is used to load preprocessing for at least one view controller. In the embodiment of the present invention, the Hook technology can be used to intercept the loading. The Hook technology is also called the hook function. Before the system calls the function, the hook program first captures the message, and the hook function first obtains the control right. At this time, the hook function can process (change) the execution behavior of the function and can also force the end of the message transmission. In simple terms, it is to pull out the system program and turn it into our own execution code fragment. In the embodiment of the present invention, before at least one view controller is loaded, the Hook technology is used to intercept the loading of at least one view controller, that is, before calling the page loading code of the view controller, the hook program first captures this message, and the hook function can obtain control rights. At this time, the hook function can process (change) the loading behavior of the view controller, and at this time, the loading permission file corresponding to the application to be started can be used to pre-process the loading of at least one view controller. Among them, the loading permission file refers to the permission control file for the view controller, which can include the loading time of the view controller.

[0042] After the view controller is loaded and preprocessed, the loading time of each view controller corresponding to the application to be started is obtained, so that the page elements corresponding to each view controller can be loaded according to the loading time of each view controller to complete the startup of the application to be started.

[0043] For example, for the iOS system, the code execution process is to dynamically determine the function call at runtime during the running of the application. Therefore, the dynamic characteristics of the application development language can be used to dynamically change the correspondence between SEL (method number) and IMP (method implementation) (Method Swizzle). In this way, the necessary process of loading the view controller during the application startup process can be intercepted, and the loading time of the view controller can be set separately. For view controllers that are not loaded immediately, the loading is delayed, that is, the pages that do not need to be displayed to the user immediately are delayed. In this way, only the pages that need to be displayed immediately are loaded during the startup of the application, and other background pages are delayed in loading. In addition, the existing code can be optimized for the startup of the application without any changes.

[0044] In the application startup optimization method of the embodiment of the present invention, the Hook technology is used to intercept the loading of each view controller of the application to be started, and then the pre-created loading permission file is used to pre-process the loading of each view controller. In this way, each view controller can be loaded according to the loading pre-processing result, so as to achieve the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.

[0045] In the startup optimization method of the application in the embodiment of the present invention, intercepting the loading of the view controller is an important part. Among them, as a reference embodiment of the present invention, intercepting the loading of at least one view controller may include: using Hook technology to obtain the control authority of the life cycle method corresponding to at least one view controller to complete the loading interception of at least one view controller. Each view controller represents a page, so a page has its life cycle, such as the creation, completion, disappearance, and so on of the view. In the embodiment of the present invention, the Hook technology can be used to control the control authority of the life cycle method of each view controller, so that the loading interception of each view controller can be completed.

[0046] In an embodiment of the present invention, using Hook technology to obtain control authority over the lifecycle methods corresponding to at least one view controller may include: when at least one view controller is loaded, calling a preset code instead of calling the loading code corresponding to at least one view controller. That is to say, the loading code corresponding to at least one view controller is replaced by the preset code, so that when the loading code corresponding to at least one view controller is called, the preset code is used instead. For example, when the Hook technology is used to control the loading of the view controller, the loadView method and the viewDidLoad method are called, so that when the page corresponding to the view controller is loaded, the correct function is not called, but the preset code is called, so that special processing can be performed on the view controller that does not need to be displayed immediately, that is, the view controller is pre-processed for loading.

[0047] Among them, the loadView method is called when the view controller starts loading. This method is mainly used to create the view managed by the controller. However, if you want to perform any other initialization operations on the view, you should put it in the viewDidLoad method, and this method will not be called directly. Only when the view controller requests the corresponding view property and cannot obtain the view object (self.view = nil), this method will be called to load or create the corresponding view. Normally, when the view is loading, if the view controller has an associated nib file, this method will load the view directly from the nib file. If the view controller does not have an associated nib file, this method will create a blank object. The viewDidLoad method is called after the view is created and before it appears on the screen, that is, the view controller will call this method after loading its view hierarchy into memory, regardless of whether it is loaded from a nib file or loaded in the loadView method using code, and it will only be called once in a life cycle. You can also use this method to perform one-time initialization operations related to the view controller, but do not add any initialization information about the view geometry in this method. This is because when viewDidLoad is called, the view controller has not yet been displayed to the interface, and the view's boundaries have not yet been determined. If it is run on a different device, or in a different location, or rotated, then when it is displayed on the screen, it may not appear in the expected position.

[0048] In the startup optimization method of the application in the embodiment of the present invention, after the loading of the view controller is intercepted, the view controller can be pre-processed for loading, which is an important part of the startup optimization method of the application. Therefore, before using the loading permission file corresponding to the application to be started to pre-process at least one view controller for loading, a loading permission file corresponding to the application to be started can be created in advance. The created loading permission file is used to describe which view controllers require special processing, that is, to describe which view controllers require delayed loading, so it is possible to determine which view controller needs to be loaded immediately based on the loading permission file, that is, after receiving the startup request of the application to be started, the loading permission file is used to directly determine the page that needs to be displayed immediately. In addition, the loading permission file in the embodiment of the present invention can be a json file, that is, a lightweight data exchange and storage format.

[0049] The loading permission file of the embodiment of the present invention can record the names of view controllers that need special processing, that is, record the names of view controllers that need to be loaded lazily. In addition, in the embodiment of the present invention, the page corresponding to the view controller that needs to be loaded directly can be defaulted to be the page displayed to the user after the application is started. Generally, the homepage of the application needs to be displayed immediately, and other pages can be loaded lazily. Of course, other pages of the application may also need to be displayed immediately, which can be set according to actual conditions. The embodiment of the present invention is not limited to this, and the view controller that needs to be loaded lazily can be obtained according to the loading permission file.

[0050] As another reference embodiment of the present invention, using the loading permission file corresponding to the application to be started, loading preprocessing of at least one view controller can include: screening out view controllers that need to be delayed loaded and view controllers that need to be directly loaded from at least one view controller according to the loading permission file corresponding to the application to be started; obtaining the delayed loading time of the view controller that needs to be delayed loaded. Considering that not all view controllers need to be delayed loaded, the names of the view controllers that need to be delayed loaded are recorded in the loading permission file. Therefore, the loading preprocessing of the embodiment of the present invention can be to use the loading permission file to obtain the view controllers that need to be delayed loaded in at least one view controller, so that the remaining ones are the view controllers that need to be directly loaded. Of course, it is also necessary to obtain the loading time of these view controllers that need to be delayed loaded. Assume that the view controllers of the application A to be launched are A1, A2, A3 and A4, and the loading permission file corresponding to A contains the names of A2, A3 and A4, which means that A2, A3 and A4 need to be delayed loaded. A1 can be loaded directly, and the time when A2, A3 and A4 need to be delayed loaded is obtained, such as A2 is loaded after 0.5s, A3 is loaded after 0.8s, and A4 is loaded after 0.3s.

[0051] In an embodiment of the present invention, after loading preprocessing is performed, page elements corresponding to at least one view controller can be loaded according to the loading preprocessing result, which is specifically implemented as follows: directly calling the loading code corresponding to the view controller that needs to be directly loaded in at least one view controller to complete the loading of the page elements corresponding to the view controller that needs to be directly loaded; calling the loading code corresponding to the view controller that needs to be delayed loading according to the delayed loading time of the view controller that needs to be delayed loading to complete the loading of the page elements corresponding to the view controller that needs to be delayed loading.

[0052] For view controllers that need to be loaded directly, you can directly load the loading codes corresponding to these view controllers, so that you can complete the loading of page elements. After receiving the application's startup request, that is, after the user clicks the application's icon, you can immediately load the view controllers that need to be loaded directly, and display the pages corresponding to the view controllers that need to be loaded directly to the user.

[0053] For view controllers that need to be delayed loading, the loading codes of these view controllers that need to be delayed loading can be loaded according to the delayed loading time, so that the loading of page elements can be completed. After receiving the application's startup request, that is, after the user clicks the application's icon, the view controllers that need to be delayed loading are loaded according to the delayed loading time, so that the page corresponding to the view controller that needs to be delayed loading can be directly displayed to the user.

[0054] For example, in the method after Hook replacement, determine whether the current view controller is in the loading permission file. If not, directly call the original loading method viewDidLoad or loadView method). If it is in the loading permission file, perform a delayed operation, and asynchronously return to the main thread to call the original method after the delay.

[0055] It is worth noting that before using the loading permission file corresponding to the application to be started to perform loading preprocessing on at least one view controller, the startup optimization method of the application of the embodiment of the present invention may also include: loading the loading permission file corresponding to the application to be started into the memory; correspondingly, after loading the page element corresponding to at least one view controller according to the loading preprocessing result, the startup optimization method of the application of the embodiment of the present invention may also include: removing the loading permission file corresponding to the application to be started from the memory. After the application is loaded, the corresponding loading permission file is removed from the memory, and it can be loaded normally when creating other view controllers with the same name. For example, A2 of the view controller of the application A to be started is in the loading permission file. After A2 is loaded, A2 needs to be removed from the memory, so that when a view controller with the same name A2 is loaded, it can be loaded normally and will not be delayed.

[0056] Figure 2 FIG. 1 is a schematic diagram of the main process of the startup optimization method of an application according to an embodiment of the present invention. Figure 2 As shown, the main process of the application startup optimization method of the embodiment of the present invention may include:

[0057] Step S201, obtaining at least one view controller corresponding to the application to be started according to the application start request;

[0058] Step S202, when at least one view controller is being loaded, calling a preset code instead of calling a loading code corresponding to at least one view controller, so as to complete the loading interception of at least one view controller;

[0059] Step S203, pre-create a loading permission file corresponding to the application to be started, and load the loading permission file corresponding to the application to be started into the memory;

[0060] Step S204, filtering out view controllers that need to be deferred loaded and view controllers that need to be directly loaded from at least one view controller according to the loading permission file corresponding to the application to be started, and obtaining the deferred loading time of the view controllers that need to be deferred loaded;

[0061] Step S205, directly calling the loading code corresponding to the view controller that needs to be directly loaded in at least one view controller, and calling the loading code corresponding to the view controller that needs to be delayed loading according to the delayed loading time of the view controller that needs to be delayed loading, so as to complete the loading of the page element corresponding to the view controller;

[0062] Step S206: remove the loading permission file corresponding to the application to be started from the memory.

[0063] For ease of understanding, a shopping application is taken as an example to compare and illustrate the startup method of the application in the prior art with the startup method of the application of the present invention. The page of the application consists of four parts: home page, category, shopping cart and mine.

[0064] (1) In the existing application startup method, the four pages of home page, category, shopping cart, and my page are initialized immediately after startup. There are multiple network requests at the same time, and multiple data processing after the network returns, which will make it impossible to complete the startup quickly.

[0065] (2) The modification process of the startup method of the application of the embodiment of the present invention: the pages that need to be displayed immediately are recorded and stored by writing to a file or writing in the code (represented by data D). When the application is started, the display information of the page is loaded into the memory. After the application is started, the normal process will load and request the network for each page (such as home page, category, shopping cart, mine). Because the life cycle method of the page has been hooked, the pre-written code will be called, and then the page will be judged by data D whether it needs to be displayed immediately. If not, the subsequent process will be stopped and processed after a delay, thereby saving initialization time and speeding up the startup.

[0066] (3) Figure 3 is a schematic diagram of loading a view controller according to an embodiment of the present invention. Figure 3 As shown, the Tar Bar view controller manages four view controllers in the form of an array, namely, the home page, category, shopping cart and mine. It can also be seen that the home page is directly displayed to the user, so it is directly loaded and initialized. At this time, the other three pages are not processed. The other three pages are processed after the home page is processed. That is, the other three pages need to be loaded lazily, that is, the data stored in the loading permission file is the name of the view controller corresponding to the category, shopping cart, and mine. In the Hook method, the recorded category, shopping cart, and mine view controllers need to be delayed and waited for, and the data can be loaded later.

[0067] The technical solution for optimizing the startup of an application in an embodiment of the present invention can intercept the loading of each view controller of the application to be started, and then use a pre-created loading permission file to pre-process the loading of each view controller. In this way, each view controller can be loaded according to the loading pre-processing result, thereby achieving the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.

[0068] Figure 4FIG. 1 is a schematic diagram of the main modules of the application startup optimization device according to an embodiment of the present invention. Figure 4 As shown, the main modules of the application startup optimization device according to the embodiment of the present invention may include: an acquisition module 401 , a processing module 402 and a loading module 403 .

[0069] Among them, the acquisition module 401 can be used to obtain at least one view controller corresponding to the application to be started according to the application startup request; the processing module 402 can be used to intercept the loading of at least one view controller, and use the loading permission file corresponding to the application to be started to pre-process the loading of at least one view controller; the loading module 403 can be used to load the page elements corresponding to the at least one view controller according to the loading pre-processing results.

[0070] In the embodiment of the present invention, the processing module 402 may also be used to: when at least one view controller is being loaded, call a preset code instead of calling a loading code corresponding to at least one view controller to complete the loading interception of at least one view controller.

[0071] In an embodiment of the present invention, processing module 402 can also be used to: filter out view controllers that need to be delayed loaded and view controllers that need to be directly loaded from at least one view controller according to the loading permission file corresponding to the application to be started; obtain the delayed loading time of the view controller that needs to be delayed loaded.

[0072] In an embodiment of the present invention, the loading module 403 can also be used to: directly call the loading code corresponding to the view controller that needs to be directly loaded, so as to complete the loading of the page elements corresponding to the view controller that needs to be directly loaded; according to the delayed loading time of the view controller that needs to be delayed loading, call the loading code corresponding to the view controller that needs to be delayed loading, so as to complete the loading of the page elements corresponding to the view controller that needs to be delayed loading.

[0073] In the embodiment of the present invention, the processing module 402 may also be used to: load the loading permission file corresponding to the application to be started into the memory; and remove the loading permission file corresponding to the application to be started from the memory.

[0074] In the embodiment of the present invention, the processing module 402 may also be used to: pre-create a loading permission file corresponding to the application to be started.

[0075] From the above description, it can be seen that the startup optimization device of the application in the embodiment of the present invention can intercept the loading of each view controller of the application to be started, and then use the pre-created loading permission file to pre-process the loading of each view controller. In this way, each view controller can be loaded according to the loading pre-processing result, thereby achieving the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.

[0076] Figure 5 An exemplary system architecture 500 is shown to which the application startup optimization method or application startup optimization device according to the embodiment of the present invention can be applied.

[0077] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0078] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0079] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0080] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0081] It should be noted that the application startup optimization method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the application startup optimization device is generally set in the server 505 .

[0082] It should be understood that Figure 5The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0083] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0084] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0085] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0086] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0087] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0088] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0089] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module, a processing module and a loading module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the acquisition module may also be described as "a module for acquiring at least one view controller corresponding to the application to be started according to an application startup request".

[0090] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining at least one view controller corresponding to the application to be started according to the application start request; intercepting the loading of at least one view controller, and using the loading permission file corresponding to the application to be started to pre-process the loading of at least one view controller; and loading the page element corresponding to at least one view controller according to the loading pre-processing result.

[0091] According to the technical solution of the embodiment of the present invention, it is possible to intercept the loading of each view controller of the application to be launched, and then use the pre-created loading permission file to pre-process the loading of each view controller. In this way, each view controller can be loaded according to the loading pre-processing result, thereby achieving the effect of time-sharing loading of each view controller, avoiding the problem of long startup time caused by loading all view controllers at the same time in the prior art, reducing the startup time of the application and improving the user experience.

[0092] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for optimizing the startup of an application, characterized in that: include: According to the application startup request, at least one view controller corresponding to the application to be started is obtained; wherein the view controller refers to a controller that can display a page, an application includes one or more pages, and each page is equivalent to a controller; The loading of the at least one view controller is intercepted, and the loading preprocessing of the at least one view controller is performed using the loading permission file corresponding to the application to be started; wherein the loading interception of the at least one view controller includes: when the at least one view controller is loaded, calling a preset code instead of calling the loading code corresponding to the at least one view controller to complete the loading interception of the at least one view controller; According to the loading preprocessing result, the page element corresponding to the at least one view controller is loaded.

2. The method according to claim 1, characterized in that: The step of performing loading preprocessing on the at least one view controller by using the loading permission file corresponding to the application to be started includes: Filtering, from the at least one view controller, a view controller that needs to be lazily loaded and a view controller that needs to be directly loaded according to the loading permission file corresponding to the application to be started; Gets the delayed loading time of the view controller that needs to be delayed loading.

3. The method according to claim 2, characterized in that The step of loading the page element corresponding to the at least one view controller according to the loading preprocessing result includes: Directly call the loading code corresponding to the view controller that needs to be directly loaded to complete the loading of the page element corresponding to the view controller that needs to be directly loaded; According to the delayed loading time of the view controller that needs to be delayed loading, the loading code corresponding to the view controller that needs to be delayed loading is called to complete the loading of the page element corresponding to the view controller that needs to be delayed loading.

4. The method according to claim 1, characterized in that: Before performing load preprocessing on the at least one view controller using the load permission file corresponding to the application to be started, the method further includes: loading the load permission file corresponding to the application to be started into a memory; and After loading the page element corresponding to the at least one view controller according to the loading preprocessing result, the method further includes: removing the loading permission file corresponding to the application to be started from the memory.

5. The method according to claim 1, characterized in that Before performing loading preprocessing on the at least one view controller using the loading permission file corresponding to the application to be started, the method further includes: A loading permission file corresponding to the application to be started is created in advance.

6. A device for optimizing the startup of an application, characterized in that: include: An acquisition module is used to acquire at least one view controller corresponding to the application to be started according to the application start request; wherein the view controller refers to a controller that can display a page, an application includes one or more pages, and each page is equivalent to a controller; A processing module, used to intercept the loading of the at least one view controller, and perform loading preprocessing on the at least one view controller using the loading permission file corresponding to the application to be started; wherein the intercepting the loading of the at least one view controller includes: when the at least one view controller is loaded, calling a preset code instead of calling the loading code corresponding to the at least one view controller, so as to complete the interception of the loading of the at least one view controller; The loading module is used to load the page elements corresponding to the at least one view controller according to the loading preprocessing result.

7. The device according to claim 6, characterized in that The processing module is also used for: Filtering, from the at least one view controller, a view controller that needs to be lazily loaded and a view controller that needs to be directly loaded according to the loading permission file corresponding to the application to be started; Gets the delayed loading time of the view controller that needs to be delayed loading.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.