CN113031955A - Application program pre-compiling method and device and electronic equipment - Google Patents

Application program pre-compiling method and device and electronic equipment Download PDF

Info

Publication number
CN113031955A
CN113031955A CN201911349773.XA CN201911349773A CN113031955A CN 113031955 A CN113031955 A CN 113031955A CN 201911349773 A CN201911349773 A CN 201911349773A CN 113031955 A CN113031955 A CN 113031955A
Authority
CN
China
Prior art keywords
compiling
application program
application
electronic device
configuration file
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.)
Pending
Application number
CN201911349773.XA
Other languages
Chinese (zh)
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201911349773.XA priority Critical patent/CN113031955A/en
Priority to PCT/CN2020/136887 priority patent/WO2021129489A1/en
Publication of CN113031955A publication Critical patent/CN113031955A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The embodiment of the application discloses a method and a device for pre-compiling an application program and electronic equipment. The method comprises the following steps: when the electronic equipment is in an installation stage of an application program, detecting the current running state of the electronic equipment; if the running state meets the specified condition, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file; and pre-compiling the hot spot compiling unit. Therefore, by detecting the running state of the electronic equipment, the pre-compiling operation of the hotspot compiling unit in the configuration file can be carried out only when the running state meets the specified condition, so that the compiling time of the hotspot compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced because the hotspot compiling unit is directly compiled at the application program installation stage.

Description

Application program pre-compiling method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for pre-compiling an application program, and an electronic device.
Background
In the electronic equipment, the running efficiency of the application program can be improved to a certain extent in a way of compiling in advance. However, the related compiling method may cause the operation performance of the electronic device to be affected, and the user experience is reduced.
Disclosure of Invention
In view of the foregoing problems, the present application provides a method and an apparatus for pre-compiling an application program, and an electronic device, so as to improve the foregoing problems.
In a first aspect, the present application provides a method for pre-compiling an application program, which is applied to an electronic device, and the method includes: detecting the current running state of the electronic equipment; if the running state meets the specified condition and the application program is in the installation stage, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file; and pre-compiling the hot spot compiling unit.
In a second aspect, the present application provides an apparatus for pre-compiling an application program, running on an electronic device, the apparatus including: the state detection unit is used for detecting the current running state of the electronic equipment; the information acquisition unit is used for acquiring a configuration file corresponding to the application program if the running state meets the specified condition and the application program is in an installation stage, wherein the configuration file stores a hot spot compiling unit corresponding to the application program; and the compiling unit is used for carrying out pre-compiling on the hot spot compiling unit.
In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the methods described above.
In a fourth aspect, the present application provides a computer-readable storage medium having program code stored therein, wherein the method described above is performed when the program code is executed.
According to the application program pre-compiling method and device and the electronic equipment, when the running state of the electronic equipment is detected to meet the specified condition and the application program is in the installation stage, the configuration file, corresponding to the application program, storing the hot point compiling unit corresponding to the application program is obtained, and the hot point compiling unit is pre-compiled. Therefore, the running state of the electronic equipment is detected, so that the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced because the hot point compiling unit is directly compiled at the application program installation stage.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating an operating environment of a method for pre-compiling an application according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating an operating environment of another method for pre-compiling an application according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an operating environment of yet another method for pre-compiling an application according to an embodiment of the present application;
FIG. 4 is a flow chart illustrating a method for pre-compiling an application according to an embodiment of the present application;
FIG. 5 is a flow chart illustrating a method for application pre-compilation according to another embodiment of the present application;
FIG. 6 is a flow chart illustrating a method for application pre-compilation according to yet another embodiment of the present application;
FIG. 7 is a flow chart illustrating a method for application pre-compilation according to yet another embodiment of the present application;
FIG. 8 is a block diagram illustrating an apparatus for pre-compiling an application according to the present application;
FIG. 9 is a block diagram illustrating an alternative apparatus for application precompilation as proposed herein;
fig. 10 shows a block diagram of an electronic device for executing the method for pre-compiling an application according to the embodiment of the present application.
Fig. 11 is a storage unit for storing or carrying program code for implementing a method for precompiling an application program according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the development of the operation mode of the application program in the electronic device, the application program in the electronic device may be directly interpreted and executed by an Interpreter (Interpreter) during the operation, the number of calls and the number of cycles of each compiling unit are recorded during the execution, and when the number of calls and the number of cycles exceed a set threshold, the corresponding compiling unit is recorded as a hotspot compiling unit. The compiling unit may be understood as a function, method, or class (class) in the source code of the application program. Further, the hotspot compiling unit is identified, compiled by JIT (Just In Time), stored and generated into a profile file to record the information of the hotspot compiling unit. In this case, in some cases, the system Of the electronic device may scan the profile file and perform an AOT (Ahead Of Time) process for compilation.
However, the inventor of the present invention has found that, in the process of running the related profile file to perform compiling of the hotspot compiling unit, the compiling is performed in a fixed time period, which may cause that, even though the electronic device is in a state of relatively short processing resources, more processing resources still need to be consumed to perform compiling of the hotspot compiling unit, and further cause that the running performance of the electronic device is reduced. For example, in the process of installing an application program by an electronic device, a hotspot compiling unit corresponding to the application program may be downloaded simultaneously with an installation package of the application program, and if the installation package of the application program itself is large, the installation of the installation package needs to consume more processing resources of the electronic device.
Therefore, the method, the device and the electronic equipment for application precompilation of the application program are provided, when the electronic equipment is in an installation stage of the application program, a current running state of the electronic equipment is detected, if the running state meets a specified condition, a configuration file which is corresponding to the application program and stores a hotspot compiling unit corresponding to the application program is obtained, and the hotspot compiling unit is precompiled. Therefore, by detecting the running state of the electronic equipment in the application program installation stage, the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, so that the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced because the hot point compiling unit is directly compiled in the application program installation stage.
A scenario related to the embodiment of the present application will be described below.
Referring to fig. 1, the scenario of fig. 1 includes a plurality of electronic devices 100 and a server 200. Wherein, a plurality of electronic devices 100 interact data with the server 200 through the network.
A target application is run on each of the plurality of electronic devices 100, and a configuration file (which may be the aforementioned profile file) 120 is correspondingly generated for the target application run on each of the electronic devices 100. In one manner, the electronic devices 100 may upload the configuration files 120 of the target application installed by themselves to the server 200, so that the server may obtain the configuration files 120 corresponding to the target application, further perform fusion processing on the configuration files 120, extract the hot spot compiling units included in the configuration files 120, obtain the configuration files 210 including the hot spot compiling units, and then return the configuration files 210 to the electronic devices 100, respectively. The hot spot compiling units may be hot spot compiling units after the duplication of the configuration files 120 is removed, hot spot compiling units with compiling times exceeding a threshold value in all the hot spot compiling units in the configuration files 120, and hot spot compiling units corresponding to the designated function modules.
In addition, as shown in fig. 2, the configuration file 210 and the program installation package 230 of the installer 220 of the target application may also be directly sent by the server 220 to the electronic device 130 that has not installed the target application, so that the electronic device 130 may run the configuration file 210 when installing the target application, so as to perform pre-compiling of the partial hotspot compiling unit. For example, the electronic device 130 may determine the operation timing of the configuration file 210 according to the current operation state.
In the environment shown in fig. 2, the server that collects the plurality of configuration files 120 and processes the plurality of configuration files 120 to obtain the configuration file 210 may be a single server or a server cluster. Moreover, the server that collects the plurality of configuration files 120 and processes the plurality of configuration files 120 to obtain the configuration file 210 may be a different server from the server that subsequently issues the program installation package 230. For example, as shown in fig. 3, in the case shown in fig. 3, the server 200 is only used for executing the aforementioned collection of the configuration files uploaded by the plurality of electronic devices 100, then sending the collected configuration files to the server 201, then the server 201 executes the extraction of the plurality of hotspot compiling units included in the plurality of configuration files 120, then obtains the configuration file 210 based on the plurality of hotspot compiling units, and then returns the configuration file 210 to the plurality of electronic devices 100, respectively. Further, the server 201 may also transmit the generated configuration file 210 to the server 200, and the server 200 may further forward the configuration file to the plurality of electronic devices 100 (not shown in the figure). It should be noted that the application distribution platform may be directly run in the server 201, and in this case, the server 201 may directly send the configuration file 210 in the program installation package 230 to the electronic device 130 that has not installed the target application program. If the application distribution platform operates independently, the server 201 may send the configuration file 210 to the application distribution platform, so that the application distribution platform sends the configuration file 210 in the program installation package 230 to the electronic device 130 that has not installed the target application program.
Further, the configuration file mentioned in the subsequent embodiment may be the configuration file 210. The hot spot compiling unit in the newly generated configuration file 210 may be a hot spot compiling unit compiled by the server 200, or may be a hot spot compiling unit not yet running the compiling. In the case that the hotspot compiling unit in the newly generated configuration file 210 is a hotspot compiling unit that has not yet run the compiling, the electronic device that receives the newly generated configuration file 210 may compile before running the target application program, or compile when the target application program is installed. In the case of the hot spot compiling unit compiled by the server 200, the hot spot compiling unit may be compiled by the server 200 based on a hardware environment of the electronic device to be distributed.
The present disclosure will now be described with reference to specific embodiments.
Referring to fig. 4, the application provides a method for pre-compiling an application program, applied to an electronic device, the method includes:
step S110: and detecting the current running state of the electronic equipment.
It should be noted that, in this embodiment, when the electronic device acquires the installation file of the application program from the server, the acquired installation file may carry a configuration file corresponding to the application program in addition to the installation program of the application program itself, where the configuration file may be the configuration file 210 in the foregoing introduction.
In addition, as another mode, the hotspot compiling unit corresponding to the application program may also be stored in another area (that is, in a server that does not store the application program installation package), in this case, when the electronic device initiates an installation file request to the server that stores the installation file, the server that stores the installation file may return redirection information pointing to the server that stores the configuration file to the electronic device, so that the electronic device may initiate a configuration file request to the server that stores the configuration file at the same time. In this case, as a way, the electronic device may trigger to enter an installation stage of the application program after receiving the installation file and the configuration file, so that the electronic device may implement the precompiled hotspot compiling unit in the process of running the installation file.
The operation state of the electronic device may include a plurality of states.
By one approach, the operational state of the electronic device may include a hardware state. It can be understood that, in the operation process of the electronic device, hardware devices such as a processor (CPU), a Graphics Processing Unit (GPU), a memory, and the like included in the electronic device are all in an operating state, so as to complete data processing and data reading and writing operations in the operation process of the electronic device. If the hardware device of the electronic device is in a higher frequency operation state, the operation efficiency of the electronic device may be affected. For example, if the installation process is an installation process of an application, the electronic device may perform decompression of the installation package and creation of a corresponding directory, and even further include a processing process of a file obtained by decompression of the installation package. If the processing resources of the processor are excessively occupied in the process, the installation process of the application program is prolonged. However, if there are still more processing resources left in the processor even during the installation of the application program in the installation process of the application program, the installation process of the application program may be less affected even if other data processing operations are performed. In this case, the running state may include the remaining processing resources of the processor, and if it is detected that the remaining processing resources are not less than the specified resource threshold, the running state is characterized as satisfying the specified condition. Therefore, by the method, the compiling operation of the hotspot compiling unit can be performed only when the condition that the residual processing resource is detected to be not less than the specified resource threshold value in the installation stage, so as to avoid influencing the running performance of the electronic equipment.
Alternatively, the operational state of the electronic device may include the state of a hardware device. It is understood that the electronic device may include hardware devices such as a screen and a sensor. While the hardware device handling different motion states may characterize different use states of the user. For example, if the sensor includes a distance sensor disposed near the front camera and the distance sensor detects that the distance value is smaller than a specified distance threshold, it indicates that the user is currently in a state of answering a call. For example, if the screen is currently handling a breath screen state, it may be characterized that the user is not currently paying attention to the electronic device. In this case, the operation state of the electronic device may include an operation state of the screen, and if the operation state is in a screen-off state, it is determined that the operation state satisfies the specified condition, and if the electronic device is in a screen-on state, it is determined that the specified condition is not satisfied. Therefore, by detecting the running state of the screen, the precompilation operation of the hotspot compiling unit can be performed under the condition that a user does not pay attention to the electronic equipment, so that the interference of the precompilation operation of the hotspot compiling unit on the use of the electronic equipment by the user is reduced.
As yet another alternative, the operational state of the electronic device may include a software state. It should be noted that the electronic device can run a plurality of applications simultaneously, and the larger the number of applications currently in a running state, the slower the electronic device can perform another data processing task. In this manner, the operating state of the electronic device may include the number of applications currently in an operating state.
Further, the operational state of the electronic device may include one or more of the foregoing various manners. It should be noted that, in some cases, the current operating state of the electronic device cannot be accurately determined simply by using one of the foregoing operating state determining manners. For example, some applications in the electronic device may run in the background, or even run in the screen saver state, and if the electronic device detects that the current screen saver state is present, it is directly determined that the running state of the electronic device meets the specified condition, but the current background running application itself occupies more data processing resources, which may further cause performance degradation of the electronic device in the compiling process of the hotspot compiling unit by the electronic device. For example, when the electronic device detects that the electronic device is currently in the screen saver state, but the remaining processing resources of the processor are 10% of the processing resources, if the electronic device determines that the operating state of the electronic device satisfies the specified condition because the electronic device is in the screen saver state alone, the subsequent compiling operation of the hotspot compiling unit is triggered, and further, the remaining processing resources of the processor are reduced to a lower level, and other data processing operations performed by the electronic device in the screen saver state are affected by the recognition.
Then, in order to improve the above problem, the operation state of the electronic device may include an operation state of the hardware device and a hardware state as a way. Optionally, the electronic device may determine that the operating state of the electronic device satisfies the specified condition when it is detected that the electronic device is currently in the breath screen state and the remaining processing resources are not lower than the specified threshold. Wherein, optionally, the specified threshold is lower than the specified resource threshold. It should be noted that, when the electronic device is in the screen-saving state, the user does not pay attention to the operating state of the electronic device with a high probability, in this case, the remaining processing resources may not be strictly limited, that is, the specified threshold value in the case of determining the operating state of the hardware device and the hardware state at the same time may be lower than the specified resource threshold value in the case of taking the hardware state alone as the determination basis.
Alternatively, the electronic device may configure the content of the specified condition according to whether or not it is in application installation. Optionally, if the application is in the installation phase, the specified conditions include: the electronic equipment is in a screen-off state; if the application program is not in the installation stage, the specified conditions comprise: the power of the electronic device meets at least one of a specified power threshold, the available storage space of the electronic device is not less than a specified space threshold, and the temperature of the electronic device is not higher than a specified temperature threshold.
Step S120: and if the running state meets the specified condition and the application program is in the installation stage, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file.
In the embodiment of the present application, the installation phase may be understood as an installation phase of the application program, and may also be understood as an installation phase of the update file of the application program.
It should be noted that, if the electronic device detects that the operating state meets the specified condition, it is characterized that even if the electronic device performs the pre-compiling operation of the hotspot compiling unit at the same time, the remaining processing resources of the electronic device are not over-tight, so that the operating performance of the electronic device is not affected, or that even if the electronic device performs the pre-compiling operation of the hotspot compiling unit at the same time, the remaining processing resources of the electronic device are over-tight, but because the user is in a state where the electronic device is not concerned, the user does not perceive that the remaining processing resources are over-tight, so that the operating performance of the electronic device is not affected.
Step S121: and pre-compiling the hot spot compiling unit.
As one mode, the configuration file acquired by the electronic device in step S120 is a configuration file that has not been compiled yet, and may be understood as a dex file. In this embodiment, the pre-compiling operation on the configuration file may be understood as performing AOT compilation, that is, pre-compiling the configuration file in the dex format and then converting the configuration file into a file in the oat or odex format.
Step S130: and if the running state does not meet the specified condition, periodically detecting whether the electronic equipment meets the specified condition or not until the electronic equipment is detected to meet the specified condition, and performing pre-compiling on the hotspot compiling unit.
It should be noted that, if it is detected in the installation stage that the operating state does not satisfy the specified condition, in order not to affect the current operating state of the electronic device, a pre-compiling operation may be selected in the subsequent operating process. And then, whether the electronic equipment meets the specified condition or not can be periodically detected. For example, whether the specified condition is satisfied may be detected once a day at a fixed time period. After the electronic device finishes compiling the hot compiling unit of the configuration file, the periodic detection of whether the electronic device meets the specified condition or not can be stopped.
According to the application program pre-compiling method, when the running state of the electronic equipment is detected to meet the specified condition and the application program is in the installation stage, the configuration file, corresponding to the application program, storing the hot point compiling unit corresponding to the application program is obtained, and the hot point compiling unit is pre-compiled. Therefore, the running state of the electronic equipment is detected, so that the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced because the hot point compiling unit is directly compiled at the application program installation stage.
Referring to fig. 5, the application provides a method for pre-compiling an application program, applied to an electronic device, the method includes:
step S201: and detecting the current running state of the electronic equipment.
Step S202: and if the running state meets the specified condition and the application program is in the installation stage, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file.
Step S203: and pre-compiling the hot spot compiling unit.
Step S204: and if the running state does not meet the specified condition and the application program is in the installation stage, not performing pre-compiling on the hot spot compiling unit.
Step S205: and if the running state meets the specified condition and the configuration file of the application program is not pre-compiled in the installation stage, acquiring the configuration file corresponding to the application program.
Step S206: and pre-compiling the hot spot compiling unit.
As a mode, in the process of pre-compiling the hotspot compiling unit, if it is detected that the running state of the electronic device is switched to a state that does not meet the specified condition, continuing to complete compiling of the remaining uncompiled hotspot units in the configuration file of the application program; pausing compilation of a configuration file that orders an application that is compiled after the application; and in the suspended state, when the electronic equipment is detected to meet the specified condition, resuming the compiling of the configuration file of the application program compiled after the application program.
According to the application program pre-compiling method, the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition through the mode of detecting the running state of the electronic equipment, so that the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced due to the fact that the hot point compiling unit is directly compiled in the application program installation stage. In addition, in this embodiment, when it is detected that the operating state of the electronic device is switched to a state that does not satisfy the specified condition during the compiling process, the pre-compiling operation of the configuration file of the subsequent application program can be suspended in time, so as to avoid the interference of the compiling operation on the user in time.
Referring to fig. 6, the application provides a method for pre-compiling an application program, which is applied to an electronic device, and the method includes:
step S210: and when the current running state of the electronic equipment is detected.
Step S220: and if the running state does not meet the specified condition, periodically detecting whether the electronic equipment meets the specified condition or not until the electronic equipment is detected to meet the specified condition, and performing pre-compiling on the hotspot compiling unit.
Step S230: and if the running state meets the specified condition and the application program is in the installation stage, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file.
Step S240: and pre-compiling the hot spot compiling unit.
Step S250: and in the process of pre-compiling the hot spot compiling unit, if the running state of the electronic equipment is detected to be switched to the state which does not meet the specified condition, the compiling of the remaining uncompiled hot spot units is suspended.
It should be noted that the operation state of the electronic device may change suddenly, although the compiling operation of the hot compiling unit in the configuration file is triggered because the operation state of the electronic device satisfies the specified condition. However, in the process of pre-compiling the electronic device, the operation state of the electronic device may be changed to not satisfy the specified condition. In this case, in order to avoid the pre-compiling operation from affecting the use of the electronic device by the user, the compiling of the remaining uncompiled hotspot units may be suspended.
Illustratively, the installation process of the application is taken as an example. If the configuration is that the installation operation of the application program is firstly performed in the installation stage including the pre-compiling process of the hotspot compiling unit, then the pre-compiling operation of the hotspot compiling unit is performed, and the end of the installation stage is judged only after the pre-compiling of the hotspot compiling unit is finished. In this case, the compiling time length of the hot spot compiling unit directly affects the length of the installation phase of the application program, and further, when it is detected that the running state of the electronic device is switched to a state that does not satisfy the specified condition, the compiling of the remaining uncompiled hot spot units is suspended, and the electronic device determines that the installation phase of the application program is ended, so as to prevent the compiling operation of the hot spot compiling unit from prolonging the time length of the installation phase of the application program. When the electronic device determines that the installation phase of the application program is finished, a prompt message may be sent, for example, the prompt content may include that the installation of the application program is finished, so that the user may perceive that the installation of the application program is finished.
Step S260: and in the suspended state, when the electronic equipment is detected to meet a recovery condition, the uncompiled hotspot unit is recovered.
It should be noted that, as one mode, in the suspended state, the electronic device has already determined that the application has completed installation of the application, but the hot compiling unit in the configuration file corresponding to the application has not yet completely compiled, and therefore, the running efficiency of the application has not yet been completely optimized. Then the electronic device may periodically detect whether the electronic device satisfies a recovery condition in order to maximize operating efficiency. And if the electronic equipment is detected to meet the recovery condition, recovering to compile the uncompiled hotspot unit.
Alternatively, the recovery condition may be consistent with the contents of the aforementioned specified condition. Optionally, the recovery condition may include the electronic device being in an idle state or in a charging state.
It is understood that the application program may include a plurality of functional modules, and each functional module may include a plurality of hotspot compiling units. Then, if the operation of the functional module is optimized, the hot spot compiling units included in the functional module need to be precompiled. Illustratively, the application a includes a functional module a, a functional module B, and a functional module C. The configuration file corresponding to the application program at least comprises a hot spot compiling unit a, a hot spot compiling unit b, a hot spot compiling unit c, a hot spot compiling unit d, a hot spot compiling unit e and a hot spot compiling unit f. In this case, the hot spot compiling unit a, the hot spot compiling unit b, the hot spot compiling unit c and the hot spot compiling unit d all need to be precompiled in advance, and the operating efficiency corresponding to the functional module a can be improved to the greatest extent.
As a mode, if it is detected that the operating state of the electronic device is switched to a state that does not satisfy the specified condition, the step of suspending compiling the remaining uncompiled hotspot units includes: and if the running state of the electronic equipment is detected to be switched to the state which does not meet the specified condition, after the compiling operation of the currently compiled hotspot compiling unit is continuously completed, the compiling of the remaining uncompiled hotspot units is suspended.
Continuing with the above-mentioned content as an example, if the hot spot compiling unit currently compiled by the electronic device is the hot spot compiling unit b, but only the precompiling operation of half of the codes in the hot spot compiling unit b is completed, the electronic device detects that the running state is switched to the state which does not meet the specified condition, in this case, after the electronic device continues to complete the compiling of the remaining codes in the hot spot compiling unit b, the compiling of the remaining uncompiled hot spot compiling unit c, the hot spot compiling unit d, the hot spot compiling unit e and the hot spot compiling unit f is suspended.
Optionally, if it is detected that the running state of the electronic device is switched to a state that does not satisfy the specified condition, after the compiling operation of the currently compiled hotspot compiling unit is continuously completed, the step of suspending compiling the remaining uncompiled hotspot units includes: if the running state of the electronic equipment is detected to be switched to a state which does not meet the specified condition, detecting a function module to which a hot point compiling unit currently being compiled belongs; and if the functional module belongs to the specified common functional module, after the compiling operation of the currently compiled hotspot compiling unit is continuously completed, the compiling of the remaining uncompiled hotspot units is suspended.
Continuing with the above example, among the functional modules a, B and C included in the application program, the functional module a is a configured common functional module, and the functional modules B and C are non-common functional modules. In this case, if it is detected that the currently compiled hotspot compiling unit is the hotspot compiling unit b, the compiling of the remaining uncompiled hotspot units may be suspended after the compiling operation of the currently compiled hotspot compiling unit is continuously completed. If the currently compiling hot spot compiling unit is the hot spot compiling unit e or the hot spot compiling unit f, then the compiling of all the remaining uncompiled contents is suspended. The all remaining uncompiled content includes remaining uncompiled content of the hot spot compiling unit currently being compiled and remaining hot spot compiling units that have not started compiling.
It should be noted that the foregoing steps S240 and S250 may be performed in parallel.
According to the application program pre-compiling method, the running state of the electronic equipment is detected in the application program installation stage, so that the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced due to the fact that the hot point compiling unit is directly compiled in the application program installation stage. In addition, in this embodiment, in the process of performing precompilation on the hotspot code unit, the running state of the electronic device is still continuously detected, and then when it is detected that the running state of the electronic device is switched to a state that does not satisfy the specified condition, compiling of the remaining uncompiled hotspot units is suspended, and in the suspended state, when it is detected that the electronic device satisfies a recovery condition, compiling of the uncompiled hotspot units is resumed, thereby implementing a more flexible hotspot code compiling mode.
Referring to fig. 7, the application provides a method for pre-compiling an application program, applied to an electronic device, the method includes:
step S310: and detecting the current running state of the electronic equipment.
Step S320: if the running state meets the specified condition and the application program is in the installation stage, detecting whether the application program belongs to the pre-configured application program or not;
step S330: if the application program does not belong to the pre-configured application program, the flow is ended.
Step S340: and if the application program belongs to the preconfigured application program, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file.
Step S341: and pre-compiling the hot spot compiling unit.
Step S350: and if the running state does not meet the specified condition, periodically detecting whether the electronic equipment meets the specified condition or not until the electronic equipment is detected to meet the specified condition, and performing pre-compiling on the hotspot compiling unit.
It should be noted that, in the embodiment of the present application, the configuration file corresponding to the application acquired by the electronic device may be a hotspot compiling unit included in the configuration file corresponding to the application acquired by the electronic device in the embodiment of the present application, which is obtained by a server (for example, the server 200 in fig. 1 or the server 201 in fig. 3) based on a plurality of collected second configuration files.
In this way, the server may obtain a plurality of second configuration files corresponding to the target application program from the plurality of electronic devices, where the second configuration files are used to record the hotspot compiling unit of the target application program.
It should be noted that a plurality of application programs may be run in the electronic device. Each application may be configured with an associated configuration file (profile file) during operation. The configuration file is used for recording a hot spot compiling unit of the application program in the running process. Illustratively, an application a, an application B, and an application C are installed in the electronic device. Application a may correspond to an assigned configuration file a, application B may correspond to an assigned configuration file B, and application C may correspond to an assigned configuration file C. In this case, a hot spot compiling unit of the application program a is recorded in the configuration file a, a hot spot compiling unit of the application program B is recorded in the configuration file B, and a hot spot compiling unit of the application program C is recorded in the configuration file C. The application programs installed for different electronic devices may be different or the same. For example, application a, application B, and application C may all be installed for a plurality of electronic devices.
It is understood that, the target application is an application to which the configuration file belongs and which will perform subsequent steps, and in the embodiment of the present application, the server may determine the target application in various ways.
In one mode, the server may use an application program with a large installation amount as a target application program. Optionally, the electronic device may periodically upload application installation information to the server, where the application installation information includes an application currently installed by the electronic device. The server may count the application installation information periodically uploaded by the plurality of electronic devices, and if it is detected that the installation amount of a certain application is greater than the installation threshold, the application with the installation amount greater than the installation threshold may be used as the target application.
For example, there are 100 electronic devices that upload application installation information to the server, and among 90 electronic devices, application a is installed, and in the case that the installation threshold is 80, the server may use application a as the target application. By the method, the server can timely optimize the operation efficiency of the application program with large installation amount.
Alternatively, the electronic device may determine the target application program in combination with the installation amount and the size of the corresponding configuration file. It should be noted that, different application programs have different sizes of configuration files due to different functions or different operating frequencies, and it is necessary for the electronic device to compile the hot spot compiling unit in the configuration file before the application program is operated, which consumes a certain amount of resources and time, so that for an application program with a smaller configuration file, it may be determined that the operating frequency of the application program is possibly lower, and the server may not process the configuration files to which the application programs with lower operating frequencies belong. Correspondingly, in this way, the application installation information reported by the electronic device may include, in addition to the installed applications, the size of the configuration file to which each application belongs. When the server detects that the number of configuration files of a certain application program in the plurality of electronic devices is larger than the threshold number, the same application program can be used as a target application program.
For example, there are 100 electronic devices that upload application installation information to the server, and among 90 electronic devices, application a is installed, so that each of the applications a installed in the 90 electronic devices has one configuration file (i.e., it can be understood that there are 90 configuration files). If the server identifies that 80 of its 90 configuration files are less than 1kb, then the server will not target application a if the installation threshold is 80, the specified threshold is 10kb, and the threshold number is 50. However, if the server recognizes that 60 (greater than the threshold number 50) of the 90 profiles all have a size of 11-12 kb (greater than the specified threshold of 10kb), then it can determine that application A is the target application.
Alternatively, the server may determine the target application based on the configuration information. In this manner, it may be determined which applications are targeted by a human configuration. For example, the server may take the application programs related to the application program installation information reported by the multiple electronic devices as the application programs to be selected, the operator may select one or more application programs from the application programs to be selected as the selected application programs, and correspondingly, the server stores the selected application programs in the configuration file, in which case, the server may take the application programs configured in the configuration file as the target application programs.
After determining the target application program based on the foregoing manner, the server may further use the configuration file to which the target application program belongs as the second configuration file. In this embodiment, the plurality of second configuration files corresponding to the target application may be understood as configuration files to which the same target application installed in the plurality of electronic devices belongs.
After the plurality of second configuration files are acquired, as a mode, the server may directly deduplicate all hotspot compiling units in the plurality of second configuration files and then use the deduplicated hotspot compiling units as the acquired plurality of hotspot compiling units.
According to the application program pre-compiling method, under the condition that the application program belongs to the pre-configured application program, the mode that the application program installation stage detects the running state of the electronic equipment is detected, so that the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced due to the fact that the hot point compiling unit is directly compiled at the application program installation stage.
Referring to fig. 8, an apparatus 400 for pre-compiling an application program provided by the present application is executed on an electronic device, where the apparatus 400 includes:
a state detection unit 410, configured to detect a current operation state of the electronic device.
In one form, the installation phase includes an installation package installation phase of the application or an update file installation phase of the application.
The information obtaining unit 420 is configured to obtain a configuration file corresponding to the application program if the operating state meets a specified condition and the application program is in an installation stage, where the configuration file stores a hotspot compiling unit corresponding to the application program.
As a mode, the information obtaining unit 420 is further configured to obtain a configuration file corresponding to the application program if the operating state meets a specified condition and the configuration file of the application program is not pre-compiled in the installation stage.
Optionally, if the application is in the installation phase, the specified conditions include: the electronic equipment is in a screen-off state; if the application program is not in the installation stage, the specified conditions comprise: the power of the electronic device meets at least one of a specified power threshold, the available storage space of the electronic device is not less than a specified space threshold, and the temperature of the electronic device is not higher than a specified temperature threshold.
And a compiling unit 430, configured to perform precompilation on the hotspot compiling unit.
As a mode, the compiling unit 430 is further configured to, in the process of performing pre-compiling on the hotspot compiling unit, suspend compiling on remaining uncompiled hotspot units if it is detected that the operating state of the electronic device is switched to a state that does not satisfy the specified condition; and in the suspended state, when the electronic equipment is detected to meet a recovery condition, the uncompiled hotspot unit is recovered.
In this manner, the compiling unit 430 is specifically configured to, if it is detected that the running state of the electronic device is switched to a state that does not satisfy the specified condition, suspend compiling on the remaining uncompiled hotspot units after continuing to complete the compiling operation of the currently compiled hotspot compiling unit. Optionally, the compiling unit 430 is specifically configured to detect a function module to which a hot spot compiling unit currently being compiled belongs if it is detected that the running state of the electronic device is switched to a state that does not satisfy the specified condition; and if the functional module belongs to the specified common functional module, after the compiling operation of the currently compiled hotspot compiling unit is continuously completed, the compiling of the remaining uncompiled hotspot units is suspended.
By one approach, the recovery condition includes: the electronic equipment is in a screen-off state; the electronic device is in a charging state; or the electronic device handles an idle state.
As shown in fig. 9, the state detection unit 410 specifically includes:
an application detection subunit 411, configured to detect whether the application belongs to a preconfigured application when the application is in an installation phase of the application;
and a state detection subunit 412, configured to detect a current operating state of the electronic device if the current operating state belongs to the preconfigured application.
It should be noted that, in the present application, it is a prior art that can be specifically applied to how to encode audio data according to the audio encoding type, and the present application will not be described in detail.
An electronic device provided by the present application will be described with reference to fig. 10.
Referring to fig. 10, based on the image processing method and apparatus, another electronic device 200 capable of executing the method for pre-compiling an application program is provided in the embodiment of the present application. The electronic device 200 includes one or more processors 102 (only one shown), memory 104, and network module 106 coupled to each other. The memory 104 stores programs that can execute the content of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
Processor 102 may include one or more processing cores, among other things. The processor 102 interfaces with various components throughout the electronic device 100 using various interfaces and circuitry to perform various functions of the electronic device 100 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 104 and invoking data stored in the memory 104. Alternatively, the processor 102 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 102 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 102, but may be implemented by a communication chip.
The Memory 104 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 104 may be used to store instructions, programs, code sets, or instruction sets. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
The network module 106 is configured to receive and transmit electromagnetic waves, and achieve interconversion between the electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, such as a wireless access point. The network module 106 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The network module 106 may also be used as a network adapter for the electronic device 200 to access the network directly through a line connection. The network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network.
Referring to fig. 11, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
In summary, according to the application precompilation method, device and electronic device provided by the application, when it is detected that the operating state of the electronic device meets the specified condition and the application is in the installation stage, the configuration file corresponding to the application and storing the hot point compiling unit corresponding to the application is obtained, and the hot point compiling unit is precompiled. Therefore, the running state of the electronic equipment is detected, so that the pre-compiling operation of the hot point compiling unit in the configuration file can be carried out only when the running state meets the specified condition, the compiling time of the hot point compiling unit has configurability, and the running performance of the electronic equipment cannot be influenced because the hot point compiling unit is directly compiled at the application program installation stage.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for pre-compiling an application program, which is applied to an electronic device, the method comprising:
detecting the current running state of the electronic equipment;
if the running state meets the specified condition and the application program is in the installation stage, acquiring a configuration file corresponding to the application program, wherein a hotspot compiling unit corresponding to the application program is stored in the configuration file;
and pre-compiling the hot spot compiling unit.
2. The method of claim 1, further comprising:
and if the running state does not meet the specified condition and the application program is in the installation stage, not performing pre-compiling on the hot spot compiling unit.
3. The method of claim 2, wherein if the operating status does not satisfy the specified condition and the application program is in an installation stage, without performing pre-compilation on the hotspot compiling unit, the method further comprises:
if the running state meets the specified condition and the configuration file of the application program is not pre-compiled in the installation stage, acquiring the configuration file corresponding to the application program;
and pre-compiling the hot spot compiling unit.
4. The method according to any one of claims 1-3, further comprising:
in the process of pre-compiling the hotspot compiling unit, if the running state of the electronic equipment is detected to be switched to a state which does not meet the specified condition, continuously finishing compiling the remaining uncompiled hotspot units in the configuration file of the application program;
pausing compilation of a configuration file that orders an application that is compiled after the application;
and in the suspended state, when the electronic equipment is detected to meet the specified condition, resuming the compiling of the configuration file of the application program compiled after the application program.
5. A method according to any one of claims 1 to 3, wherein the specified conditions include, if the application is in an installation phase: the electronic equipment is in a screen-off state;
if the application program is not in the installation stage, the specified conditions comprise: the power of the electronic device meets at least one of a specified power threshold, the available storage space of the electronic device is not less than a specified space threshold, and the temperature of the electronic device is not higher than a specified temperature threshold.
6. The method according to claim 1, wherein the step of obtaining the configuration file corresponding to the application program further comprises:
detecting whether the application program belongs to a pre-configured application program;
and if the application program belongs to the pre-configured application program, executing the configuration file corresponding to the acquired application program.
7. The method of claim 1, wherein the installation phase comprises an installation package installation phase of the application or an update file installation phase of the application.
8. An apparatus for application precompilation, operable on an electronic device, the apparatus comprising:
the state detection unit is used for detecting the current running state of the electronic equipment;
the information acquisition unit is used for acquiring a configuration file corresponding to the application program if the running state meets the specified condition and the application program is in an installation stage, wherein the configuration file stores a hot spot compiling unit corresponding to the application program;
and the compiling unit is used for carrying out pre-compiling on the hot spot compiling unit.
9. An electronic device comprising one or more processors and memory;
wherein one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-7.
10. A computer-readable storage medium, having program code stored therein, wherein the program code when executed by a processor performs the method of any of claims 1-7.
CN201911349773.XA 2019-12-24 2019-12-24 Application program pre-compiling method and device and electronic equipment Pending CN113031955A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911349773.XA CN113031955A (en) 2019-12-24 2019-12-24 Application program pre-compiling method and device and electronic equipment
PCT/CN2020/136887 WO2021129489A1 (en) 2019-12-24 2020-12-16 Application precompiling method and apparatus, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911349773.XA CN113031955A (en) 2019-12-24 2019-12-24 Application program pre-compiling method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN113031955A true CN113031955A (en) 2021-06-25

Family

ID=76452166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911349773.XA Pending CN113031955A (en) 2019-12-24 2019-12-24 Application program pre-compiling method and device and electronic equipment

Country Status (2)

Country Link
CN (1) CN113031955A (en)
WO (1) WO2021129489A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114895948A (en) * 2022-06-21 2022-08-12 Oppo广东移动通信有限公司 Application program processing method and device, electronic equipment and readable storage medium
CN116661909A (en) * 2023-08-01 2023-08-29 北京小米移动软件有限公司 Application program running method and device, terminal equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861730A (en) * 2017-10-27 2018-03-30 维沃移动通信有限公司 The processing method and mobile terminal of a kind of application program
CN108804110A (en) * 2018-06-15 2018-11-13 Oppo(重庆)智能科技有限公司 A kind of data processing method, data processing equipment and mobile terminal
CN109960507A (en) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 Compile optimization method, device, storage medium, intelligent terminal and server

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104951335B (en) * 2015-05-22 2019-01-04 小米科技有限责任公司 The processing method and processing device of application program installation kit
CN105022647B (en) * 2015-07-15 2019-05-14 深圳市金立通信设备有限公司 A kind of control method and terminal of application installation
CN106775828B (en) * 2016-11-25 2020-07-03 Oppo广东移动通信有限公司 Application program installation method and device and computer equipment
CN111061484B (en) * 2019-11-28 2023-05-02 Oppo广东移动通信有限公司 Code compiling method, device, server, user terminal and readable medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861730A (en) * 2017-10-27 2018-03-30 维沃移动通信有限公司 The processing method and mobile terminal of a kind of application program
CN109960507A (en) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 Compile optimization method, device, storage medium, intelligent terminal and server
CN108804110A (en) * 2018-06-15 2018-11-13 Oppo(重庆)智能科技有限公司 A kind of data processing method, data processing equipment and mobile terminal

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114895948A (en) * 2022-06-21 2022-08-12 Oppo广东移动通信有限公司 Application program processing method and device, electronic equipment and readable storage medium
CN116661909A (en) * 2023-08-01 2023-08-29 北京小米移动软件有限公司 Application program running method and device, terminal equipment and storage medium
CN116661909B (en) * 2023-08-01 2024-07-09 北京小米移动软件有限公司 Application program running method and device, terminal equipment and storage medium

Also Published As

Publication number Publication date
WO2021129489A1 (en) 2021-07-01

Similar Documents

Publication Publication Date Title
CN109960507B (en) Compiling optimization method and device, storage medium, intelligent terminal and server
CN111061484B (en) Code compiling method, device, server, user terminal and readable medium
CN111078318B (en) Processing method, device and system of configuration file and storage medium
CN107402790B (en) Application program starting method and device, storage medium and terminal
CN110764906B (en) Memory recovery processing method and device, electronic equipment and storage medium
WO2021057619A1 (en) Memory reclamation method and apparatus, electronic device, and storage medium
WO2021057622A1 (en) Garbage collection method, device, electronic apparatus, and storage medium
CN110765031B (en) Data storage method and device, mobile terminal and storage medium
CN106970816B (en) Software upgrading processing method and device and audio playing equipment
CN111050378B (en) Network searching method and device and electronic equipment
CN110727605B (en) Memory recovery method and device and electronic equipment
WO2021129489A1 (en) Application precompiling method and apparatus, electronic device, and storage medium
CN112988169A (en) Application installation method and device, terminal equipment, server and storage medium
CN114175748A (en) Communication frequency adjusting method and device, electronic equipment and storage medium
CN111273769B (en) Equipment control method and device, electronic equipment and storage medium
WO2021115178A1 (en) Application program pre-compilation method and apparatus, server and storage medium
CN111984413A (en) Memory recovery method and device, electronic equipment and storage medium
CN117724852B (en) Cloud computer computing resource allocation method and device
CN111104180A (en) Application program optimization method and device, storage medium and electronic equipment
WO2021102849A1 (en) Resource acquisition method and apparatus, and electronic device
CN112540769A (en) Compiling processing method, device, electronic equipment and storage medium
CN112052089B (en) Memory recovery method and device and electronic equipment
CN115587049A (en) Memory recovery method and device, electronic equipment and storage medium
CN113032035B (en) Configuration file processing method and device and electronic equipment
CN116610648A (en) Log storage method and device, electronic equipment and storage medium

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210625