Method of starting and electronic device

CN122946018APending Publication Date: 2026-10-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510459985.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-11
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0003]应用程序的功能越丰富,应用程序冷启动时所需加载的资源就越多,相应地,应用程序的冷启动效率就越低

Benefits of technology

[0091]可以理解的是,上述第二方面至第八方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0005356811270000011
    Figure HDA0005356811270000011
  • Figure HDA0005356811270000012
    Figure HDA0005356811270000012
  • Figure HDA0005356811270000013
    Figure HDA0005356811270000013
Patent Text Reader

Abstract

This application provides a startup method and an electronic device, relating to the field of terminal technology. The method includes: cold-starting a target application in response to a first operation. During the cold start process, multiple first threads are started to traverse the dependencies of the target application in parallel. After traversing the dependencies of the target application, resource files of the target application are pre-read using a second thread. The technical solution provided by this application can improve the cold start efficiency of applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a startup method and an electronic device. Background Technology

[0002] With the continuous development of mobile phones, tablets and other terminal devices, more and more applications are installed on these devices, and in order to meet the different needs of users, the functions of various applications are becoming increasingly rich.

[0003] The more features an application has, the more resources it needs to load during a cold start, and consequently, the lower its cold start efficiency. Therefore, improving application cold start efficiency is a problem that urgently needs to be solved by those in the field. Summary of the Invention

[0004] In view of this, this application provides a startup method and an electronic device for improving the cold start efficiency of applications.

[0005] To achieve the above objectives, in a first aspect, embodiments of this application provide a startup method, including:

[0006] In response to the first action, the target application is cold-started;

[0007] During the cold start process, multiple first threads are started to iterate through the dependencies of the target application in parallel.

[0008] The startup method provided in this application embodiment can improve the efficiency of traversing the dependencies of the target application by using multiple threads in parallel during the cold start process of the target application, thereby improving the cold start efficiency of the target application.

[0009] In one possible implementation of the first aspect, the method further includes:

[0010] After traversing the dependencies of the target application, the resource files of the target application are pre-read using a second thread.

[0011] The above implementation method enables resource file pre-reading to be performed after dependency traversal, thereby avoiding CPU resource contention caused by simultaneous execution of resource file pre-reading and dependency traversal, and improving the cold start efficiency of the target application.

[0012] In one possible implementation of the first aspect, after traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread, including:

[0013] After the dependencies of the target application are traversed, the resource files of the target application are read in advance by a second thread.

[0014] Through the above implementation method, the resource files of the target application can be pre-read by the resource pre-reading thread after the dependency traversal of the target application is completed. This avoids the CPU resource contention caused by the simultaneous execution of resource file pre-reading and dependency traversal, thereby improving the cold start efficiency of the target application.

[0015] In one possible implementation of the first aspect, after traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread, including:

[0016] After a preset time has elapsed through the dependencies of the target application, the resource files of the target application are pre-read using a second thread.

[0017] Through the above implementation method, when the dependency traversal time is long, the resource files of the target application can be read into the cache in advance through the second thread. When the resource files are needed, they can be accessed directly from the cache, thereby improving the access speed of resource files and speeding up the efficiency of cold start.

[0018] In one possible implementation of the first aspect, the second thread is a resource prefetching thread, which prefetches the resource files of the target application, including:

[0019] The main thread of the target application sends the target message to the resource prefetching thread;

[0020] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0021] In one possible implementation of the first aspect, if the CPU utilization is higher than the target threshold, the resource files of the target application are pre-read by a second thread after traversing the dependencies of the target application.

[0022] Through the above implementation method, under high CPU utilization, during the cold start process, after traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread. This achieves staggered execution of dependency traversal and resource file pre-reading, avoiding the competition for CPU resources caused by simultaneous execution of resource file pre-reading and dependency traversal when CPU utilization is high, thereby improving the cold start efficiency of the target application.

[0023] In one possible implementation of the first aspect, the method further includes: when CPU utilization is below or equal to a target threshold, during the cold start process, simultaneously performing a process of traversing the dependencies of the target application and a process of pre-reading the resource files of the target application.

[0024] The above implementation method enables parallel execution of dependency traversal and pre-fetching of resource files even when CPU utilization is low, making full use of CPU resources and further improving the cold start efficiency of the target application.

[0025] In one possible implementation of the first aspect, the resource file includes at least one of the following: .so file, .jar package, and image resources.

[0026] In one possible implementation of the first aspect, dependencies include dependency classes and dependency methods, and the dependencies of the target application are traversed in parallel, including at least one of the following:

[0027] The dependent classes of the target application are traversed in parallel.

[0028] The dependent methods of the target application are traversed in parallel.

[0029] The methods in the dependent classes of the target application are traversed in parallel.

[0030] By traversing the target application's dependency classes in parallel, the efficiency of traversing these classes can be improved, thereby increasing the efficiency of traversing dependencies and ultimately enhancing the cold start efficiency of the target application. Similarly, by traversing the target application's dependency methods in parallel, the efficiency of traversing those methods can be improved, further enhancing the cold start efficiency of the target application. Finally, by traversing each method within a target application's dependency class in parallel, the efficiency of traversing its dependencies can be further enhanced, ultimately improving the cold start efficiency of the target application.

[0031] Secondly, embodiments of this application provide a starting device, comprising:

[0032] The startup module is used to cold start the target application in response to the first operation;

[0033] The traversal module is used to start multiple first threads during the cold start process to traverse the dependencies of the target application in parallel.

[0034] In one possible implementation of the second aspect, the apparatus further includes a pre-read module for pre-reading the resource files of the target application via a second thread after traversing the dependencies of the target application.

[0035] In one possible implementation of the second aspect, the prefetch module is specifically used to: read the resource files of the target application in advance via a second thread after the traversal of the dependencies of the target application is completed.

[0036] In one possible implementation of the second aspect, the pre-read module is specifically used to: read the resource files of the target application in advance through a second thread after a preset time for traversing the dependencies of the target application.

[0037] In one possible implementation of the second aspect, the second thread is a resource prefetching thread, and the prefetching module is specifically used for:

[0038] The target message is sent to the resource prefetching thread via the main thread corresponding to the target application.

[0039] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0040] In one possible implementation of the second aspect, the pre-read module is specifically used for:

[0041] If CPU utilization exceeds the target threshold, the resource files of the target application are pre-read using a second thread after traversing the dependencies of the target application.

[0042] In one possible implementation of the second aspect, the pre-read module is further configured to:

[0043] When CPU utilization is below or equal to the target threshold, during the cold start process, the process of traversing the dependencies of the target application and the process of pre-reading the resource files of the target application are executed simultaneously.

[0044] In one possible implementation of the second aspect, the resource file includes at least one of the following: .so file, .jar package, and image resources.

[0045] In one possible implementation of the second aspect, the traversal module is specifically used for:

[0046] The dependent classes of the target application are traversed in parallel.

[0047] The dependent methods of the target application are traversed in parallel.

[0048] The methods in the dependent classes of the target application are traversed in parallel.

[0049] Thirdly, embodiments of this application provide a startup method, including:

[0050] In response to the first action, the target application is cold-started;

[0051] During the cold start process, after the first thread iterates through the dependencies of the target application, the second thread reads the resource files of the target application in advance.

[0052] In one possible implementation of the third aspect, traversing the dependencies of the target application via a first thread includes:

[0053] Multiple first threads are started to iterate through the dependencies of the target application in parallel.

[0054] In one possible implementation of the third aspect, after the first thread traverses the dependencies of the target application, the second thread pre-reads the resource files of the target application, including:

[0055] After the first thread completes the traversal of the target application's dependencies, the second thread pre-reads the target application's resource files.

[0056] In one possible implementation of the third aspect, after the first thread traverses the dependencies of the target application, the second thread pre-reads the resource files of the target application, including:

[0057] After the first thread iterates through the dependencies of the target application for a preset time, the second thread reads the resource files of the target application in advance.

[0058] In one possible implementation of the third aspect, the second thread is a resource prefetching thread, which prefetches the resource files of the target application, including:

[0059] The main thread of the target application sends the target message to the resource prefetching thread;

[0060] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0061] In one possible implementation of the third aspect, if the CPU utilization is higher than the target threshold, the resource files of the target application are pre-read by a second thread after traversing the dependencies of the target application.

[0062] In one possible implementation of the third aspect, dependencies include dependency classes and dependency methods, and the dependencies of the target application are traversed in parallel, including at least one of the following:

[0063] The dependent classes of the target application are traversed in parallel.

[0064] The dependent methods of the target application are traversed in parallel.

[0065] The methods in the dependent classes of the target application are traversed in parallel.

[0066] In one possible implementation of the third aspect, the resource file includes at least one of the following: .so file, .jar package, and image resources.

[0067] Fourthly, embodiments of this application provide a starting device, comprising:

[0068] The startup module is used to cold start the target application in response to the first operation;

[0069] The traversal module is used to traverse the dependencies of the target application using the first thread during the cold start process;

[0070] The prefetch module is used to prefetch the resource files of the target application through a second thread after the traversal module has traversed the dependencies of the target application through the first thread.

[0071] In one possible implementation of the fourth aspect, the traversal module is specifically used for:

[0072] Multiple first threads are started to iterate through the dependencies of the target application in parallel.

[0073] In one possible implementation of the fourth aspect, the traversal module is specifically used for:

[0074] The dependent classes of the target application are traversed in parallel.

[0075] The dependent methods of the target application are traversed in parallel.

[0076] The methods in the dependent classes of the target application are traversed in parallel.

[0077] In one possible implementation of the fourth aspect, the pre-read module is specifically used for:

[0078] After the first thread completes the traversal of the target application's dependencies, the second thread pre-reads the target application's resource files.

[0079] In one possible implementation of the fourth aspect, the pre-read module is specifically used for:

[0080] After the first thread iterates through the dependencies of the target application for a preset time, the second thread reads the resource files of the target application in advance.

[0081] In one possible implementation of the fourth aspect, the pre-read module is specifically used for:

[0082] The target message is sent to the resource prefetching thread via the main thread corresponding to the target application.

[0083] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0084] In one possible implementation of the fourth aspect, the pre-read module is specifically used for:

[0085] If CPU utilization exceeds the target threshold, the resource files of the target application are pre-read using a second thread after traversing the dependencies of the target application.

[0086] In one possible implementation of the fourth aspect, the resource file includes at least one of the following: .so file, .jar package, and image resources.

[0087] Fifthly, embodiments of this application provide an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the method described in any of the embodiments of the first or third aspect above when the computer program is invoked.

[0088] In a sixth aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the embodiments of the first or third aspect described above.

[0089] In a seventh aspect, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to perform the method described in any of the embodiments of the first or third aspect described above.

[0090] Eighthly, embodiments of this application provide a chip system including a processor coupled to a memory. The processor executes a computer program stored in the memory to implement the method described in any of the embodiments of the first or third aspects. The chip system may be a single chip or a chip module composed of multiple chips.

[0091] It is understood that the beneficial effects of aspects two through eight above can be found in the relevant descriptions in aspect one above, and will not be repeated here. Attached Figure Description

[0092] Figure 1 A schematic diagram illustrating the application cold start process provided in this application embodiment;

[0093] Figure 2 A flowchart illustrating the startup method provided in an embodiment of this application;

[0094] Figures 3-6 A schematic diagram illustrating the specific steps of the startup method provided in the embodiments of this application;

[0095] Figure 7 This is a schematic diagram of the structure of a starting device provided in an embodiment of this application;

[0096] Figure 8 This is a schematic diagram of another starting device provided in an embodiment of this application;

[0097] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0098] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments and is not intended to limit the application. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0099] To meet diverse user needs, applications installed on mobile phones, tablets, and other terminal devices are becoming increasingly feature-rich. The more feature-rich an application is, the more resources it needs to load during a cold start, and consequently, the lower its cold start efficiency.

[0100] When an application cold starts, it first loads the resources required for the cold start. After loading is complete, it enters the application's initial interface. Currently, applications need to perform a series of operations during the cold start process, all of which are done on the main thread. This does not effectively utilize the performance of current multi-core central processing units (CPUs), and the entire process typically takes several seconds or even tens of seconds, resulting in low application startup efficiency.

[0101] like Figure 1 As shown, the application's cold start process can include process initialization, binary code loading, lifecycle initialization, business logic loading, and homepage rendering. The binary code loading process is particularly time-consuming, and it can include dependency traversal, loading of .so files, and execution of .ets files. The entire application cold start process is executed via a single thread, resulting in low efficiency.

[0102] Process initialization can be used to create application processes, allocate memory and basic resources, etc.

[0103] Binary code loading can include dependency traversal, .so file loading, and .ets file execution. Dependency traversal ensures that the application loads and initializes all necessary components correctly and in an orderly manner. .so file loading refers to the process of loading and using .so files during a cold start, primarily to meet the initialization requirements of the application's core functionality. .ets files can contain the application's UI layout definitions, style settings, event interaction logic, and page business logic. Executing the .ets file during a cold start ensures that the user interface is correctly rendered and responds to subsequent user interactions.

[0104] Lifecycle initialization is primarily used to initiate the lifecycle and execute corresponding lifecycle callbacks. Business logic loading is mainly used to request and process network data according to business needs. Both lifecycle initialization and business logic loading processes require the use of corresponding JAR packages and other resource files.

[0105] Homepage rendering is mainly used for loading homepage content, measuring layout, refreshing components and rendering, etc. The homepage rendering process requires the use of resource files such as images.

[0106] Understandable, Figure 1 The cold start process shown is just one example; in other examples, the application's cold start process may include more... Figure 1 The embodiments of this application will subsequently describe the application's cold start process, with more or fewer steps as shown. Figure 1 The following example is used to illustrate the point.

[0107] When using resource files such as JAR files and images, it is usually necessary to read the resource files from their storage location based on their storage path. However, resource files are typically stored on the hard drive or flash memory of electronic devices. Reading resource files requires creating corresponding I / O (input / output) streams, which slows down the reading speed and results in low cold start efficiency for applications.

[0108] To improve application cold start efficiency, one approach is to pre-load application resource files (such as JAR files and images) into a cache using a new thread during the cold start process. When these resource files are needed, they can be read directly from the cache. This method of directly reading resource files from the cache does not require creating corresponding I / O streams, thus improving resource file reading speed and accelerating the cold start process.

[0109] However, if resource file prefetching and code binary loading occur simultaneously, these two processes will preempt CPU resources, making the code binary loading process longer and resulting in a smaller improvement in cold start efficiency.

[0110] To address this, this application provides a startup method that, during the cold start of a target application, launches multiple first threads (including a main thread and child threads) to traverse the target application's dependencies in parallel. This allows for parallel traversal of the target application's dependencies (such as dependent classes and methods) through multiple threads, thereby improving the efficiency of dependency traversal, enhancing binary code loading efficiency, and ultimately improving the cold start efficiency of the target application.

[0111] Additionally, after traversing the dependencies of the target application, a second thread (such as a resource prefetching thread) can be used to prefetch the target application's resource files. This allows the traversal of the target application's dependencies and the prefetching of the target application's resource files to be executed at different times, ensuring that resource file prefetching is performed after dependency traversal, thus avoiding CPU resource contention caused by simultaneous execution of resource file prefetching and dependency traversal.

[0112] Dependency traversal is the main process in binary code loading, consuming significant CPU resources and time. Subsequent processes (such as loading .so files and executing .ets files) consume only a small amount of CPU resources and take less time. Even if these subsequent processes and resource file pre-fetching (i.e., pre-reading resource files) execute concurrently, as long as resource file pre-fetching doesn't consume all CPU resources, the subsequent processes can still be completed using minimal CPU resources in a short time. Therefore, the impact of resource file pre-fetching on binary code loading is minimal. This approach significantly reduces the impact of simultaneous resource file pre-fetching and binary code loading on binary code loading efficiency, improving the cold start efficiency of the target application.

[0113] The startup method provided in this application can be applied to electronic devices, such as personal computers (PCs), smartphones, netbooks, tablets, and handheld computers.

[0114] The operating system of electronic devices can be HarmonyOS, Android, Apple OS, etc.

[0115] Figure 2 A flowchart illustrating the startup method provided in this application embodiment is shown below. Figure 2 As shown, the startup method provided in this application embodiment may include the following steps:

[0116] S110, in response to the first operation, cold start the target application.

[0117] The first operation can be a button operation, a touch operation, a voice control operation, or an air gesture operation, etc. Among them, the touch operation can be a click operation or a gesture operation, etc., and this application embodiment does not particularly limit it.

[0118] The naming conventions for user input operations in this application are merely examples and should not be construed as limiting the scope of this application. In some embodiments, the same operations may use other names.

[0119] The target application can be any application on an electronic device, and this application does not impose any particular limitation on it.

[0120] S120. During the cold start process, multiple first threads are started to traverse the dependencies of the target application in parallel.

[0121] The first thread can include the main thread and child threads corresponding to the target application. There can be one main thread and one or more child threads.

[0122] For example, such as Figure 3 As shown, the first thread consists of one main thread and two child threads (namely, child thread 1 and child thread 2). After the process corresponding to the target application is initialized, the main thread, child thread 1, and child thread 2 traverse the dependencies of the target application in parallel.

[0123] The dependencies of the target application can include dependency classes and dependency methods.

[0124] Electronic devices can launch multiple threads to iterate over the dependent classes of a target application in parallel, thereby improving the efficiency of iterating over the target application's dependent classes. Electronic devices can also launch multiple threads to iterate over the dependent methods of a target application in parallel, thereby improving the efficiency of iterating over the dependent methods of a target application. In some embodiments, electronic devices can also launch multiple threads to iterate over both the dependent classes and dependent methods of the target application in parallel.

[0125] Since dependency classes typically include multiple methods, especially large dependency classes which may contain dozens or even hundreds of methods, in some embodiments, electronic devices can also start multiple threads to traverse the methods in the target application's dependency classes in parallel. This can further improve the efficiency of traversing the target application's dependency classes, thereby improving the efficiency of traversing the target application's dependencies and ultimately enhancing the cold start efficiency of the target application.

[0126] S130. After traversing the dependencies of the target application, the resource files of the target application are read in advance by a second thread.

[0127] The second thread can be a resource prefetching thread or another thread. The target application's resource files can include .so files, .jar files, image resources, etc.

[0128] In some embodiments, the target application's resource files can be pre-read using a second thread after the dependency traversal of the target application is complete. This allows resource file pre-reading to be performed after dependency traversal is complete, thereby avoiding CPU resource contention caused by simultaneous resource file pre-reading and dependency traversal.

[0129] For example, such as Figure 4 As shown, after the main thread, child thread 1, and child thread 2 of the target application have completed the traversal of the dependencies of the target application in parallel, the main thread can send a target message to the resource prefetching thread. Upon receiving the target message, the resource prefetching thread can prefetch the resource files of the target application.

[0130] Since traversing dependencies is the main process of binary code loading, even if subsequent processes of binary code loading (such as loading .so files) and resource file prefetching are executed simultaneously, the impact of resource file prefetching on binary code loading is very small. This can greatly reduce the impact of resource file prefetching and binary code loading on binary code loading efficiency when they are executed simultaneously, and improve the cold start efficiency of the target application.

[0131] In some embodiments, it may also be as follows Figure 5 As shown, after the .so file is loaded, the resource files of the target application are pre-read. This can stagger the loading of the .so file and the pre-reading of the target application's resource files, further reducing the impact of resource file pre-reading on the binary loading of the code and improving the cold start efficiency of the target application.

[0132] In some embodiments, it may also be as follows Figure 6 As shown, after the ets file is executed, the target application's resource files are pre-read. This allows for staggered execution of the ets file and pre-reading of the target application's resource files, effectively staggering the execution of binary code loading and resource file pre-reading. This avoids the impact of resource file pre-reading on binary code loading and further improves the cold start efficiency of the target application.

[0133] In some embodiments, when traversing the dependencies of the target application begins, a timer or similar method can be used to time the process. After a preset duration (e.g., 1 second, 1.5 seconds, etc.), a second thread pre-reads the resource files of the target application. This way, if the dependency traversal takes a long time, the resource files of the target application can be pre-read into the cache by the second thread, avoiding excessive waiting time during the pre-reading process and ensuring that the resource files are read into the cache promptly. Therefore, when the resource files are needed subsequently, they have already been pre-read into the cache, allowing direct access to the resource files from the cache, improving resource file access speed and accelerating cold start efficiency.

[0134] In some embodiments, the current CPU utilization can be detected during the cold start process. If the CPU utilization is higher than a target threshold (e.g., 50%, 70%), the resource files of the target application can be pre-read using a second thread after traversing the dependencies of the target application. This allows for staggered execution of dependency traversal and resource file pre-reading during the cold start process when CPU utilization is high. This ensures that the resource file pre-reading process is executed after dependency traversal, avoiding CPU resource contention caused by simultaneous resource file pre-reading and dependency traversal when CPU utilization is high, thereby improving the cold start efficiency of the target application.

[0135] If CPU utilization is below or equal to the target threshold, the two processes mentioned above (i.e., traversing the dependencies of the target application and pre-reading the resource files of the target application) can be executed in parallel during the cold start process. This allows for the parallel execution of dependency traversal and resource file pre-reading even when CPU utilization is low, making full use of CPU resources and further improving the cold start efficiency of the target application.

[0136] The startup method provided in this application embodiment can start multiple first threads during the cold start process of the target application to traverse the dependencies of the target application in parallel. This improves the efficiency of dependency traversal, enhances binary code loading efficiency, and ultimately improves the cold start efficiency of the target application by using multiple threads to traverse the dependencies of the target application in parallel.

[0137] Furthermore, after traversing the dependencies of the target application, this method can also pre-read the target application's resource files using a second thread. This allows the traversal of the target application's dependencies and the pre-reading of the target application's resource files to be executed at different times. This ensures that the resource file pre-reading is performed after the dependency traversal, thereby avoiding CPU resource contention caused by the simultaneous execution of resource file pre-reading and dependency traversal, and improving the cold start efficiency of the target application.

[0138] Those skilled in the art will understand that the above embodiments are exemplary and not intended to limit this application. Where possible, one or more of the above steps can be selectively combined to obtain one or more other embodiments. For example, in some embodiments, step S120 may be omitted, and in some embodiments, step S130 may be omitted. Those skilled in the art can arbitrarily select and combine the above steps as needed, and all combinations that do not depart from the essence of this application fall within the protection scope of this application.

[0139] Based on the same concept, as an implementation of the above method, this application provides a starting device. This device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspondingly implement all the contents of the aforementioned method embodiment.

[0140] Figure 7 This is a schematic diagram of the structure of a starting device provided in an embodiment of this application, as shown below. Figure 7 As shown, the apparatus provided in this embodiment may include:

[0141] Startup module 210 is used to cold start the target application in response to the first operation;

[0142] Traversal module 220 is used to start multiple first threads during the cold start process to traverse the dependencies of the target application in parallel.

[0143] As an optional implementation, the device also includes a pre-read module 230 for pre-reading the resource files of the target application via a second thread after traversing the dependencies of the target application.

[0144] As an optional implementation, the pre-read module 230 is specifically used to: read the resource files of the target application in advance through a second thread after the traversal of the dependencies of the target application is completed.

[0145] As an optional implementation, the pre-read module 230 is specifically used to: read the resource files of the target application in advance through a second thread after a preset time for traversing the dependencies of the target application.

[0146] As an optional implementation, the second thread is a resource prefetching thread, and the prefetching module 230 is specifically used for:

[0147] The target message is sent to the resource prefetching thread via the main thread corresponding to the target application.

[0148] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0149] As an optional implementation, the pre-read module 230 is specifically used for:

[0150] If CPU utilization exceeds the target threshold, the resource files of the target application are pre-read using a second thread after traversing the dependencies of the target application.

[0151] As an optional implementation, the pre-read module 230 is also used for:

[0152] When CPU utilization is below or equal to the target threshold, during the cold start process, the process of traversing the dependencies of the target application and the process of pre-reading the resource files of the target application are executed simultaneously.

[0153] As an optional implementation, the source files include at least one of the following: .so files, .jar packages, and image resources.

[0154] As an optional implementation, the traversal module 220 is specifically used for:

[0155] The dependent classes of the target application are traversed in parallel.

[0156] The dependent methods of the target application are traversed in parallel.

[0157] The methods in the dependent classes of the target application are traversed in parallel.

[0158] The device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described again here.

[0159] Based on the same concept, as an implementation of the above method, this application provides another starting device. This device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can implement all the contents of the aforementioned method embodiment.

[0160] Figure 8 This is a schematic diagram of another starting device provided in an embodiment of this application, as shown below. Figure 8 As shown, the apparatus provided in this embodiment may include:

[0161] The startup module 310 is used to cold start the target application in response to the first operation;

[0162] Traversal module 320 is used to traverse the dependencies of the target application through the first thread during the cold start process;

[0163] The pre-read module 330 is used to pre-read the resource files of the target application through the second thread after the traversal module 320 traverses the dependencies of the target application through the first thread.

[0164] As an optional implementation, the traversal module 320 is specifically used for:

[0165] Multiple first threads are started to iterate through the dependencies of the target application in parallel.

[0166] As an optional implementation, the traversal module 320 is specifically used for:

[0167] The dependent classes of the target application are traversed in parallel.

[0168] The dependent methods of the target application are traversed in parallel.

[0169] The methods in the dependent classes of the target application are traversed in parallel.

[0170] As an optional implementation, the pre-read module 330 is specifically used for:

[0171] After the first thread completes the traversal of the target application's dependencies, the second thread pre-reads the target application's resource files.

[0172] As an optional implementation, the pre-read module 330 is specifically used for:

[0173] After the first thread iterates through the dependencies of the target application for a preset time, the second thread reads the resource files of the target application in advance.

[0174] As an optional implementation, the pre-read module 330 is specifically used for:

[0175] The target message is sent to the resource prefetching thread via the main thread corresponding to the target application.

[0176] Upon receiving a target message, the resource prefetching thread prefetches the target application's resource files.

[0177] As an optional implementation, the pre-read module 330 is specifically used for:

[0178] If CPU utilization exceeds the target threshold, the resource files of the target application are pre-read using a second thread after traversing the dependencies of the target application.

[0179] As an optional implementation, the resource files include at least one of the following: .so files, .jar packages, and image resources.

[0180] The device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described again here.

[0181] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0182] Based on the same concept, embodiments of this application also provide an electronic device. Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 9 As shown, the electronic device provided in this application embodiment may include: a memory 410 and a processor 420. The memory 410 is used to store computer programs; the processor 420 is used to implement the method described in the above method embodiment when the computer program is invoked.

[0183] The electronic device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, so they will not be described again here.

[0184] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the methods described in the above-described method embodiments.

[0185] This application also provides a computer program product that, when run on an electronic device, causes the electronic device to implement the method described in the above-described method embodiments.

[0186] This application also provides a chip system including a processor coupled to a memory. The processor executes a computer program stored in the memory to implement the method described in the above-described method embodiments. The chip system may be a single chip or a chip module composed of multiple chips.

[0187] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, or magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0188] Those skilled in the art will understand that implementing all or part of the processes in the above embodiments can be accomplished by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium can include various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0189] The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effect can be achieved.

[0190] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0191] In the embodiments provided in this application, it should be understood that the disclosed apparatus / devices and methods can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0192] It should be understood that in the description of this application and the appended claims, the terms "comprising," "including," "having," and any variations thereof are intended to cover a non-exclusive inclusion and mean "including but not limited to," unless otherwise specifically emphasized. For example, a process, method, system, product, or apparatus that includes a series of steps or modules is not necessarily limited to those steps or modules that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such process, method, product, or apparatus.

[0193] In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. "And / or" in this application is used to describe the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural.

[0194] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0195] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0196] Furthermore, in the description of this application and the appended claims, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein; features defined as "first" or "second" may explicitly or implicitly include at least one of those features.

[0197] In the embodiments described in this application specification, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application specification should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.

[0198] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this specification include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in still other embodiments" appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A startup method, characterized in that, include: In response to the first action, the target application is cold-started; During the cold start process, multiple first threads are started to traverse the dependencies of the target application in parallel.

2. The method according to claim 1, characterized in that, The method further includes: After traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread.

3. The method according to claim 2, characterized in that, The step of pre-reading the resource files of the target application through a second thread after traversing the dependencies of the target application includes: After the dependencies of the target application are traversed, the resource files of the target application are read in advance by the second thread.

4. The method according to claim 2, characterized in that, The step of pre-reading the resource files of the target application through a second thread after traversing the dependencies of the target application includes: After a preset time has elapsed during the traversal of the target application's dependencies, the second thread pre-reads the target application's resource files.

5. The method according to any one of claims 2-4, characterized in that, The second thread is a resource pre-reading thread. The step of pre-reading the resource files of the target application through the second thread includes: The main thread corresponding to the target application sends the target message to the resource prefetching thread; Upon receiving the target message, the resource prefetching thread prefetches the resource files of the target application.

6. The method according to any one of claims 2-5, characterized in that, If the CPU utilization is higher than the target threshold, after traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread.

7. The method according to claim 1, characterized in that, The method further includes: when the CPU utilization is lower than or equal to the target threshold, during the cold start process, simultaneously performing a process of traversing the dependencies of the target application and a process of pre-reading the resource files of the target application.

8. The method according to any one of claims 2-7, characterized in that, The resource files include at least one of the following: .so files, .jar packages, and image resources.

9. The method according to any one of claims 1-8, characterized in that, The dependencies include dependency classes and dependency methods, and the parallel traversal of the dependencies of the target application includes at least one of the following: The dependency classes of the target application are traversed in parallel. The dependent methods of the target application are traversed in parallel. The methods in the dependent classes of the target application are traversed in parallel.

10. A startup method, characterized in that, include: In response to the first action, the target application is cold-started; During the cold start process, after the first thread traverses the dependencies of the target application, the second thread reads the resource files of the target application in advance.

11. The method according to claim 10, characterized in that, The step of traversing the dependencies of the target application through the first thread includes: Multiple first threads are started to iterate through the dependencies of the target application in parallel.

12. The method according to claim 11, characterized in that, The dependencies include dependency classes and dependency methods, and the parallel traversal of the dependencies of the target application includes at least one of the following: The dependency classes of the target application are traversed in parallel. The dependent methods of the target application are traversed in parallel. The methods in the dependent classes of the target application are traversed in parallel.

13. The method according to any one of claims 10-12, characterized in that, After traversing the dependencies of the target application through the first thread, the resource files of the target application are pre-read through the second thread, including: After the first thread completes the traversal of the dependencies of the target application, the second thread pre-reads the resource files of the target application.

14. The method according to any one of claims 10-12, characterized in that, After traversing the dependencies of the target application through the first thread, the resource files of the target application are pre-read through the second thread, including: After the first thread iterates through the dependencies of the target application for a preset time, the second thread reads the resource files of the target application in advance.

15. The method according to any one of claims 10-14, characterized in that, The second thread is a resource pre-reading thread. The step of pre-reading the resource files of the target application through the second thread includes: The main thread corresponding to the target application sends the target message to the resource prefetching thread; Upon receiving the target message, the resource prefetching thread prefetches the resource files of the target application.

16. The method according to any one of claims 10-15, characterized in that, If the CPU utilization is higher than the target threshold, after traversing the dependencies of the target application, the resource files of the target application are pre-read by a second thread.

17. The method according to any one of claims 10-16, characterized in that, The resource files include at least one of the following: .so files, .jar packages, and image resources.

18. An electronic device, characterized in that, include: A memory and a processor, the memory being used to store a computer program; the processor being used to execute the method as described in any one of claims 1-17 when the computer program is invoked.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-17.

20. A computer program product, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-17.

21. A chip system, characterized in that, The chip system includes a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the method as described in any one of claims 1-17.