Application program installation method and device based on compilation optimization, equipment and medium
By splitting the baseline configuration file by scenario and compiling it in idle state, the problem of excessive system resource consumption caused by the large size of the baseline configuration file was solved, thereby improving system performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies, when generating large baseline configuration files, result in excessive consumption of system memory resources, affecting system performance and user experience.
The application's baseline configuration file is split into scenarios, and non-critical configuration files are compiled in idle state to reduce the amount of hot code processed in a single compilation and avoid system resource consumption.
Reduce memory pressure, ensure system performance and compilation stability, improve user experience, and ensure the compilation optimization effect of large applications.
Smart Images

Figure CN119127233B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an application installation method, apparatus, device and medium based on compilation optimization. Background Technology
[0002] With the development of computer technology, how to improve the smoothness of applications by increasing their response speed, thereby enhancing the user experience, has become an urgent technical problem to be solved.
[0003] One possible implementation is to generate a baseline profile file based on the application's hotspot code and then integrate it into the application's APK file (Android application package). In this case, while installing the application based on the APK file, the application's hotspot code can be pre-compiled into directly executable machine code according to the baseline profile, thereby improving the application's running speed.
[0004] However, this implementation method consumes a large amount of system memory resources when the baseline configuration file is large, which affects system performance and user experience. Summary of the Invention
[0005] This application provides a method, apparatus, device, and medium for installing applications based on compilation optimization, in order to save resources, improve performance, and enhance user experience.
[0006] In a first aspect, embodiments of this application provide an application installation method based on compilation optimization, including:
[0007] In response to an installation operation on a target application, an application package corresponding to the target application is obtained; wherein the application package is used to install the target application into an electronic device;
[0008] Extract the baseline configuration files for each scenario included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; the baseline configuration file indicates the hotspot code when implementing the functions supported by the application interface;
[0009] Install the target application based on the application package, and compile the hotspot code corresponding to the first configuration file based on the first configuration file that meets the compilation requirements during installation in the baseline configuration files of each scenario;
[0010] If the electronic device is determined to be in an idle state, based on the second configuration file (other than the first configuration file) in the baseline configuration files for each scenario, hotspot code corresponding to the second configuration file is compiled to complete the installation of the target application.
[0011] In one possible implementation, determining that the electronic device is in an idle state includes:
[0012] Based on the status monitoring service running in the electronic device, obtain the resource consumption information of the electronic device;
[0013] If it is determined that the resource consumption information of the electronic device meets the preset resource consumption requirements, then the electronic device is determined to be in an idle state.
[0014] In one possible implementation, after compiling the hotspot code corresponding to the first configuration file, the method further includes:
[0015] If it is determined that the electronic device is not in an idle state, then after a preset time interval, the electronic device is checked again to see if it is in an idle state.
[0016] In one possible implementation, before compiling the hotspot code corresponding to the first configuration file, the method further includes:
[0017] Obtain the target mapping table included in the application package; wherein the target mapping table is used to indicate the association between each baseline configuration file and the corresponding compilation method; the compilation method is used to indicate whether to compile the baseline configuration file during installation;
[0018] Based on the baseline configuration files associated with the compilation method indicated during installation included in the target mapping table, a first configuration file that meets the compilation requirements during installation is determined from the baseline configuration files in each scenario.
[0019] In one possible implementation, before obtaining the application package corresponding to the target application in response to the installation operation of the target application, the method further includes:
[0020] Identify the hotspot codes for each scenario included in the target application; wherein the hotspot codes for each scenario indicate the codes invoked when executing the functions supported by each level of the application interface;
[0021] Based on the hotspot code in each scenario, a baseline configuration file corresponding to each scenario is generated;
[0022] Based on the baseline configuration files corresponding to each scenario, the application package corresponding to the target application is determined.
[0023] In one possible implementation, hotspot code in various scenarios included in the target application is identified, including:
[0024] Obtain the test log data corresponding to the target application; wherein, the test log data indicates the log data obtained when the target application executes the functions supported by each level of the application interface during the testing phase;
[0025] Based on the test log data, hotspot code in each scenario is identified.
[0026] Secondly, embodiments of this application provide an application installation apparatus based on compilation optimization, comprising:
[0027] A response unit is configured to, in response to an installation operation on a target application, obtain an application package corresponding to the target application; wherein the application package is used to install the target application into an electronic device;
[0028] An extraction unit is used to extract baseline configuration files for various scenarios included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; and the baseline configuration file indicates the hotspot code used to implement the functions supported by the application interface.
[0029] The first compilation unit is used to install the target application based on the application package, and to compile hotspot code corresponding to the first configuration file based on the baseline configuration file in each scenario, which meets the compilation requirements during installation.
[0030] The second compilation unit is used to, when it is determined that the electronic device is in an idle state, compile hotspot code corresponding to the second configuration file based on the baseline configuration file in each scenario, excluding the first configuration file, and complete the installation of the target application.
[0031] In one possible implementation, the second compilation unit is used for:
[0032] Based on the status monitoring service running in the electronic device, obtain the resource consumption information of the electronic device;
[0033] If it is determined that the resource consumption information of the electronic device meets the preset resource consumption requirements, then the electronic device is determined to be in an idle state.
[0034] In one possible implementation, after compiling the hotspot code corresponding to the first configuration file, the second compilation unit is further configured to:
[0035] If it is determined that the electronic device is not in an idle state, then after a preset time interval, the electronic device is checked again to see if it is in an idle state.
[0036] In one possible implementation, the device further includes a first determining unit, configured to:
[0037] Before compiling the hotspot code corresponding to the first configuration file, a target mapping table included in the application package is obtained; wherein, the target mapping table is used to indicate the association between each baseline configuration file and the corresponding compilation method; the compilation method is used to indicate whether to compile the baseline configuration file during installation;
[0038] Based on the baseline configuration files associated with the compilation method indicated during installation included in the target mapping table, a first configuration file that meets the compilation requirements during installation is determined from the baseline configuration files in each scenario.
[0039] In one possible implementation, the device further includes a second determining unit for:
[0040] In response to the installation operation of the target application, before obtaining the application package corresponding to the target application, the hot spot code in each scenario included in the target application is determined; wherein, the hot spot code in each scenario indicates the code called when executing the functions supported by each level of the application interface;
[0041] Based on the hotspot code in each scenario, a baseline configuration file corresponding to each scenario is generated;
[0042] Based on the baseline configuration files corresponding to each scenario, the application package corresponding to the target application is determined.
[0043] In one possible implementation, the second determining unit is configured to:
[0044] Obtain the test log data corresponding to the target application; wherein, the test log data indicates the log data obtained when the target application executes the functions supported by each level of the application interface during the testing phase;
[0045] Based on the test log data, hotspot code in each scenario is identified.
[0046] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0047] The memory stores computer-executed instructions;
[0048] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0049] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0050] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0051] The application installation method, apparatus, device, and medium based on compilation optimization provided in this application embodiment can achieve scenario-based splitting of baseline configuration files by storing baseline configuration files for each scenario included in the target application in the application package before installation. Subsequently, in response to the installation operation of the target application, the application package corresponding to the target application can be obtained, and then the baseline configuration files for each scenario included in the application package can be extracted. At this point, on the one hand, the target application can be installed based on the application package, and hotspot code corresponding to the first configuration file that meets the compilation requirements during installation can be compiled based on the baseline configuration files for each scenario. This implementation reduces the amount of hotspot code processed in a single compilation, thereby alleviating memory pressure and ensuring both system performance and compilation stability while guaranteeing the user experience of the target application. On the other hand, when it is determined that the electronic device is in an idle state, hotspot code corresponding to the second configuration file can be compiled based on the second configuration file (excluding the first configuration file) in the baseline configuration files for each scenario, completing the installation of the target application. At this point, the remaining hotspot code can be compiled while the electronic device is idle, avoiding the system performance degradation caused by compilation optimization occupying system resources, which would affect the user experience of the electronic device. The above implementation methods can also effectively ensure the compilation and optimization effects of large applications. Attached Figure Description
[0052] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0053] Figure 1 A flowchart illustrating an application installation method based on compilation optimization provided in this application embodiment;
[0054] Figure 2 A flowchart illustrating another application installation method based on compilation optimization provided in this application embodiment;
[0055] Figure 3 This is a schematic diagram of the structure of a target mapping table provided in an embodiment of this application;
[0056] Figure 4 A schematic diagram of an application installation device based on compiler optimization provided for the implementation of this application;
[0057] Figure 5 A schematic diagram of another application installation device based on compiler optimization provided for the implementation of this application;
[0058] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0059] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0060] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.
[0061] In the Android system of smart cockpits, the smoothness of user application operation has become an important indicator. Therefore, how to improve the smoothness of applications by improving their response speed, and thus improve the user experience, has become an urgent technical problem to be solved.
[0062] One possible implementation is to improve application responsiveness and thus enhance its smoothness by optimizing hotspot code based on configuration files. Specifically, hotspot code can be identified during the application's development and design phase. A baseline configuration file is then generated based on this identified code and integrated into the application's APK file. Simultaneously, when installing the application using the APK file, the baseline configuration file can be extracted. The ART (Android Runtime) virtual machine then uses AOT (Ahead-of-Time) compilation, guided by the baseline configuration file, to pre-compile the hotspot code into directly executable machine code. This improves application speed and efficiency, ultimately enhancing its smoothness.
[0063] However, this implementation method consumes a large amount of system memory resources when the baseline configuration file is large, which can easily lead to slow compilation. This not only affects the installation efficiency of the application, but also the performance of the system, and thus the user experience.
[0064] The application installation method based on compilation optimization provided in this application splits the baseline configuration file corresponding to the application according to the various scenarios included in the application, obtains the baseline configuration file for each scenario, and saves resource consumption and improves system performance by staggered installation, thereby solving the above-mentioned technical problems.
[0065] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0066] Figure 1 A flowchart illustrating an application installation method based on compiler optimization provided in this application embodiment is shown below. Figure 1 As shown, the method includes:
[0067] S101. In response to the installation operation of the target application, obtain the application package corresponding to the target application.
[0068] The application package is used to install the target application onto the electronic device.
[0069] In one example, an application package can be understood as an APK file.
[0070] In one example, before responding to the installation operation of the target application, the target application needs to be developed, tested, and an application package of the target application needs to be generated so that the target application can be installed based on the application package.
[0071] At this point, the application package corresponding to the target application can include not only the files and resources required for the application to run, but also the baseline configuration files corresponding to the hotspot code in various scenarios of the target application.
[0072] At this point, in response to the installation operation of the target application, the application package corresponding to the target application can be obtained, and the target application can be installed according to the application package, as detailed in the following steps.
[0073] S102. Extract the baseline configuration files for each scenario included in the application package corresponding to the target application.
[0074] Among them, each scenario indicates the application interface at each level corresponding to the target application; the baseline configuration file indicates the hotspot code when implementing the functions supported by the application interface.
[0075] At this point, the baseline configuration files for each scenario can be understood as the baseline configuration files for the hotspot code corresponding to each level of the application interface.
[0076] In one example, the various levels of application interfaces corresponding to the target application can indicate the target application's launch screen, home screen, and various levels of menu screens.
[0077] The startup screen can be an interface that indicates the launch of the target application. For example, the startup screen can be an interface that contains the program identifier corresponding to the target application. In this case, the target application can be launched by triggering the program identifier.
[0078] The homepage can be understood as the homepage of the target application that you enter after launching the target application. At this time, the hotspot code that implements the functions supported by the homepage is the hotspot code for the corresponding scenario of the homepage.
[0079] Each menu interface can be understood as the interface that is navigated to after triggering the functions supported by the home page. At this time, the hotspot code that implements the functions supported by each menu interface is the hotspot code for the corresponding scenario of each menu interface.
[0080] In one example, the menu interfaces at each level can include N levels of menu interfaces, where N is a natural number greater than 0. The specific value of N is not limited here. For example, if N is 3, then the menu interfaces at each level can include: a first-level menu interface, a second-level menu interface, and a third-level menu interface. The first-level menu interface indicates the first interface to navigate to after triggering a function supported by the homepage interface; the second-level menu interface indicates the interface to navigate to after triggering a function supported by the first-level menu interface; and the third-level menu interface indicates the interface to navigate to after triggering a function supported by the second-level menu interface.
[0081] S103. Install the target application based on the application package, and compile the hotspot code corresponding to the first configuration file that meets the compilation requirements during installation, based on the baseline configuration file in each scenario.
[0082] In one example, to avoid memory pressure caused by compiling multiple baseline configuration files simultaneously when installing the target application, which in turn affects system performance, the compilation method of the baseline configuration files for each scenario can be pre-set. This determines which baseline configuration files need to be compiled during installation and which do not.
[0083] In one example, a baseline configuration file compiled at installation time is needed to quickly respond to user triggers on the target application, thereby improving the target application's response speed. Therefore, one or more application interfaces that require a fast response can be selected from the various levels of application interfaces corresponding to the target application, and the baseline configuration file corresponding to the scenario of the interface that requires a fast response can be determined as the baseline configuration file that needs to be compiled at installation time.
[0084] Among them, the interfaces that need to respond quickly in each level of the target application can be determined based on the usage frequency of each level of the target application's interface. For example, the interfaces that need to respond quickly may only include the startup screen, or they may include the startup screen and the first-level menu screen, etc.
[0085] In one example, after determining the baseline configuration file (i.e., the first configuration file) that needs to be compiled during installation, the hotspot code corresponding to the first configuration file can be compiled and stored at the same time as the target application is installed, resulting in machine code that can be run directly.
[0086] S104. When it is determined that the electronic device is in an idle state, based on the second configuration file in the baseline configuration file for each scenario (excluding the first configuration file), compile the hotspot code corresponding to the second configuration file to complete the installation of the target application.
[0087] In one example, when there are a large number of secondary configuration files, they can be compiled sequentially according to the execution order of each scenario. In this case, the secondary configuration files can be compiled in one or more stages, and the installation process of the target application can be completed after the baseline configuration files for each scenario have been compiled.
[0088] As described above, this embodiment of the application can save the baseline configuration files for each scenario included in the target application in the application package before installing the target application, thus realizing the splitting of the baseline configuration files by scenario. Then, in response to the installation operation of the target application, the application package corresponding to the target application can be obtained, and then the baseline configuration files for each scenario included in the application package can be extracted. At this point, on the one hand, the target application can be installed based on the application package, and based on the first configuration file in the baseline configuration files for each scenario that meets the compilation requirements during installation, hotspot code corresponding to the first configuration file can be compiled. This implementation reduces the amount of hotspot code processed in a single compilation, thereby alleviating memory pressure and ensuring both system performance and compilation stability while guaranteeing the user experience of the target application. On the other hand, when it is determined that the electronic device is in an idle state, based on the second configuration file in the baseline configuration files for each scenario (excluding the first configuration file), hotspot code corresponding to the second configuration file can be compiled to complete the installation of the target application. At this point, the remaining hotspot code can be compiled while the electronic device is idle, avoiding the system performance degradation caused by compilation optimization occupying system resources, which would affect the user experience of the electronic device. Through the above implementation, the compilation optimization effect of large applications can also be effectively guaranteed.
[0089] Figure 2 A flowchart illustrating another application installation method based on compiler optimization provided in this application embodiment is shown below. Figure 2 As shown, the method includes:
[0090] S201. Identify the hotspot code in each scenario included in the target application.
[0091] Among them, the hot spot code in each scenario indicates the code called when executing the functions supported by the application interface at each level.
[0092] In one example, the hotspot codes in each scenario indicate the code that is called at a preset frequency / number of times when executing the functions supported by each level of the application interface. In this case, the hotspot code can be used to implement one or more functions.
[0093] In one example, when determining the hotspot code in various scenarios of the target application, you can first obtain the test log data corresponding to the target application; then, based on the test log data, determine the hotspot code in each scenario.
[0094] Among them, test log data indicates the log data obtained by the target application when it executes the functions supported by the application interface at each level during the testing phase.
[0095] In this embodiment of the application, log printing code can be pre-embedded at different locations in the target application during the development and design phase of the target program. At this time, the test log data corresponding to the target application can be obtained through the pre-embedded log printing code. The obtained test log data includes the called code.
[0096] At this point, assuming that the application interfaces corresponding to the target application are: startup interface, home interface, first-level menu interface, and second-level menu interface, then during the testing phase of the target application, all the functions supported by the startup interface, all the functions supported by the home interface, all the functions supported by the first-level menu interface, and all the functions supported by the second-level menu interface can be triggered sequentially to obtain test log data in each scenario.
[0097] Then, based on the test log data in each scenario and the code call frequency / number determined by the test log data, the hot code in each scenario can be identified.
[0098] This implementation method can accurately and effectively determine the relevant information of the code called by the target application when executing various functions by pre-embedding log printing code in different locations of the target application, thereby improving the comprehensiveness and accuracy of the identified hotspot code.
[0099] S202. Based on the hotspot code in each scenario, generate a baseline configuration file corresponding to each scenario.
[0100] At this point, the baseline configuration file can be used to locate the hot code and compile it.
[0101] S203. Based on the baseline configuration files corresponding to each scenario, determine the application package corresponding to the target application.
[0102] In one example, after obtaining the baseline configuration files for each scenario, the compilation method for the corresponding baseline configuration files can be determined based on the usage frequency of each scenario, thereby determining whether to compile the baseline configuration files during installation. Then, the baseline configuration files for each scenario and their corresponding compilation methods can be packaged into the application package corresponding to the target application.
[0103] This implementation method first obtains the hotspot code for each scenario, and then determines the corresponding baseline configuration file for each scenario based on the hotspot code. This avoids the problem of a single baseline configuration file for the target application being too large, which would consume excessive memory resources when compiling the hotspot code based on the baseline configuration file. Simultaneously, the compilation method for the baseline configuration files corresponding to each scenario can be set to avoid compiling multiple baseline configuration files simultaneously. Therefore, when installing the target application according to the application package, file-based and time-based compilation optimization of the target application can be achieved.
[0104] S204. In response to the installation operation of the target application, obtain the application package corresponding to the target application.
[0105] The application package is used to install the target application onto the electronic device.
[0106] In one example, this step can be referred to the content described in S101 above, and will not be repeated in detail here.
[0107] S205. Extract the baseline configuration files for each scenario included in the application package corresponding to the target application.
[0108] Among them, each scenario indicates the application interface at each level corresponding to the target application; the baseline configuration file indicates the hot spot code corresponding to the application interface.
[0109] In one example, this step can be referred to the content described in S102 above, and will not be repeated in detail here.
[0110] S206. Install the target application based on the application package.
[0111] In one example, while installing the target application based on the application package, the steps described in S207 to S209 below can also be performed.
[0112] S207. Obtain the target mapping table included in the application package.
[0113] The target mapping table indicates the association between each baseline configuration file and its corresponding compilation method; the compilation method indicates whether to compile the baseline configuration file during installation.
[0114] In one example, the compilation method can be either compile at installation time or deferred compilation. In this case, if the compilation method is deferred compilation, it indicates that the baseline configuration file will not be compiled at installation time.
[0115] In another example, the compilation method can also indicate compilation priority. For example, the compilation method can be any of the following: first priority, second priority, ..., and so on. There is no limit to the number of compilation priorities indicated by the compilation method; it is up to actual needs. In this case, the baseline configuration file corresponding to "first priority" can be compiled during installation, and the remaining baseline configuration files can be compiled sequentially according to the compilation priority order when the electronic device is idle.
[0116] At this point, the target mapping table may include the file identification information of the baseline configuration file (wherein the file identification information is used to uniquely identify the baseline configuration file, and the file identification information may be associated with the scene), and the compilation method corresponding to the file identification information of the baseline configuration file. For example, the file identification information of the baseline configuration file corresponding to the startup screen may be "startup file" (or "startup screen scene", etc.). At this point, the compilation method associated with the "startup file" may be "compile at installation" or "first priority", etc.
[0117] See one example. Figure 3 , Figure 3 This is a schematic diagram of the structure of a target mapping table provided in an embodiment of this application, as shown below. Figure 3 As shown, suppose the target application includes the following scenarios: startup screen scenario, home screen scenario, other screen scenario 1 (e.g., first-level menu scenario), and other screen scenario N (e.g., N-level menu scenario). Then, as... Figure 3 As shown, the compilation methods corresponding to each scenario / baseline configuration file are: Startup screen scenario -> compile during installation, home screen scenario -> compile during installation, other screen scenario 1 -> delayed compilation, other screen scenario N -> delayed compilation.
[0118] S208. Based on the baseline configuration files associated with the compilation method indicated during installation included in the target mapping table, determine the first configuration file that meets the compilation requirements during installation from the baseline configuration files in each scenario.
[0119] In one possible implementation, the embodiments of this application may also determine the naming method of the baseline configuration file based on the usage frequency of the application interface corresponding to each scenario when generating the baseline configuration file, so as to determine the first configuration file that meets the compilation requirements during installation based on the naming of the baseline configuration file.
[0120] In this implementation, the first configuration file that meets the compilation requirements during installation can be determined from the baseline configuration files in various scenarios based on the target mapping table or the file name of the baseline configuration file. This allows the baseline configuration file that needs to be compiled during installation to be determined according to the actual usage requirements of the scenario. This not only improves the flexibility and diversity of compilation optimization during installation, but also ensures the smoothness of the target application, reduces the compilation optimization pressure during installation, and thus improves the performance of the system.
[0121] S209. Based on the baseline configuration files for each scenario, select the first configuration file that meets the compilation requirements during installation, and compile the hotspot code corresponding to the first configuration file.
[0122] S210. Obtain resource consumption information of the electronic device based on the status monitoring service running in the electronic device.
[0123] In one example, the status monitoring service can continuously monitor the resource consumption information of the system within the electronic device. This resource consumption information may include, but is not limited to, the following: CPU utilization, memory utilization, and IO (Input / Output) operation frequency.
[0124] S211. If it is determined that the resource consumption information of the electronic device meets the preset resource consumption requirements, then the electronic device is determined to be in an idle state.
[0125] In one example, the preset resource consumption requirement indicates the minimum resource consumption information corresponding to the electronic device, or it can indicate the maximum value of the minimum resource consumption information within the allowable error range. The minimum resource consumption information corresponding to the electronic device can be obtained by averaging the minimum daily resource consumption of the electronic device within a preset historical time range, or it can be determined based on the time when the electronic device consumes the minimum resources, as specified by the staff's experience.
[0126] At this point, after obtaining the resource consumption information of the electronic device, it is possible to determine whether the electronic device is in an idle state based on the resource consumption information.
[0127] Specifically, if the resource consumption information of the electronic device is less than or equal to the resource consumption information corresponding to the preset resource consumption requirement, it can be determined that the resource consumption information of the electronic device meets the preset resource consumption requirement. At this time, it can be determined that the electronic device is in an idle state.
[0128] For example, if it is determined that an electronic device consumes the fewest resources at 2 AM, then the resource consumption information corresponding to 2 AM can be identified as the minimum resource consumption information. In this case, if the current resource consumption information of the electronic device matches the minimum resource consumption information, the electronic device can be confirmed to be in an idle state.
[0129] Alternatively, suppose the allowable error range indicates a range of 5% above or below the minimum resource consumption information (the allowable error range is not limited here, but is based on actual needs). In this case, if the current resource consumption information of the electronic device is less than or equal to the value after 5% above the minimum resource consumption information, then the electronic device is confirmed to be in an idle state, etc.
[0130] S212. When it is determined that the electronic device is in an idle state, based on the second configuration file in the baseline configuration file for each scenario (excluding the first configuration file), compile the hotspot code corresponding to the second configuration file to complete the installation of the target application.
[0131] This implementation allows the second configuration file to be compiled when the electronic device is idle, which not only improves compilation efficiency but also ensures the performance of the system within the electronic device, thereby guaranteeing the user experience.
[0132] In one example, if it is determined that the electronic device is not in an idle state, then after a preset time interval, the electronic device is checked again to see if it is in an idle state.
[0133] This implementation method can poll whether the electronic device is in a non-idle state at preset time intervals until the baseline configuration files for each scenario included in the target application are compiled, thereby completing the compilation optimization of the target application. At the same time, the polling method can further save system resources and improve system performance.
[0134] Figure 4 A schematic diagram of a compilation-optimized application installation device provided for the implementation of this application is shown below. Figure 4 As shown, the application installation device 400 based on compilation optimization provided in this embodiment includes:
[0135] The response unit 401 is used to obtain the application package corresponding to the target application in response to the installation operation of the target application; wherein the application package is used to install the target application into the electronic device.
[0136] Extraction unit 402 is used to extract baseline configuration files for each scenario included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; and the baseline configuration file indicates the hotspot code when implementing the functions supported by the application interface.
[0137] The first compilation unit 403 is used to install the target application based on the application package, and to compile the hot spot code corresponding to the first configuration file based on the baseline configuration file in each scenario, which meets the compilation requirements during installation.
[0138] The second compilation unit 404 is used to compile hotspot code corresponding to the second configuration file based on the baseline configuration file in each scenario, excluding the first configuration file, when it is determined that the electronic device is in an idle state, and to complete the installation of the target application.
[0139] Figure 5 A schematic diagram of another application installation apparatus based on compiler optimization provided for the implementation of this application is shown below. Figure 5 As shown, the application installation device 500 based on compilation optimization provided in this embodiment includes:
[0140] The response unit 501 is used to obtain the application package corresponding to the target application in response to the installation operation of the target application; wherein the application package is used to install the target application into the electronic device.
[0141] Extraction unit 502 is used to extract baseline configuration files for each scenario included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; and the baseline configuration file indicates the hotspot code when implementing the functions supported by the application interface.
[0142] The first compilation unit 503 is used to install the target application based on the application package, and to compile the hot spot code corresponding to the first configuration file based on the baseline configuration file in each scenario, which meets the compilation requirements during installation.
[0143] The second compilation unit 504 is used to compile hotspot code corresponding to the second configuration file based on the baseline configuration file in each scenario, excluding the first configuration file, when it is determined that the electronic device is in an idle state, and to complete the installation of the target application.
[0144] In one possible implementation, the second compilation unit 504 is used for:
[0145] Based on the status monitoring service running in the electronic device, obtain the resource consumption information of the electronic device;
[0146] If it is determined that the resource consumption information of the electronic device meets the preset resource consumption requirements, then the electronic device is determined to be in an idle state.
[0147] In one possible implementation, after compiling the hotspot code corresponding to the first configuration file, the second compilation unit 504 is further configured to:
[0148] If it is determined that the electronic device is not in an idle state, then after a preset time interval, the electronic device is checked again to see if it is in an idle state.
[0149] In one possible implementation, the device further includes a first determining unit 505, configured to:
[0150] Before compiling the hotspot code corresponding to the first configuration file, obtain the target mapping table included in the application package; wherein, the target mapping table is used to indicate the association between each baseline configuration file and the corresponding compilation method; the compilation method is used to indicate whether to compile the baseline configuration file during installation;
[0151] Based on the baseline configuration files associated with the compilation methods indicated during installation included in the target mapping table, the first configuration file that meets the compilation requirements during installation is determined from the baseline configuration files in each scenario.
[0152] In one possible implementation, the device further includes a second determining unit 506, configured to:
[0153] In response to the installation operation of the target application, before obtaining the application package corresponding to the target application, the hot spot code in each scenario of the target application is determined; wherein, the hot spot code in each scenario indicates the code called when executing the functions supported by each level of the application interface;
[0154] Based on the hot-spot code in each scenario, generate baseline configuration files corresponding to each scenario;
[0155] Based on the baseline configuration files corresponding to each scenario, the application package corresponding to the target application is determined.
[0156] In one possible implementation, the second determining unit 506 is configured to:
[0157] Obtain the test log data corresponding to the target application; wherein, the test log data indicates the log data obtained by the target application when executing the functions supported by each level of the application interface during the testing phase;
[0158] Based on test log data, hotspot code in various scenarios is identified.
[0159] The application installation device based on compilation optimization provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0160] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the electronic device 600 further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.
[0161] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.
[0162] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0163] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0164] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0165] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0166] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0167] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0168] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0169] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0170] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0171] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0172] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0173] If the functionality is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0174] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0175] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. An application installation method based on compilation optimization, characterized in that, include: In response to an installation operation on a target application, an application package corresponding to the target application is obtained; wherein the application package is used to install the target application into an electronic device; Extract the baseline configuration files for each scenario included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; the baseline configuration file indicates the hotspot code when implementing the functions supported by the application interface; Obtain the target mapping table included in the application package; wherein the target mapping table is used to indicate the association between each baseline configuration file and the corresponding compilation method; the compilation method is used to indicate whether to compile the baseline configuration file during installation; The target application is installed based on the baseline configuration file associated with the compilation method indicated by the compilation method during installation included in the target mapping table. From the baseline configuration files in each scenario, the first configuration file that meets the compilation requirements during installation is selected, and hotspot code corresponding to the first configuration file is compiled. If the electronic device is determined to be in an idle state, based on the second configuration file (other than the first configuration file) in the baseline configuration files for each scenario, hotspot code corresponding to the second configuration file is compiled to complete the installation of the target application.
2. The method according to claim 1, characterized in that, Determining that the electronic device is in an idle state includes: Based on the status monitoring service running in the electronic device, obtain the resource consumption information of the electronic device; If it is determined that the resource consumption information of the electronic device meets the preset resource consumption requirements, then the electronic device is determined to be in an idle state.
3. The method according to claim 2, characterized in that, After compiling the hotspot code corresponding to the first configuration file, the method further includes: If it is determined that the electronic device is not in an idle state, then after a preset time interval, the electronic device is checked again to see if it is in an idle state.
4. The method according to claim 1, characterized in that, Before obtaining the application package corresponding to the target application in response to the installation operation of the target application, the method further includes: Identify the hotspot codes for each scenario included in the target application; wherein the hotspot codes for each scenario indicate the codes invoked when executing the functions supported by each level of the application interface; Based on the hotspot code in each scenario, a baseline configuration file corresponding to each scenario is generated; Based on the baseline configuration files corresponding to each scenario, the application package corresponding to the target application is determined.
5. The method according to claim 4, characterized in that, Identify the hotspot code in various scenarios within the target application, including: Obtain the test log data corresponding to the target application; wherein, the test log data indicates the log data obtained when the target application executes the functions supported by each level of the application interface during the testing phase; Based on the test log data, hotspot code in each scenario is identified.
6. An application installation device based on compiler optimization, characterized in that, include: A response unit is configured to, in response to an installation operation on a target application, obtain an application package corresponding to the target application; wherein the application package is used to install the target application into an electronic device; An extraction unit is used to extract baseline configuration files for various scenarios included in the application package corresponding to the target application; wherein, each scenario indicates the application interface at each level corresponding to the target application; and the baseline configuration file indicates the hotspot code used to implement the functions supported by the application interface. The first determining unit is configured to obtain a target mapping table included in the application package; wherein the target mapping table is used to indicate the association between each baseline configuration file and the corresponding compilation method; the compilation method is used to indicate whether to compile the baseline configuration file during installation; The first compilation unit is used to install the target application based on the baseline configuration file associated with the compilation method indicating the compilation during installation included in the target mapping table, and to compile hotspot code corresponding to the first configuration file from the baseline configuration files in each scenario that meets the compilation requirements during installation; the second compilation unit is used to, when it is determined that the electronic device is in an idle state, to compile hotspot code corresponding to the second configuration file based on the second configuration file other than the first configuration file in the baseline configuration files in each scenario, and to complete the installation of the target application.
7. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.
9. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Hotspot code processing method and device, server, electronic equipment and storage medium
CN112948026A
Compilation optimization method, electronic equipment and storage medium
CN116521180A
Method and device for compiling application program
CN117130617A