CN110673887A - Application program starting method and device, terminal equipment and readable storage medium - Google Patents

Application program starting method and device, terminal equipment and readable storage medium Download PDF

Info

Publication number
CN110673887A
CN110673887A CN201910755141.7A CN201910755141A CN110673887A CN 110673887 A CN110673887 A CN 110673887A CN 201910755141 A CN201910755141 A CN 201910755141A CN 110673887 A CN110673887 A CN 110673887A
Authority
CN
China
Prior art keywords
target application
objects
hot
starting
initialization
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910755141.7A
Other languages
Chinese (zh)
Other versions
CN110673887B (en
Inventor
钱夏欢
安光霖
任玉林
陈鼐
张超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201910755141.7A priority Critical patent/CN110673887B/en
Publication of CN110673887A publication Critical patent/CN110673887A/en
Priority to PCT/CN2020/107644 priority patent/WO2021027700A1/en
Application granted granted Critical
Publication of CN110673887B publication Critical patent/CN110673887B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides an application program starting method, an application program starting device, terminal equipment and a readable storage medium, wherein the method comprises the following steps: receiving an instruction for starting the target application, after receiving the instruction, carrying out batch initialization on the hot object in the starting stage of the target application according to the information of the hot object in the starting stage of the target application, and starting the target application based on the hot object which is initialized in batch. The method can avoid extra time consumption caused by initializing before calling a first object each time, thereby greatly saving the time consumption of the starting process of the target APP.

Description

Application program starting method and device, terminal equipment and readable storage medium
Technical Field
The embodiment of the application relates to an intelligent terminal technology, in particular to an application program starting method and device, terminal equipment and a readable storage medium.
Background
With the continuous development of mobile internet technologies and mobile terminals such as mobile phones, various services using the mobile internet by using the mobile terminals become more and more preferred by multiple users. The evaluation result of the user on the mobile terminal is an important index for measuring the user experience. The evaluation result of the user on the mobile terminal can comprise evaluation results of various evaluation dimensions, and the evaluation dimensions can comprise appearance, performance, photographing capability, screen display effect and the like. As more and more users choose to use the mobile terminal to use the service of the mobile internet, the users may install various Applications (APPs) on the mobile terminal, and the cold start performance of the APP is an important item in the performance evaluation dimension, so that the improvement of the cold start performance of the APP is an important means for improving the evaluation result of the users on the mobile terminal. The cold start performance of the APP is the time consumed from the time when the user clicks the APP icon to the time when the APP interface loading is completed when the APP process is not created.
In the prior art, an APP cold start method is proposed, after a user clicks an APP icon, a system service (system _ server) process sends a message to a fertilized egg (zygate) process, notifies the zygate process to inoculate a sub-process as a main process of the APP, further executes a main (main) function of an active thread (ActivityThread) in the main thread of the main process, and creates a default class loader (ClassLoader). In addition, in the initialization process, class initialization (class initialization) methods are executed by the main thread for multiple times to initialize classes required to be used in the APP starting process. However, the prior art method makes the APP start time longer, resulting in poor cold start performance of APP.
Disclosure of Invention
The embodiment of the application provides an application program starting method and device, terminal equipment and a readable storage medium, and the application program starting method and device are used for reducing APP starting time and improving APP cold starting performance.
In a first aspect, an embodiment of the present application provides an application program starting method, where the method includes: receiving an instruction for starting the target application, after receiving the instruction, carrying out batch initialization on the hot object in the starting stage of the target application according to the information of the hot object in the starting stage of the target application, and starting the target application based on the hot object which is initialized in batch.
In the method, because the target APP contains the information of the hot object in the starting stage in advance, the terminal device can perform batch initialization on the object which needs to be called in the starting stage of the target APP in the hot object based on the information, so that extra time consumption caused by the fact that initialization is performed first before a first object is called each time is avoided, and time consumption of the starting process of the target APP is greatly saved. Meanwhile, the objects which do not belong to the hot objects and need to be called by the class initialization method in the APP starting stage are not initialized in batch, unnecessary initialization of the objects which are not the hot objects can be avoided, and new time consumption is avoided.
In a possible implementation manner, the information of the hot object in the starting phase of the target application may include: whether the hot object belongs to the object called by the class initialization method. When the information of the hot object includes whether the hot object belongs to an object called by the class initialization method, and the terminal device performs batch initialization on the hot objects in the starting stage of the target application according to the information of the hot objects in the starting stage of the target application, the following processes can be performed:
the method comprises the steps of obtaining a plurality of first objects which belong to the hot objects in the starting stage of the target application and are called by a class initialization method, and carrying out batch initialization on the plurality of first objects.
In the method, objects which belong to the hot object and are called by the class initialization method may be frequently called when the target APP is started, and the objects are initialized in batch, so that the batch initialization is stronger in pertinence and higher in efficiency.
In a possible implementation manner, when performing batch initialization on the plurality of first objects, the operating system may be instructed to perform batch initialization on the plurality of first objects when one of the plurality of first objects is called for the first time by using the class initialization method.
In a possible implementation manner, before performing batch initialization on the hotspot objects in the starting phase of the target application according to the information of the hotspot objects in the starting phase of the target application, creating a second object and initializing the running environment information of the target application may be performed in parallel first. The second object is used for loading the first object and a third object, and the third object is an object which is called by a class initialization method in the starting stage of the target application and does not belong to the hot object.
In the method, the creation of the second object and the initialization of the running environment information of the target application are executed in parallel, so that the time consumption of APP cold start can be further reduced, and the APP cold start performance is greatly improved.
In one possible implementation, after receiving an indication to start a target application, a main thread of the target application may be created in a main process of the target application, and a sub-thread may be created by the main thread, the sub-thread being a thread that executes concurrently with the main thread.
On the basis of creating the sub thread, when creating the second object and initializing the execution environment information of the target application in the parallel execution, the execution environment information of the target application may be initialized in the main thread, and the second object may be created in the sub thread.
According to the method, the running environment information of the target application is initialized in the main thread, and the second object is created in the sub-thread, so that the concurrent execution of the target application and the second object can be realized, the time consumption of APP cold start can be further reduced, and the APP cold start performance is greatly improved.
In a possible implementation manner, on the basis of the creating of the child thread, when the batch initialization is performed on the hot object in the starting stage of the target application according to the information of the hot object in the starting stage of the target application, the batch initialization may be performed on the hot object in the starting stage of the target application in the child thread according to the information of the hot object in the starting stage of the target application.
According to the method, the hot objects in the starting stage of the target application are initialized in batch in the thread, so that the concurrent execution of the batch initialization of the hot objects and the initialization of the running environment information of the target application can be realized, the time consumption of APP cold start can be further reduced, and the APP cold start performance is greatly improved.
In a possible implementation manner, when the operating system is instructed to perform batch initialization on the plurality of first objects, the operating system may be instructed to perform batch initialization on the plurality of first objects by triggering an initialization signal.
In a possible implementation manner, the hot object in the starting phase of the target application includes at least one of a class, a method, a function, and a field.
In a possible implementation manner, the information of the hot object in the starting phase of the target application is sequentially stored in the same partition, where the partition is a storage area in the terminal device that installs the target application.
According to the method, hot objects in the starting stage of the target application comprise at least one of classes, methods, functions and fields, and information of the hot objects in the starting stage of the target application is sequentially stored in the same partition, so that the hot objects are sequentially stored in the same partition, terminal equipment can read the information of a plurality of hot objects only by performing partition reading once, and when the objects need to be called, the objects can be directly called without performing frequent partition reading, so that I/O (input/output) operation can be obviously reduced. The hotspot objects which can be collected by the terminal equipment at least comprise classes, methods, functions and fields, and can be stored in the same partition mode of ordered storage, so that the effect of reducing I/O operation is better, and further the performance optimization of the target APP is deeper.
In a second aspect, an embodiment of the present application provides an application starting apparatus, including: the device comprises a receiving module and a processing module. The receiving module is used for receiving an instruction of starting a target application, and the processing module is used for carrying out batch initialization on the hot object in the starting stage of the target application according to the information of the hot object in the starting stage of the target application and starting the target application based on the hot object which is initialized in batch.
In a possible implementation manner, the information of the hot object in the starting phase of the target application includes: whether the hot object belongs to the object called by the class initialization method.
The processing module is specifically configured to:
acquiring a plurality of first objects called by a class initialization method in the hot objects in the starting stage of the target application; and performing batch initialization on the plurality of first objects.
In a possible implementation manner, the processing module is specifically configured to:
when one of the first objects is called for the first time by using the class initialization method, an operating system is instructed to perform batch initialization on the first objects.
In one possible implementation, the processing module is further configured to:
and executing and creating a second object and initializing the running environment information of the target application in parallel, wherein the second object is used for loading the first object and a third object, and the third object is an object which is called by a class initialization method in the starting stage of the target application and does not belong to the hotspot object.
In one possible implementation, the processing module is further configured to:
creating a main thread of the target application in a main process of the target application; and creating a sub-thread through the main thread, wherein the sub-thread is a thread which is executed concurrently with the main thread.
In a possible implementation manner, the processing module is specifically configured to:
initializing running environment information of the target application in the main thread; and creating the second object in the child thread.
In a possible implementation manner, the processing module is specifically configured to:
and initializing the hot objects in the starting stage of the target application in batch according to the information of the hot objects in the starting stage of the target application in the sub-thread.
In a possible implementation manner, the processing module is specifically configured to:
instructing the operating system to perform batch initialization on the plurality of first objects by triggering an initialization signal.
In a possible implementation manner, the hot object in the starting phase of the target application includes at least one of a class, a method, a function, and a field.
In a possible implementation manner, the information of the hot object in the starting phase of the target application is sequentially stored in the same partition, where the partition is a storage area in the terminal device that installs the target application.
In a third aspect, an embodiment of the present application provides an apparatus, including: an input interface circuit, a logic circuit, and an output interface circuit, wherein the logic circuit is configured to perform the method of the first aspect.
In a fourth aspect, an embodiment of the present application provides a terminal device, where the terminal device includes: a memory, a processor, and a transceiver; the processor is configured to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps of the first aspect; the transceiver is coupled to the processor, and the processor controls the transceiver to transmit and receive messages.
In a fifth aspect, the present application provides a computer program product, which includes computer program code, when executed by a computer, causes the computer to execute the method of the first aspect.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium, which stores computer instructions that, when executed by a computer, cause the computer to perform the method of the first aspect.
In a seventh aspect, an embodiment of the present application provides a chip, where the chip is connected to a memory, and is configured to read and execute a software program stored in the memory, so as to implement the method provided in the first aspect.
Drawings
Fig. 1 is an interaction schematic diagram of an APP cold start method provided in the prior art;
FIG. 2 is a diagram of an exemplary system architecture of an application startup method provided by an embodiment of the present application;
fig. 3 is an interaction flowchart of an application starting method according to an embodiment of the present application;
fig. 4 is an interaction flowchart of an application starting method according to an embodiment of the present application;
FIG. 5 is a comparison diagram of APP startup phases in an android operating system;
fig. 6 is a block diagram of an application starting apparatus according to an embodiment of the present application;
fig. 7 is a block diagram of another application starting apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
Fig. 1 is an interaction schematic diagram of an APP cold start method provided in the prior art, and as shown in fig. 1, an APP cold start process includes:
s101, the system desktop sends a message for starting the APP to the system service process.
The system desktop (Launcher) sends a message for starting the APP to the system _ server process after detecting the operation of clicking the APP icon by the user.
S102, the system service process sends a notification message to the fertilized egg process.
The notification message is used to notify the zygate process to spawn the subprocess.
S103, the fertilized egg process breeds an APP main process, and the main process comprises a main thread.
And S104, returning the identifier of the main process of the inoculated APP to the system service process by the fertilized egg process.
S105, the system service process sends the information of binding the application to the main thread of the APP.
S106, the main thread of the APP executes a main function of ActivityThread and creates a default ClassLoader.
Executing the main function of ActivityThread and creating the default ClassLoader are both done in the main thread, therefore, serial execution is required.
S107, loading, initializing and calling a needed object in starting of the main thread of the APP, and starting the APP.
In the above processing procedure, after the main function of ActivityThread is executed and the default ClassLoader is created in series, the required object in the APP start is loaded, initialized and called in the main thread according to the APP start flow. The objects include classes, methods, functions, and the like. Before calling a class in the starting process, a clinit method is firstly executed to initialize the class, and then the class is called to execute the class. A large number of classes may need to be called in the APP starting process, so that the clinit method needs to be executed for multiple times to initialize the class needing to be called, and the method causes the APP starting time to be long, and the cold starting performance of the APP to be reduced.
In addition, after receiving the message for binding the application sent by the system _ server process, the main thread of the APP sequentially executes the main function of ActivityThread and creates a default ClassLoader, and the process is executed serially, so that the processing mode further prolongs the APP start time, and further leads to poor cold start performance of the APP.
The technical scheme of the embodiment of the application aims to solve the problems.
Before describing the technical solutions of the embodiments of the present application, technical terms related to the embodiments of the present application are explained first.
1. Class I
In object-oriented programming, a problem is modeled by a set of data abstractions, which may be referred to as classes. Several data and methods may be included in a class. The data is used to describe characteristics of the class, and the data may specifically refer to a field.
2. Method of producing a composite material
A class may contain several methods, which are functions defined in the class, one method for describing one behavior of the class.
3. Function(s)
The function is essentially the same as the method, one function is used to describe one behavior, in the embodiment of the present application, the function does not belong to a certain class, but the method belongs to a class.
4. Hotspot object
The hotspot object may refer to an object which is called more than a first preset threshold in the APP starting and running process. The hotspot objects may include at least: class, method, function, field.
5、clinit
A class initialization method in Java language is called when a certain class is loaded for the first time, and a class can be initialized through a clinit method.
6、ClassLoader
The class loader method in the Java language can load a class by calling the ClassLoader method.
In the following, the technical solution of the embodiment of the present application is described by taking an example of writing an APP running under an android operating system using a Java language as an example, but this cannot be taken as a limitation to the embodiment of the present application, and the embodiment of the present application is also applicable to APPs running under other operating systems written using other languages.
The embodiment of the present application aims to improve the cold start performance of an APP installed on a terminal device, and for convenience of description, the following embodiment of the present application refers to the APP as a "target APP". It is to be noted that, in the embodiments of the present application, "target APP" is equivalent to "target application".
Fig. 2 is an exemplary system architecture diagram of an application starting method according to an embodiment of the present application, and as shown in fig. 2, the system includes a cloud server and a terminal device. The number of the terminal devices may be one or more. In the system, the cloud server is used for acquiring the information of the hot object in the starting stage of the APP, the information of the hot object in the starting stage of the target APP is compiled into the installation file of the target APP, the terminal equipment can acquire the installation file of the target APP from the cloud server to install, when the target APP is started on the terminal equipment, the starting time consumption of the target APP can be reduced through the method of the embodiment of the application, and the cold starting performance of the target APP is improved.
The Terminal device (including the first Terminal device and the second Terminal device) according to the embodiment of the present application may also be referred to as a Terminal, a User Equipment (UE), a Mobile Station (MS), a Mobile Terminal (MT), or the like. The terminal device may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with a wireless transceiving function, a Virtual Reality (VR) terminal device, an Augmented Reality (AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in unmanned driving (self driving), a wireless terminal in remote surgery (remote medical supply), a wireless terminal in smart grid (smart grid), a wireless terminal in transportation safety (transportation safety), a wireless terminal in smart city (smart city), a wireless terminal in home (smart home), and the like.
The terminal equipment can be deployed on land, including indoors or outdoors, handheld or vehicle-mounted; can also be deployed on the water surface; it may also be deployed on airborne airplanes, balloons and satellite vehicles. The embodiment of the application does not limit the application scene of the terminal device.
Fig. 3 is an interaction flowchart of the application program starting method provided in the embodiment of the present application, and in fig. 3, a system desktop, a system service process, and a fertilized egg process are all processes under an android operating system, and it can be understood by those skilled in the art that when the method of the embodiment of the present application is applied to other operating systems, names of the processes and an interaction process between the processes may have a certain difference. As shown in fig. 3, the method includes:
s301, the system desktop sends a message for starting the target APP to the system service process.
The system desktop (Launcher) is the Launcher of the android operating system, in which all APPs are launched by clicking on application icons on the desktop. When a user clicks an icon of a target APP on a desktop, triggering a Launcher to send an instruction for starting the target APP to a system service (system _ server) process. For the terminal device, after the user clicks the icon of the target APP, the terminal device receives an instruction to start the target APP.
S302, the system service process sends a notification message to the fertilized egg process.
The fertilized egg (zygate) process is the parent of all APP processes, all of which are inoculated by the zygate process in the android operating system. Therefore, when the system _ server process receives the message to start the target APP, it may send a notification message to the zygate process, which notifies the zygate process to spawn the main process of the target APP.
And S303, the fertilized egg process breeds a main process of the target APP, and the main process comprises a main thread.
The zygate process receives the notification message of the system _ server process, breeds the main process of the target APP according to the notification message, and creates the main thread of the target APP in the main process. For the terminal device, after receiving the instruction to start the APP, the terminal device may create a main thread of the target APP.
In an android operating system, after a zygate process breeds a main process for a target APP, the main process of the target APP is allocated with specific resources, and after the main process is established in the main process, the main process uses the resources allocated to the main process to execute various operations corresponding to the target APP.
And S304, returning the identifier of the main process of the inoculated target APP to the system service process by the fertilized egg process.
S305, the system service process sends the message of binding the application to the main thread of the target APP.
The system _ server process can carry information such as the installation path, the package name and the like of the target APP in the message of the bound application, so that the main thread can execute required operation according to the information.
S306, the main thread of the target APP executes to create a second object and initialize the running environment information of the target APP.
The second object is used to load the first object and the third object, the first object belongs to an object called by the class initialization method in the hot object in the start phase of the target APP, and the information of the hot object and the first object will be described in detail in the following embodiments. And the third object is an object which is called by the class initialization method in the target APP starting stage and does not belong to the hot object.
For example, in the android operating system, the second object may refer to a class loader (ClassLoader), and after the ClassLoader is created in the main thread, objects that need to be called in the target APP start-up phase may be loaded by the ClassLoader, and after the objects are loaded, the objects may be initialized and called to implement respective functions in the target APP start-up phase.
For example, in an android operating system, the above-mentioned initialization target APP running environment information may refer to a main (main) function executing an active thread (ActivityThread), in which the running environment information of the target APP may be initialized, after the running environment information of the target APP is initialized, a message loop in the target APP may be established, and the target APP performs object calling through the message loop in a starting process to implement starting of the target APP.
S307, the main thread of the target APP performs batch initialization on the hot objects in the starting stage of the target APP according to the information of the hot objects in the starting stage of the target APP.
Optionally, in a test stage before the target APP is released, information of the hot object in the starting process of the target APP may be collected. The hot spot object refers to an object of which the called times are greater than a first preset threshold in the starting process of the target APP. The hotspot objects may include at least: class, method, function, field. The information of the hot object may include an identification of the hot object and whether the hot object belongs to an object called by the class initialization method. If a hot object belongs to an object called by the class initialization method, it means that when the target APP is started, a class initialization method (e.g., clinit method) needs to be executed first to initialize the hot object, and then the hot object can be called. In the embodiment of the application, an object called by a class initialization method in a hot object in a starting stage of a target APP is referred to as a first object. The number of the first objects may be plural. The information of the hot objects is compiled into an installation file of the target APP, and after the target APP is installed on the terminal equipment and a user clicks an icon of the target APP, the terminal equipment can perform batch initialization on the first objects according to the information of the hot objects.
As described above, the hot object in the target APP start phase refers to an object with a large number of calls in the target APP start process, and if the hot objects are respectively initialized, the target APP start consumes a large amount of time. In this embodiment, the target APP pre-contains information of the hot object, and the information of the hot object may include, in addition to the identifier of the hot object: whether the hot object belongs to the object called by the class initialization method. When the batch initialization is performed, a plurality of first objects called by the class initialization method may be obtained from the information of the hot object in the start stage included in the target APP, and the batch initialization may be performed on the plurality of first objects. By containing the information of the hot object in advance, the terminal device can directly acquire the hot object in the target APP and the first objects needing to be called by the class initialization method in the hot object, and further perform batch initialization on the first objects, so that extra time consumption caused by the fact that initialization is performed first before one first object is called each time is avoided, and time consumption in the starting process of the target APP is greatly saved. Meanwhile, only the objects needing to be called by the class initialization method in the hot objects are initialized in batch, and the objects which do not belong to the hot objects and need to be called by the class initialization method in the APP starting stage, namely the third objects, are not initialized in batch, so that unnecessary initialization of the objects which are not hot can be avoided, and further new time consumption is avoided.
An optional way to perform the above batch initialization is:
when one of the first objects is called for the first time by using the class initialization method, the operating system is instructed to perform batch initialization on the first objects.
The first call of one object in the plurality of first objects by using the class initialization method means that one object is first called in the plurality of first objects.
Specifically, the first-called object may be obtained first, and then, according to information of the first object, the operating system may be instructed to perform batch initialization on the plurality of first objects.
The following is a procedure of acquiring the above-described first-invoked object.
And calling various objects by the terminal equipment according to the starting process of the target APP. Illustratively, after a user clicks an icon of a target APP, the terminal device needs to display a home page of the target APP, and then the terminal device needs to call a certain object a to draw a component to be displayed in the home page of the target APP.
The terminal device can read the information of the hot object in the target APP starting stage, and select the first object from the hot object according to the specific mark of the first object. The specific marking of the first object will be explained in detail in the following embodiments. As an example, information for these selected first objects may be stored in a file of a particular format, such as in a file of the. And in the starting process of the target APP, starting from calling the first object in the file, judging whether the object is initialized, if not, carrying out batch initialization on all objects in the file, if so, continuing to call the next object according to the starting process of the target APP until a called object is not initialized.
In the above determination, if a called object is not initialized, it indicates that the object needs to be initialized, that is, the object is the first object, and therefore, the above determination process is a process of acquiring the first object.
Optionally, when determining whether a called object has been initialized, it may be determined whether the read address of the called object is an unreadable address, and if so, it indicates that the object has not been initialized, and it needs to be initialized first and then called.
In this embodiment of the application, the first object is a hotspot object belonging to an APP start phase and is an object called in a target APP start process, and the object may be a class or other objects, such as a method, a function, a field, and the like. In this embodiment, the first object may be a class, and needs to be initialized by using a class initialization method.
The following is a process of instructing the operating system to perform batch initialization on the plurality of first objects.
The terminal device executes the application layer at the APP layer, i.e. the upper application layer, when obtaining the plurality of first objects. And after the first called first object is obtained, the terminal equipment indicates the operating system to carry out batch initialization on all the first objects. When the first object is initialized in batch, it is only necessary to ensure that the objects are already loaded by a class loader (ClassLoader), and therefore, the initialization in batch for the first object only needs to be performed after the second object is created in step S306.
Optionally, before performing batch initialization on the first object, a ClassLoader may be called first to load the first object in batch.
In an alternative, the operating system may be instructed to first call a ClassLoader to load the first object in batch, and then to initialize the first object in batch.
Alternatively, after the second object is created in step S306, information of all the first objects may be obtained, and the first objects are loaded in batch, and in this step, the operating system is instructed to initialize the first objects in batch.
Optionally, when the terminal device instructs the operating system to perform batch initialization on the first objects, the terminal device may instruct the operating system to perform batch initialization on the plurality of first objects by triggering the initialization signal.
For example, in an android operating system, after acquiring a first invoked first object, a terminal device sends a sigv indication signal, where the sigv indication signal may trigger runtime of the operating system to initialize the first object in batch.
S308, starting the target APP by the main thread of the target APP based on the hot spot objects initialized in batch.
Optionally, after the second object is created, objects that need to be called by the class initialization method in the starting stage of the target APP may be loaded by the second object, and after the objects are loaded, the terminal device initializes and calls the objects according to the starting flow of the target APP. The objects needing to be called by the class initialization method comprise a first object and a third object, wherein the first object is an object needing to be called by the class initialization method in the hot object, and the third object is an object not belonging to the hot object and needing to be called by the class initialization method. In the target APP starting process, the first object is initialized in batch and called in the target APP starting process according to the process of the step S307, and the third object is initialized and called in the target APP starting process. Besides the above objects that need to be called by the class initialization method, the target APP may also call other objects in the start-up phase, including: methods, functions, fields, etc. By calling these objects, normal startup of the target APP can be achieved.
In this embodiment, because the information of the hot object in the starting stage is included in the target APP in advance, the terminal device may perform batch initialization on the object that needs to be called in the starting stage of the target APP based on the information, thereby avoiding extra time consumption caused by the initial operation before calling a first object each time, and greatly saving time consumption in the starting process of the target APP. Meanwhile, the objects which do not belong to the hot objects and need to be called by the class initialization method in the APP starting stage are not initialized in batch, unnecessary initialization of the objects which are not the hot objects can be avoided, and new time consumption is avoided.
The following describes the process of generating the information of the hot spot object.
During start-up and running of the target APP, various objects may be called, which may be classes, methods, functions, fields, etc. When a terminal device (referred to as a test terminal device in this embodiment) is installed with a target APP of a test stage, and the target APP of the test stage starts and runs on the test terminal device, and when an object is called, the test terminal device may monitor a behavior of the object being called, and record the number of times that the object is called in a starting process of the target APP. For example, the test terminal device may monitor the behavior of the object being called through its runtime (runtime) and record the number of times of calling of each object. For the test terminal equipment, the running of all the APPs running on the test terminal equipment is carried out based on runtime, so that the runtime can acquire the calling information of all the objects in the APPs. In this embodiment, the target APP runs based on runtime, and when a certain object in the target APP is called, runtime can record the calling behavior. Illustratively, when an object A in a target APP is called for the first time, runtime allocates a variable of the number of times of calling to the object A and sets the value of the variable to 1, when the object A is called again, runtime adds 1 to the value of the variable as a new value of the variable, and so on
In the embodiment of the application, the test terminal device can support call monitoring and call frequency recording of at least the following types of objects:
classmata: class I
Method, a: method of producing a composite material
Function: function(s)
Fieldmeta field
String: c-style character string
Literal: java character string
Optionally, after recording the number of calls of each object, the test terminal device may determine the number of calls of each object, and if the number of calls of a certain object reaches a first preset threshold, use the certain object as a hot object. The hot object has a unique identification to distinguish it from other objects. For example, the name of the hot object may be used as the identification of the hot object. Meanwhile, the test terminal device may also record whether the hot object belongs to an object called by the class initialization method. If a certain hot object belongs to an object called by the class initialization method, it means that when the target APP is started, the class initialization method needs to be executed first to initialize the hot object.
After the recording process is executed by the test terminal device, the information of the hot object of the target APP in the starting process can be obtained, including the identification of the hot object and whether the hot object belongs to the object called by the class initialization method. The test terminal equipment can report the information of the hot objects to the cloud server, and the cloud server compiles the information of the hot objects into an installation file of the target APP. In the compiling process, the cloud server can arrange the information of the hot objects in the starting stage of the target application in the same file in order, and generate the installation file of the target APP by using the file stored in order. After the installation file is installed to the terminal device, the information of the hot object in the orderly stored file is orderly stored in the same partition of the terminal device, wherein the partition is a storage area in the terminal device of the installation target APP.
In addition, if the hot object belongs to the object called by the class initialization method, the object called by the class initialization method in the hot object can be marked in a specific way. For example, the cloud server may store the object belonging to the class initialization method call in a specific file, for example, a def file, to mark the object belonging to the class initialization method call in the hotspot object. Based on the marking method, when performing batch initialization in step S307, the objects in the def file can be directly read and batch initialization can be performed on the objects.
In the prior art, objects to be called in a target APP are dispersedly stored in different partitions, when a terminal device calls the objects, the content of one partition can be read and called each time, and if hot objects are dispersedly stored in different partitions, the terminal device needs to frequently read the partitions, so that a large amount of I/O operations are generated. In this embodiment, the hot objects are sequentially stored in the same partition, and the terminal device can read the information of the hot objects only by performing partition reading once. In addition, in this embodiment, the hotspot objects that can be collected by the terminal device at least include classes, methods, functions, and fields, and these hotspot objects can be stored in the same partition mode of ordered storage, so that the effect of reducing I/O operations is better, and further, the performance optimization of the target APP is deeper.
In the above embodiment, when the creating of the second object and the initialization of the running environment information of the target APP are performed in step S306, the main thread of the target APP performs serial execution, that is, the creating of the second object is performed first, and then the running environment information of the target APP is initialized. For the execution of creating the second object and initializing the running environment information of the target APP, no sequential dependency relationship exists between the second object and the running environment information. Therefore, in the embodiment of the present application, as an optional implementation manner, creating the second object and initializing the running environment information of the target APP may be performed in parallel.
Optionally, the creating of the second object and the initializing of the runtime environment information of the target APP may be performed by parallel threads.
Specifically, the terminal device may create a main thread of the target APP in a main process of the target APP, and create a sub-thread through the main thread, where the sub-thread is a thread concurrently executed with the main thread. And further, a second object is created in the main thread, and the running environment information of the target APP is initialized in the sub-thread.
Meanwhile, the terminal device may perform batch initialization in the foregoing step S307 in the child thread.
The following describes the concurrent execution process of the threads through an interactive flow.
Fig. 4 is an interaction flowchart of an application starting method provided in the embodiment of the present application, and as shown in fig. 4, the method includes:
s401, the system desktop sends a message for starting the target APP to the system service process.
The process of executing this step is the same as that of step S301, and reference may be made to step S301, which is not described herein again.
S402, the system service process sends a notification message to the fertilized egg process.
The execution process of this step is the same as that of step S302, and reference may be made to step S302, which is not described herein again.
And S403, the fertilized egg process breeds a main process of the target APP, and the main process comprises a main thread.
The process of executing this step is the same as that of step S303, and reference may be made to step S303, which is not described herein again.
S404, the fertilized egg process returns the identifier of the main process of the APP to the system service process.
The process of executing this step is the same as that of step S304, and reference may be made to step S304, which is not described herein again.
S405, the system service process sends the information of the bound application to the main thread of the APP.
The process of executing this step is the same as that of step S305, and reference may be made to step S305, which is not described herein again.
S406, a sub-thread is created through the main thread, and the sub-thread and the main thread are threads executed concurrently.
After the main thread is created in the main process of the target APP, a sub-thread can be created in the main thread, wherein the sub-thread is a thread under the main process, and the sub-thread can be executed concurrently with the main thread. Therefore, for the operation without the precedence dependency relationship, the operation can be executed by the main thread and the sub thread respectively. Specifically, the running environment information of the target APP may be initialized in the main thread, and the second object may be created in the sub-thread. Since the batch initialization of the hot spot objects in the starting stage of the target application needs to be completed after the second object is created, the batch initialization of the hot spot objects in the starting stage of the target application can be performed in the sub-thread after the second object is created in the sub-thread.
In the three running operations, initializing the running environment information of the target APP in the main thread is performed in the following step S407, creating the second object in the sub-thread is performed in the following step S408, and batch initializing the hotspot objects in the starting stage of the target application in the sub-thread is performed in the following step S409. As can be seen from the above description, step S407 is executed concurrently with step S408 and step S409, and step S408 and step S409 are executed sequentially, that is, step S408 is executed first, and then step S409 is executed.
It should be noted that, steps S405 and S407 are performed sequentially, and steps S405 and S406 are performed concurrently, that is, a sub-thread can be created in the main thread as long as the main thread is created, and the initialization of the runtime environment information of the target APP in the main thread needs to be performed after receiving the message of the bound application of the system service process.
S407, initializing the running environment information of the target APP in the main thread.
For example, in the android operating system, the above-mentioned initialization of the running environment information of the target APP may refer to a main (main) function executing an active thread (ActivityThread), in which the running environment information of the target APP may be initialized, and after the running environment information of the target APP is initialized, a message loop in the target APP may be established to implement the starting of the target APP.
In this step, a main (main) function of an active thread (ActivityThread) may be executed in the sub-thread, after the function is executed, the operating environment information of the target APP is initialized, based on the result of the initialization of the operating environment information, a message loop in the target APP may be established in the main thread, and the target APP performs object calling through the message loop in the starting process, and realizes the starting of the APP.
S408, the second object is created in the child thread.
Taking an android operating system as an example, the second object may refer to a loader (ClassLoader), after a sub-thread is created in a main thread, the ClassLoader may be created in the sub-thread, and after the ClassLoader is created, objects that need to be called in a target APP start-up phase may be loaded, and after the objects are loaded, the objects may be initialized and called to implement respective functions in the target APP start-up phase.
S409, initializing the hot objects in the starting stage of the target APP in batch according to the information of the hot objects in the starting stage of the target APP in the sub-thread.
The execution of this step is identical to that in the aforementioned step S307, except that this step is performed in the sub thread, whereas the aforementioned step S307 is performed in the main thread. The specific implementation process may be the step S307, which is not described herein again.
S410, starting the target APP by the main thread of the target APP based on the hot spot objects initialized in batch.
This step is performed after the above-described steps S401 to S409.
The execution process of this step is the same as the aforementioned step S308, and reference may be made to the aforementioned step S308, which is not described herein again.
In this embodiment, a sub-thread is created in a main thread of a target APP, the sub-thread creates a second object for loading other objects and performs batch initialization on hot objects in a starting stage of the target APP, the main thread initializes running environment information of the target APP, and the main thread and the sub-thread execute concurrently, so that the running environment information for initializing the target APP and the processes of creating the second object and performing batch initialization on the hot objects can be executed concurrently, time consumed by cold start of the APP is further reduced, and performance of cold start of the APP is greatly improved.
Fig. 5 is a comparison diagram of APP start-up phases in an android operating system, and as shown in fig. 4, one APP start-up phase based on the android operating system may involve 4 time consumptions, where 0 represents the start-up time consumption of a zygate process, 1 represents the load time consumption of a boot resource, 2 represents the start-up time consumption of a Launcher, and 3 represents the time consumption of the next APP start-up phase of the android operating system. In 3, 3-1 represents the time consumed for creating the second object, 3-2 represents the time consumed for initializing the running environment information of the target APP, 3-3 represents the time consumed for initializing the object, and 3-4 represents the time consumed for loading the object and starting the APP. Referring to fig. 4, in the conventional process flow shown in fig. 1, processes corresponding to 3-1, 3-2, 3-3, and 3-4 need to be performed in series, and thus the total time consumption of 3 is the sum of 3-1, 3-2, 3-3, and 3-4. In the embodiment of the present application, the processes corresponding to 3-1, 3-2 and 3-3 can be performed concurrently, so that the total time consumption of 3-1, 3-2 and 3-3 is the maximum value of the sum of the time consumption of 3-1 and 3-3 and the time consumption of 3-2. Therefore, compared with the existing processing process, the APP startup time can be saved by answering.
Assuming that the time consumption of 3-1 in fig. 4 is T1 and the time consumption of 3-2 is T2, and assuming that the time consumption of 3-3 in the existing processing procedure is T3 as in the example 3-3 of the present application, if the existing processing procedure is used, the time consumption T in the links 3-1, 3-2, and 3-3 is shown in the following formula (1):
T=T1+T2+T3 (1)
after the present embodiment is used, the time T consumed in the 3-1, 3-2, and 3-3 links is shown in the following formula (2):
T=max{T1+T3,T2} (2)
as can be further seen from the above formula (1) and formula (2), in the case that the time consumption of 3-3 in the existing processing procedure is the same as the time consumption of 3-3 in the embodiment of the present application, compared with the existing processing procedure, in this embodiment, because the sub-thread executions 3-1 and 3-3 are created and the sub-thread execution 3-2 is concurrently executed in the main thread, the time consumption of the APP cold start can be greatly saved. As described above, in the embodiment of the present application, because the objects that need to be called in the target APP start-up phase in the hot-spot objects are initialized in batch, time consumed for initializing the objects is greatly reduced compared to time consumed for initializing the objects in the existing processing process, that is, time consumed for 3-3 in the embodiment of the present application is significantly reduced compared to time consumed for 3-3 in the existing processing process, and therefore, after the main thread and the sub thread in the embodiment of the present application are concurrently executed and processed and the batch initialization objects are combined, time consumed in the target APP start-up phase is reduced to a greater extent than time consumed in the existing processing process.
Fig. 6 is a block structure diagram of an application starting apparatus according to an embodiment of the present application, where the apparatus may be the terminal device described in the foregoing embodiment, or may be an apparatus capable of enabling the terminal device to implement the function of the terminal device in the method according to the embodiment of the present application, for example, the apparatus may be an apparatus in the terminal device or a chip system. As shown in fig. 6, the apparatus includes: a receiving module 601 and a processing module 602.
A receiving module 601, configured to receive an indication of starting a target application.
The processing module 602 is configured to perform batch initialization on the hot objects in the starting phase of the target application according to the information of the hot objects in the starting phase of the target application.
In addition, the processing module 602 is further configured to start the target application based on the hot object that is initialized in batch.
In an optional implementation manner, the information of the hot object in the starting phase of the target application includes: whether the hot object belongs to the object called by the class initialization method. When the information of the hot object includes whether the hot object belongs to an object called by the class initialization method, the processing module 602 is specifically configured to:
the method comprises the steps of obtaining a plurality of first objects which belong to the hot objects in the starting stage of the target application and are called by a class initialization method, and carrying out batch initialization on the plurality of first objects.
In an optional implementation, the processing module 602 is specifically configured to:
when one of the first objects is called for the first time by using the class initialization method, the operating system is instructed to perform batch initialization on the first objects.
In an alternative embodiment, the processing module 602 is further configured to:
and executing and creating a second object and initializing the running environment information of the target application in parallel, wherein the second object is used for loading the first object and a third object, and the third object is an object which is called by the class initialization method in the starting stage of the target application and does not belong to the hotspot object.
In an alternative embodiment, the processing module 602 is further configured to:
the method includes creating a main thread of a target application in a main process of the target application, and creating a sub-thread through the main thread, the sub-thread being a thread that executes concurrently with the main thread.
In an optional implementation, the processing module 602 is specifically configured to:
the execution environment information of the target application is initialized in the main thread, and the second object is created in the sub-thread.
In an optional implementation, the processing module 602 is specifically configured to:
and initializing the hot objects in the starting stage of the target application in batch according to the information of the hot objects in the starting stage of the target application in the sub-thread.
In an optional implementation, the processing module 602 is specifically configured to:
and instructing the operating system to perform batch initialization on the plurality of first objects by triggering an initialization signal.
In an optional implementation manner, the hot object in the starting phase of the target application includes at least one of a class, a method, a function, and a field.
In an optional implementation manner, the information of the hot spot object in the starting phase of the target application is sequentially stored in the same partition, where the partition is a storage area in the terminal device where the target application is installed.
The application program starting device provided in the embodiment of the present application may execute the method steps in the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
It should be noted that the division of the modules of the above apparatus is only a logical division, and the actual implementation may be wholly or partially integrated into one physical entity, or may be physically separated. And these modules can be realized in the form of software called by processing element; or may be implemented entirely in hardware; and part of the modules can be realized in the form of calling software by the processing element, and part of the modules can be realized in the form of hardware. For example, the determining module may be a processing element separately set up, or may be implemented by being integrated in a chip of the apparatus, or may be stored in a memory of the apparatus in the form of program code, and the function of the determining module is called and executed by a processing element of the apparatus. Other modules are implemented similarly. In addition, all or part of the modules can be integrated together or can be independently realized. The processing element described herein may be an integrated circuit having signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when some of the above modules are implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor that can call program code. As another example, these modules may be integrated together, implemented in the form of a system-on-a-chip (SOC).
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a Solid State Disk (SSD)), etc.
Based on the same inventive concept as the application starting method provided in the foregoing embodiment of the present application, an embodiment of the present application further provides an application starting apparatus, configured to implement the application starting method in the foregoing embodiment, where part or all of the application starting method in the foregoing embodiment may be implemented by hardware or by software, and when implemented by hardware, as shown in fig. 7, the application starting apparatus 700 includes:
the input interface circuit 702, the logic circuit 704, and the output interface circuit 706 further include a transceiver 708 and an antenna 710, and the transceiver 708 transmits and receives data through the antenna 710.
For details, please refer to the description in the foregoing method embodiments, and details are not repeated herein, where the logic circuit 704 is configured to execute the method steps of the terminal device in the application starting method shown in fig. 2 to 5. In a specific implementation, the application starting apparatus 700 may be a chip or an integrated circuit.
Fig. 8 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 8, the terminal apparatus 800 may include: a processor 81 (e.g., CPU), memory 82, transceiver 83; the transceiver 83 is coupled to the processor 81, and the processor 81 controls the transceiving operation of the transceiver 83. The memory 82 may store various instructions for performing various processing functions and implementing the method steps performed by the terminal device in the embodiments of the present application. Optionally, the terminal device related to the embodiment of the present application may further include: a power supply 84, a system bus 85, and a communications port 86. The transceiver 83 may be integrated in the transceiver of the terminal device or may be a separate transceiving antenna on the terminal device. The system bus 85 is used to implement communication connections between the elements. The communication port 86 is used for realizing connection and communication between the terminal device and other peripherals.
In this embodiment of the present application, the processor 81 is configured to be coupled with the memory 82, and read and execute the instructions in the memory 82, so as to implement the method steps performed by the terminal device in the above method embodiment. The transceiver 83 is coupled to the processor 81, and the processor 81 controls the transceiver 83 to perform message transceiving, which is similar in implementation principle and technical effect and will not be described herein again.
The system bus mentioned in fig. 8 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The system bus may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus. The communication interface is used for realizing communication between the database access device and other equipment (such as a client, a read-write library and a read-only library). The memory may comprise Random Access Memory (RAM) and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor may be a general-purpose processor, including a central processing unit CPU, a Network Processor (NP), and the like; but also a digital signal processor DSP, an application specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
Optionally, an embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the storage medium, and when the instructions are executed on a computer, the computer is enabled to execute the processing procedure of the terminal device in the foregoing embodiment.
Optionally, an embodiment of the present application further provides a chip for executing the instruction, where the chip is used to execute a processing procedure of the terminal device in the foregoing embodiment.
The embodiment of the present application further provides a program product, where the program product includes a computer program, the computer program is stored in a storage medium, at least one processor can read the computer program from the storage medium, and the at least one processor executes the processing procedure of the terminal device in the above embodiment.
In the embodiments of the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship; in the formula, the character "/" indicates that the preceding and following related objects are in a relationship of "division". "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
It is to be understood that the various numerical references referred to in the embodiments of the present application are merely for convenience of description and distinction and are not intended to limit the scope of the embodiments of the present application.
It should be understood that, in the embodiment of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.

Claims (23)

1. An application program starting method, comprising:
receiving an indication to launch a target application;
according to the information of the hot objects in the starting stage of the target application, carrying out batch initialization on the hot objects in the starting stage of the target application;
starting the target application based on the hot object which is initialized in batch.
2. The method of claim 1, wherein the information of the hot object in the starting phase of the target application comprises: whether the hot object belongs to an object called by a class initialization method or not;
the initializing the hot objects in batch at the starting stage of the target application according to the information of the hot objects at the starting stage of the target application comprises the following steps:
acquiring a plurality of first objects called by a class initialization method in the hot objects in the starting stage of the target application;
and performing batch initialization on the plurality of first objects.
3. The method of claim 2, wherein the batch initializing the plurality of first objects comprises:
when one of the first objects is called for the first time by using the class initialization method, an operating system is instructed to perform batch initialization on the first objects.
4. The method according to claim 2 or 3, wherein before performing batch initialization on the hot objects in the starting phase of the target application according to the information of the hot objects in the starting phase of the target application, the method further comprises:
and executing and creating a second object and initializing the running environment information of the target application in parallel, wherein the second object is used for loading the first object and a third object, and the third object is an object which is called by a class initialization method in the starting stage of the target application and does not belong to the hotspot object.
5. The method of claim 4, wherein after receiving the indication to launch the target application, further comprising:
creating a main thread of the target application in a main process of the target application;
and creating a sub-thread through the main thread, wherein the sub-thread is a thread which is executed concurrently with the main thread.
6. The method of claim 5, wherein the parallel execution of creating a second object and initializing runtime environment information for the target application comprises:
initializing running environment information of the target application in the main thread;
creating the second object in the child thread.
7. The method according to claim 5 or 6, wherein the initializing the hot objects in the starting phase of the target application in batch according to the information of the hot objects in the starting phase of the target application comprises:
and initializing the hot objects in the starting stage of the target application in batch according to the information of the hot objects in the starting stage of the target application in the sub-thread.
8. The method of claim 3, wherein instructing the operating system to bulk initialize the first plurality of objects comprises:
instructing the operating system to perform batch initialization on the plurality of first objects by triggering an initialization signal.
9. The method according to any one of claims 1 to 8, wherein the hot object in the start phase of the target application comprises at least one of a class, a method, a function, and a field.
10. The method according to claim 9, wherein the information of the hot object in the starting phase of the target application is stored in the same partition in order, and the partition is a storage area in a terminal device where the target application is installed.
11. An application startup device, comprising:
a receiving module for receiving an indication to start a target application;
the processing module is used for carrying out batch initialization on the hot objects in the starting stage of the target application according to the information of the hot objects in the starting stage of the target application;
the processing module is further configured to start the target application based on the hot object initialized in batch.
12. The apparatus of claim 11, wherein the information of the hot object in the starting phase of the target application comprises: whether the hot object belongs to an object called by a class initialization method or not;
the processing module is specifically configured to:
acquiring a plurality of first objects called by a class initialization method in the hot objects in the starting stage of the target application; and the number of the first and second groups,
and performing batch initialization on the plurality of first objects.
13. The apparatus of claim 12, wherein the processing module is specifically configured to:
when one of the first objects is called for the first time by using the class initialization method, an operating system is instructed to perform batch initialization on the first objects.
14. The apparatus of claim 12 or 13, wherein the processing module is further configured to:
and executing and creating a second object and initializing the running environment information of the target application in parallel, wherein the second object is used for loading the first object and a third object, and the third object is an object which is called by a class initialization method in the starting stage of the target application and does not belong to the hotspot object.
15. The apparatus of claim 14, wherein the processing module is further configured to:
creating a main thread of the target application in a main process of the target application; and the number of the first and second groups,
and creating a sub-thread through the main thread, wherein the sub-thread is a thread which is executed concurrently with the main thread.
16. The apparatus of claim 15, wherein the processing module is specifically configured to:
initializing running environment information of the target application in the main thread; and the number of the first and second groups,
creating the second object in the child thread.
17. The apparatus according to claim 15 or 16, wherein the processing module is specifically configured to:
and initializing the hot objects in the starting stage of the target application in batch according to the information of the hot objects in the starting stage of the target application in the sub-thread.
18. The apparatus of claim 13, wherein the processing module is specifically configured to:
instructing the operating system to perform batch initialization on the plurality of first objects by triggering an initialization signal.
19. The apparatus according to any one of claims 11-18, wherein the hot object of the start phase of the target application comprises at least one of a class, a method, a function, and a field.
20. The apparatus according to claim 19, wherein the information of the hot object in the starting phase of the target application is stored in the same partition in order, and the partition is a storage area in a terminal device where the target application is installed.
21. A terminal device, comprising: a memory, a processor, and a transceiver;
the processor is used for being coupled with the memory, reading and executing the instructions in the memory to realize the method steps of any one of the claims 1-10;
the transceiver is coupled to the processor, and the processor controls the transceiver to transmit and receive messages.
22. A computer program product, characterized in that the computer program product comprises computer program code which, when executed by a computer, causes the computer to perform the method of any of claims 1-10.
23. A computer-readable storage medium having stored thereon computer instructions which, when executed by a computer, cause the computer to perform the method of any of claims 1-10.
CN201910755141.7A 2019-08-15 2019-08-15 Application program starting method and device, terminal equipment and readable storage medium Active CN110673887B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910755141.7A CN110673887B (en) 2019-08-15 2019-08-15 Application program starting method and device, terminal equipment and readable storage medium
PCT/CN2020/107644 WO2021027700A1 (en) 2019-08-15 2020-08-07 Application program starting method and apparatus, terminal device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910755141.7A CN110673887B (en) 2019-08-15 2019-08-15 Application program starting method and device, terminal equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110673887A true CN110673887A (en) 2020-01-10
CN110673887B CN110673887B (en) 2021-05-04

Family

ID=69075330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910755141.7A Active CN110673887B (en) 2019-08-15 2019-08-15 Application program starting method and device, terminal equipment and readable storage medium

Country Status (2)

Country Link
CN (1) CN110673887B (en)
WO (1) WO2021027700A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256358A (en) * 2020-10-21 2021-01-22 恒生电子股份有限公司 Object control method and device
WO2021027700A1 (en) * 2019-08-15 2021-02-18 华为技术有限公司 Application program starting method and apparatus, terminal device and readable storage medium
CN112685104A (en) * 2021-01-07 2021-04-20 北京字节跳动网络技术有限公司 Application program starting control method and device, electronic equipment and storage medium
CN114185623A (en) * 2021-12-20 2022-03-15 中国工商银行股份有限公司 Method and device for processing deadlock in application starting process
CN116662150A (en) * 2022-12-15 2023-08-29 荣耀终端有限公司 Application starting time-consuming detection method and related device
CN116662150B (en) * 2022-12-15 2024-05-31 荣耀终端有限公司 Application starting time-consuming detection method and related device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7659901B2 (en) * 2006-07-24 2010-02-09 Microsoft Corporation Application program interface for programmable graphics pipeline
CN105630543A (en) * 2015-12-21 2016-06-01 北京奇虎科技有限公司 Application cold start acceleration method and apparatus
CN106951298A (en) * 2017-04-25 2017-07-14 广州优视网络科技有限公司 A kind of method and apparatus for lifting application toggle speed
US20180139037A1 (en) * 2016-11-17 2018-05-17 International Business Machines Corporation Protecting cryptographic systems from cold boot and other side channel attacks
CN108536514A (en) * 2017-03-01 2018-09-14 龙芯中科技术有限公司 A kind of recognition methods of hotspot approach and device
CN109582385A (en) * 2018-11-07 2019-04-05 Oppo广东移动通信有限公司 Application program launching method and device, storage medium and electronic equipment
CN109783158A (en) * 2019-01-14 2019-05-21 深圳市脸萌科技有限公司 Using starting task processing method and device
CN109814930A (en) * 2018-12-27 2019-05-28 维沃移动通信有限公司 A kind of application loading method, device and mobile terminal
CN109918145A (en) * 2019-01-10 2019-06-21 北京字节跳动网络技术有限公司 A kind of accelerated method, the device, electronic equipment of application program cold start-up

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6742179B2 (en) * 2001-07-12 2004-05-25 International Business Machines Corporation Restructuring of executable computer code and large data sets
CN106547598A (en) * 2016-11-22 2017-03-29 四川长虹电器股份有限公司 The method for lifting Android application program launching speed
CN106775893B (en) * 2016-12-30 2020-03-17 北京小米移动软件有限公司 Method and device for pre-compiling program
CN106844033B (en) * 2017-01-23 2020-07-28 努比亚技术有限公司 Application quick starting method and terminal
CN110673887B (en) * 2019-08-15 2021-05-04 华为技术有限公司 Application program starting method and device, terminal equipment and readable storage medium
CN110659189B (en) * 2019-08-15 2021-02-23 华为技术有限公司 Application program generation method and device, cloud server and readable storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7659901B2 (en) * 2006-07-24 2010-02-09 Microsoft Corporation Application program interface for programmable graphics pipeline
CN105630543A (en) * 2015-12-21 2016-06-01 北京奇虎科技有限公司 Application cold start acceleration method and apparatus
US20180139037A1 (en) * 2016-11-17 2018-05-17 International Business Machines Corporation Protecting cryptographic systems from cold boot and other side channel attacks
CN108536514A (en) * 2017-03-01 2018-09-14 龙芯中科技术有限公司 A kind of recognition methods of hotspot approach and device
CN106951298A (en) * 2017-04-25 2017-07-14 广州优视网络科技有限公司 A kind of method and apparatus for lifting application toggle speed
CN109582385A (en) * 2018-11-07 2019-04-05 Oppo广东移动通信有限公司 Application program launching method and device, storage medium and electronic equipment
CN109814930A (en) * 2018-12-27 2019-05-28 维沃移动通信有限公司 A kind of application loading method, device and mobile terminal
CN109918145A (en) * 2019-01-10 2019-06-21 北京字节跳动网络技术有限公司 A kind of accelerated method, the device, electronic equipment of application program cold start-up
CN109783158A (en) * 2019-01-14 2019-05-21 深圳市脸萌科技有限公司 Using starting task processing method and device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021027700A1 (en) * 2019-08-15 2021-02-18 华为技术有限公司 Application program starting method and apparatus, terminal device and readable storage medium
CN112256358A (en) * 2020-10-21 2021-01-22 恒生电子股份有限公司 Object control method and device
CN112685104A (en) * 2021-01-07 2021-04-20 北京字节跳动网络技术有限公司 Application program starting control method and device, electronic equipment and storage medium
WO2022148231A1 (en) * 2021-01-07 2022-07-14 北京字节跳动网络技术有限公司 Application launch control method, apparatus, electronic device, and storage medium
CN114185623A (en) * 2021-12-20 2022-03-15 中国工商银行股份有限公司 Method and device for processing deadlock in application starting process
CN114185623B (en) * 2021-12-20 2024-04-19 中国工商银行股份有限公司 Processing method and device for deadlock in application starting process
CN116662150A (en) * 2022-12-15 2023-08-29 荣耀终端有限公司 Application starting time-consuming detection method and related device
CN116662150B (en) * 2022-12-15 2024-05-31 荣耀终端有限公司 Application starting time-consuming detection method and related device

Also Published As

Publication number Publication date
CN110673887B (en) 2021-05-04
WO2021027700A1 (en) 2021-02-18

Similar Documents

Publication Publication Date Title
CN110673887B (en) Application program starting method and device, terminal equipment and readable storage medium
CN111897539B (en) Method and device for deploying application according to service roles
US20220012068A1 (en) Data processing method, apparatus, device, and system
CN111475227B (en) Business plug-in loading implementation method and device and terminal equipment
US10019598B2 (en) Dynamic service discovery
CN103645945A (en) Automatic probing and drive loading method of virtual network interface card
CN111124286A (en) Libcloud-based multi-cloud management implementation method
CN111258680B (en) Resource loading method and device, storage medium and electronic device
CN110597564A (en) Installation package construction and service component loading method, device and terminal equipment
WO2021139379A1 (en) Activity configuration method and apparatus, readable medium and electronic device
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
CN110659189B (en) Application program generation method and device, cloud server and readable storage medium
CN109710280B (en) Method and equipment for installing application on user equipment
US20190205156A1 (en) Container access method and apparatus
CN112965895B (en) Desktop application program automatic test method, device, equipment and storage medium
CN106775916B (en) Method and device for reducing application installation packages and electronic equipment
CN111414152B (en) Method, system, readable medium and electronic device for realizing business logic
CN111414265B (en) Service framework and method for calling system resources
CN107402749B (en) Method and device for realizing picture loading library
US6636964B1 (en) Method and apparatus for loading an object-oriented operating system by providing an initial execution environment and migrating to a core execution environment thereafter
CN112506781B (en) Test monitoring method, device, electronic equipment, storage medium and program product
CN108804236B (en) AIDL file sharing method and system
CN108228277B (en) Method and device for entering application program
WO2022104883A1 (en) Adding method and apparatus for coexistence of multiple types of scenarios, terminal and storage medium
US10909048B1 (en) Declarative transactional communications with a peripheral device via a low-power bus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant