WO2021115178A1 - 应用程序预编译的方法、装置、服务器及存储介质 - Google Patents

应用程序预编译的方法、装置、服务器及存储介质 Download PDF

Info

Publication number
WO2021115178A1
WO2021115178A1 PCT/CN2020/133403 CN2020133403W WO2021115178A1 WO 2021115178 A1 WO2021115178 A1 WO 2021115178A1 CN 2020133403 W CN2020133403 W CN 2020133403W WO 2021115178 A1 WO2021115178 A1 WO 2021115178A1
Authority
WO
WIPO (PCT)
Prior art keywords
compilation
hotspot
configuration file
target application
units
Prior art date
Application number
PCT/CN2020/133403
Other languages
English (en)
French (fr)
Inventor
帅朝春
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2021115178A1 publication Critical patent/WO2021115178A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application relates to the field of computer technology, and more specifically, to a method, device, server, and storage medium for pre-compiling an application program.
  • the operating efficiency of the application program can be improved to a certain extent by way of pre-compilation.
  • the related compilation method will affect the operating performance of the electronic device and reduce the user experience.
  • this application proposes a method, device, server and storage medium for application program pre-compilation to improve the above-mentioned problems.
  • the present application provides a method for application pre-compilation, applied to a server, and the method includes: obtaining multiple hotspot compilation units corresponding to a target application; and dividing the multiple hotspot compilation units into multiple Part, and respectively generate a first configuration file corresponding to each of the parts to obtain multiple first configuration files, wherein each of the first configuration files includes the hotspot compilation unit of the corresponding part, and is different from the first configuration
  • the hotspot compilation unit included in the file corresponds to different pre-compilation stages; the multiple first configuration files are sent to the electronic device for the electronic device to compare the pre-compilation stage corresponding to each first configuration file.
  • the hotspot compilation unit included in each configuration file is pre-compiled.
  • the present application provides a method for application pre-compilation, which is applied to an electronic device, and the method includes: obtaining a plurality of first configuration files corresponding to a target application program sent by a server, each of the first configuration files The file includes the hotspot compilation unit of the corresponding part, and the hotspot compilation unit included in different first configuration files corresponds to different pre-compilation stages; according to the pre-compilation stage corresponding to each of the first configuration files, the first The hotspot compilation unit included in each configuration file is pre-compiled.
  • the present application provides a device for pre-compilation of an application program, which runs on a server, and the device includes: a hotspot information acquisition unit for acquiring multiple hotspot compilation units corresponding to the target application; a configuration file generation unit, It is used to divide the multiple hotspot compilation units into multiple parts, and respectively generate a first configuration file corresponding to each of the parts, to obtain multiple first configuration files, wherein each of the first configuration files includes all the first configuration files.
  • the configuration file distribution unit is used to send the multiple first configuration files to the electronic device to It is used for the electronic device to precompile the hotspot compilation unit included in each first configuration file according to the precompilation stage corresponding to each first configuration file.
  • the present application provides a device for pre-compilation of an application program, which runs on an electronic device, and the device includes: a configuration file obtaining unit configured to obtain multiple first configuration files corresponding to the target application program sent by the server; Each of the first configuration files includes a corresponding part of the hotspot compilation unit, and the hotspot compilation units included in different first configuration files have different pre-compilation stages; the compilation unit is used for each of the first configuration files.
  • the pre-compilation stage corresponding to the configuration file pre-compiles the hotspot compilation unit included in each of the first configuration files.
  • this application provides an electronic device including 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 The one or more processors execute, and the one or more programs are configured to execute the above-mentioned methods.
  • the present application provides a computer-readable storage medium having program code stored in the computer-readable storage medium, wherein the above-mentioned method is executed when the program code is running.
  • FIG. 1 shows a schematic diagram of the operating environment of a method for application pre-compilation proposed in an embodiment of the present application
  • FIG. 2 shows a schematic diagram of the operating environment of another method for pre-compiling an application program according to an embodiment of the present application
  • FIG. 3 shows a schematic diagram of the operating environment of yet another method for precompiling an application program according to an embodiment of the present application
  • FIG. 4 shows a flowchart of a method for pre-compiling an application program according to an embodiment of the present application
  • FIG. 5 shows a flowchart of a method for pre-compiling an application program according to another embodiment of the present application
  • FIG. 6 shows a flowchart of a method for precompiling an application program according to another embodiment of the present application
  • Fig. 7 shows a flowchart of a method for pre-compiling an application program proposed by another embodiment of the present application
  • FIG. 8 shows a flowchart of a method for precompiling an application program according to another embodiment of the present application
  • FIG. 9 shows a structural block diagram of a device for pre-compiling an application program proposed by this application.
  • FIG. 10 shows a structural block diagram of another device for pre-compiling an application program proposed by this application.
  • FIG. 11 shows a structural block diagram of an electronic device of the present application for executing the method for precompiling an application program according to an embodiment of the present application.
  • FIG. 12 is a storage unit for storing or carrying program code for implementing the method for pre-compiling an application program according to an embodiment of the present application according to an embodiment of the present application.
  • the application in the electronic device can be directly interpreted and executed by the interpreter at runtime.
  • the number of calls and the number of cycles of each compilation unit is recorded.
  • the corresponding compilation unit is recorded as a hotspot compilation unit.
  • the compilation unit can be understood as a function, method, or class in the source code of the application.
  • the hotspot compilation unit will be identified, compiled by JIT (Just In Time, just-in-time compilation), and then stored and a profile file is generated to record the information of the hotspot compilation unit.
  • JIT Just In Time, just-in-time compilation
  • the system of the electronic device scans the profile file and executes an AOT (Ahead Of Time, pre-compilation) process to compile.
  • AOT Ahead Of Time, pre-compilation
  • the electronic device obtains the installation package of the downloaded application program, it can obtain the profile file corresponding to the downloaded application program at the same time.
  • the application pre-compilation method, device, server, and storage medium provided by the application are proposed so that multiple hot compilation units corresponding to the target application can be pre-compiled in multiple stages in stages without Centralizing pre-compilation improves the flexibility of pre-compilation, reduces performance consumption caused by centralized compilation of hot-spot compilation units, and improves the running fluency of electronic devices.
  • FIG. 1 Please refer to FIG. 1.
  • multiple electronic devices 100 and servers 200 are included.
  • multiple electronic devices 100 exchange data with the server 200 through the network.
  • a target application program is run on multiple electronic devices 100, and the target application program run by each electronic device 100 is correspondingly generated with a configuration file (which may be the aforementioned profile file) 120.
  • multiple electronic devices 100 can upload the configuration file 120 of the target application installed by themselves to the server 200, so that the server can obtain multiple configuration files 120 corresponding to the target application, and then configure the multiple configuration files 120.
  • the file 120 undergoes fusion processing, extracts multiple hotspot compilation units included in the multiple configuration files 120, and then divides the multiple hotspot compilation units into multiple configuration files according to the multiple compilation stages of the configuration, and then divides the multiple configurations
  • the file configuration is a file collection 210 that is returned to the multiple electronic devices 100 respectively. It is understandable that this corresponds to that each electronic device 100 returns a file set 210 including multiple configuration files.
  • the server 220 can also directly send the program installation package 230 including the file collection 210 and the target application installation program 220 to the electronic device 130 that has not yet installed the target application, so that the electronic When the device 130 installs the target application, it can run a certain first configuration file of the file set 210 to perform pre-compilation of some hotspot compilation units.
  • the server that collects multiple configuration files 120 and processes the multiple configuration files 120 to obtain multiple configuration files may be a single server or a server cluster.
  • the server that collects multiple configuration files 120 and processes the multiple configuration files 120 to obtain the multiple configuration files may be a different server from the server that subsequently issues the program installation package 230.
  • the server 200 is only used to perform the aforementioned collection of configuration files uploaded by multiple electronic devices 100, and then send the collected configuration files to the server 201.
  • the server 201 executes the extraction of the multiple hotspot compilation units included in the multiple configuration files 120, and then divides the multiple hotspot compilation units into multiple configuration files according to the multiple compilation stages of the configuration, and then divides the multiple configurations
  • the file 210 is configured as a file set 210 to be returned to the multiple electronic devices 100 respectively.
  • the server 201 may also send the generated file collection 210 including multiple configuration files to the server 200, and then the server 200 forwards it to the multiple electronic devices 100 (not shown in the figure).
  • the server 201 can directly run an application distribution platform. In this case, the server 201 can directly configure multiple configuration files 210 in the program installation package 230 and send them to the target application that has not yet been installed.
  • the program of the electronic device 130 If the application distribution platform runs independently, the server 201 can send the file collection 210 including multiple configuration files to the application distribution platform, so that the application distribution platform can configure the file collection 210 in the program installation package 230 and send it to the application distribution platform.
  • the first configuration file mentioned in the subsequent embodiments may be the configuration file included in the file set 210
  • the second configuration file mentioned may be the configuration file 120.
  • the hotspot compilation unit in the newly generated configuration file 210 may be a hotspot compilation unit compiled by the server 200, or a hotspot compilation unit that has not been compiled yet.
  • the electronic device that receives the newly generated configuration file can compile before running the target application, or install the target Compile the application program.
  • a method for pre-compilation of an application program provided by this application is applied to a server, and the method includes:
  • Step S110 Obtain multiple hotspot compilation units corresponding to the target application.
  • multiple hotspot compilation units corresponding to the target application are acquired. It is understandable that when the version of the application is updated, there may be more functions than the version before the update, or the implementation code for the same function is changed, so in order to better adapt to the version update The latter target application program can obtain multiple hotspot compilation units corresponding to the target application program when it is detected that the target application program version is updated.
  • multiple hotspot compilation units corresponding to the target application can be periodically acquired.
  • the multiple hotspot compilation units obtained during each execution of step S110 are only hotspot compilation units corresponding to the current stage, and not necessarily all hotspot compilation units that may be generated by the target application.
  • hotspot compilation units other than the multiple hotspot compilation units obtained in step S110 may be generated, and the server periodically obtains the multiple hotspot compilation units corresponding to the target application.
  • a hotspot compilation unit can be understood as periodically collecting the hotspot compilation units corresponding to the target application in the electronic devices used by different users to obtain multiple hotspot compilation units, and then realize that more comprehensive hotspot compilations can be obtained quickly unit.
  • multiple hotspot compilation units can be obtained by collecting configuration files (profile files) corresponding to target applications running in different electronic devices.
  • multiple hotspot compilation units corresponding to the target application can be obtained by cyclically running the target application in the ART virtual machine.
  • Step S120 Divide the multiple hotspot compilation units into multiple parts, and respectively generate a first configuration file corresponding to each of the parts to obtain multiple first configuration files, wherein each of the first configuration files includes The hotspot compilation units of the corresponding part, and the hotspot compilation units included in different first configuration files correspond to different pre-compilation stages.
  • the acquired multiple hotspot coding units include hotspot coding units A to H.
  • the hotspot coding units A to C can be divided into one part, the hotspot coding units D to F are divided into one part, and the hotspot coding units G to H are divided into one part.
  • the first configuration file corresponding to the part of the hotspot coding units A to C includes the hotspot coding unit A, the hotspot coding unit B, and the hotspot coding unit C.
  • the first configuration file corresponding to the part of the hotspot coding units D to F includes a hotspot coding unit D, a hotspot coding unit E, and a hotspot coding unit F.
  • the first configuration file corresponding to the part of the hotspot coding units G to H includes the hotspot coding unit G and the hotspot coding unit H.
  • Step S130 Send the multiple first configuration files to the electronic device for the electronic device to compile the hot spots included in each first configuration file according to the pre-compilation stage corresponding to each first configuration file The unit is pre-compiled.
  • the server may send multiple first configuration files to the electronic device in a variety of ways.
  • the server may send the multiple first configuration files to the electronic device along with the installation package of the target application when the electronic device initially downloads the target application.
  • the electronic device updates the target application it may be sent to the electronic device along with the update file.
  • the server for executing the method of application pre-compilation may be the server 200 in FIG. 1 and FIG. 2 or the server 201 in FIG. 3.
  • This application provides a method for pre-compilation of an application. After obtaining a plurality of hotspot compilation units corresponding to a target application, the plurality of hotspot compilation units are divided into a plurality of parts, and the hotspot compilation units are respectively generated corresponding to each of the parts. Corresponding to multiple first configuration files with different precompilation stages, the multiple first configuration files are sent to the electronic device for the electronic device to compare the first configuration files according to the precompilation stage corresponding to each first configuration file. First, the hotspot compilation unit included in each configuration file is pre-compiled.
  • multiple hot compilation units corresponding to the target application can be pre-compiled in multiple stages in stages, instead of centralized pre-compilation, which improves the flexibility of pre-compilation and reduces
  • the performance consumption brought by the centralized compilation of the hotspot compilation unit is improved, and the running fluency of the electronic device is improved.
  • an application pre-compilation method provided by this application is applied to a server, and the method includes:
  • Step S210 Obtain multiple second configuration files corresponding to the target application from multiple electronic devices, where the second configuration file is used to record the hotspot compilation unit of the target application.
  • Each application program can be configured with a profile file (profile file) during its operation.
  • the configuration file is used to record the hotspot compilation unit of the application in the running process.
  • an application program A, an application program B, and an application program C are installed in the electronic device.
  • the application A can correspond to a configuration file a
  • the application B can correspond to a configuration file b
  • the application C can correspond to a configuration file c.
  • the hotspot compilation unit of application A is recorded in configuration file a
  • the hotspot compilation unit of application B is recorded in configuration file b
  • the hotspot compilation unit of application C is recorded in configuration file c.
  • the application programs installed for different electronic devices may be different or the same.
  • application A, application B, and application C may be installed on multiple electronic devices.
  • the target application program is an application program to which the configuration file to which it belongs will be processed in subsequent steps.
  • the server may determine the target application program in multiple ways.
  • the server can use the application with a large amount of installation as the target application.
  • the electronic device may periodically upload application program installation information to the server, and the application program installation information includes applications currently installed by the electronic device. Then, the server can perform statistics on the application installation information uploaded by multiple electronic devices on a regular basis, 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 can be used as the target application.
  • the server can upload application A As the target application. In this way, the server can optimize the operating efficiency of the installed application program in a timely manner.
  • the electronic device can simultaneously determine the target application in combination with the amount of installation and the size of the corresponding configuration file. It should be noted that because different applications have different functions or operating frequencies, the size of their configuration files is different, and the electronic device compiles the hotspot compilation unit in the configuration file before the application runs. If a certain amount of resources and time needs to be consumed, then for applications with smaller configuration files, it can be determined that the running frequency may be lower, and the server may not process the configuration files to which these lower running frequency applications belong. Correspondingly, in this manner, in the application installation information reported by the electronic device, in addition to the installed applications, the size of the configuration file to which each application belongs may also be included. When the server detects that among multiple electronic devices, the size of the configuration file to which a certain application belongs is greater than the specified threshold and the number is greater than the threshold, the same application can be used as the target application.
  • each of the 90 electronic devices has one application A installed Configuration files (that can be understood as 90 configuration files). If the server recognizes that 80 of its 90 configuration files are less than 1kb, then when the installation threshold is 80, the specified threshold is 10kb, and the number of thresholds is 50, the server will not use application A as the target application . However, if the server recognizes that 60 of the 90 configuration files (greater than the threshold number of 50) have a size of 11-12 kb (greater than the specified threshold of 10 kb), then the application A can be determined as the target application.
  • the server can also determine the target application according to the configuration information. In this way, you can determine which applications are the target applications through manual configuration.
  • the server may use the application involved in the application installation information reported by multiple electronic devices as the candidate application, and the operator may select one or more applications from the candidate application as the selected application.
  • the application program correspondingly, the server stores the selected application program in the configuration file. In this case, the server can use the application program configured in the configuration file as the target application program.
  • the server may further use the configuration file to which the target application belongs as the second configuration file.
  • the multiple second configuration files corresponding to the target application can be understood as the configuration files to which the same target application installed in multiple electronic devices belongs.
  • Step S220 Obtain multiple hotspot compilation units from the multiple second configuration file records.
  • the server may directly de-duplicate all hotspot compilation units in the multiple second configuration files as the acquired multiple hotspot compilation units.
  • Step S230 Divide the plurality of hotspot compilation units into a plurality of parts, and respectively generate a first configuration file corresponding to each of the parts, to obtain a plurality of first configuration files, wherein each of the first configuration files includes The hotspot compilation units of the corresponding part, and the hotspot compilation units included in different first configuration files correspond to different pre-compilation stages.
  • Step S240 Send the multiple first configuration files to the electronic device for the electronic device to compile the hot spots included in each first configuration file according to the pre-compilation stage corresponding to each first configuration file The unit is pre-compiled.
  • the server for executing the method of application pre-compilation may be the server 200 in FIG. 1 and FIG. 2 or the server 201 in FIG. 3.
  • This application provides a method for pre-compilation of an application program.
  • the multiple second configuration files corresponding to the target are obtained from the multiple second configuration files.
  • the multiple hotspot compilation units corresponding to the application program divide the multiple hotspot compilation units into multiple parts, and correspondingly generate multiple first configuration files with different precompilation stages corresponding to each of the parts, and divide the multiple hotspot compilation units into multiple parts.
  • the multiple first configuration files are sent to the electronic device for the electronic device to pre-compile the hotspot compilation unit included in each first configuration file according to the pre-compilation stage corresponding to each first configuration file.
  • multiple hot compilation units corresponding to the target application can be pre-compiled in multiple stages in stages, instead of centralized pre-compilation, which improves the flexibility of pre-compilation and reduces
  • the performance consumption brought by the centralized compilation of the hotspot compilation unit is improved, and the running fluency of the electronic device is improved.
  • the multiple hotspot compilation units obtained at the beginning are obtained from the second configuration file about the actual operating state of the electronic device, so that the obtained multiple hotspot compilation units can better fit the actual usage habits of the user, so that the generation
  • the multiple first configuration files are more adapted to the actual usage habits of users, which improves the effectiveness of the efficiency improvement of the target application.
  • a method for pre-compilation of an application program provided by this application is applied to a server, and the method includes:
  • Step S310 Acquire multiple hotspot compilation units corresponding to the target application.
  • multiple hotspot compilation units may be obtained from multiple second configuration file records in the foregoing embodiment.
  • the number of occurrences of each hotspot compilation unit in multiple second configuration files can also be obtained at the same time.
  • the server collects a second configuration file A, a second configuration file B, and a second configuration file C corresponding to the same target application, where the second configuration file A, the second configuration file B, and the second configuration file C is obtained from different electronic devices.
  • the second configuration file A includes a hotspot compilation unit A, a hotspot compilation unit B, and a hotspot compilation unit C
  • the second configuration file B includes a hotspot compilation unit A, a hotspot compilation unit C, and a hotspot compilation unit D
  • the second configuration file C includes a hot spot compilation unit A, a hot spot compilation unit B, and a hot spot compilation unit E.
  • the obtained multiple hotspot coding units include hotspot coding unit A (occurring 3 times), hotspot coding unit B (occurring 2 times), hotspot coding unit C (occurring 2 times), and hotspot coding unit D. (Occurs once) and Hot Spot Compilation Unit E (Occurs once).
  • Step S320 Divide the hotspot compilation unit related to the target application startup process among the plurality of hotspot compilation units into a first part, and generate a first configuration file corresponding to the first part.
  • the application program also involves the compilation and operation of related function codes during the startup process. Then, the hotspot compilation units related to the startup process of the application program among the plurality of hotspot compilation units can be divided into the first part, and then the first configuration file corresponding to the first part is generated.
  • Step S330 Divide the hotspot compiling units whose running times are greater than the first threshold among the plurality of hotspot compiling units into a second part, and generate a first configuration file corresponding to the second part.
  • the number of runs involved in this embodiment can be understood as the number of runs based on the JIT method, that is, the hotspot compilation units of the second configuration file A, the second configuration file B, and the second configuration file C in the foregoing example.
  • the number of occurrences Exemplarily, if the first threshold value is 1, then according to the second configuration file A, the second configuration file B, and the second configuration file C in the foregoing example, the hotspot compilation unit divided into the second part includes the hotspot compilation unit A (appears 3 times), Hot Spot Compilation Unit B (appears 2 times), Hot Spot Compilation Unit C (appears 2 times).
  • Step S340 Divide the hotspot compiling units whose running times are greater than the second threshold among the plurality of hotspot compiling units into a third part, and generate a first configuration file corresponding to the third part, wherein the first threshold is greater than the third part.
  • each of the first configuration files includes a corresponding part of the hotspot compilation unit, and the hotspot compilation units included in different first configuration files have different pre-compilation stages.
  • the hotspot compilation unit divided into the third part includes the hotspot compilation unit A (appears 3 times).
  • Step S350 Send the multiple first configuration files to the electronic device for the electronic device to compile the hot spots included in each first configuration file according to the pre-compilation stage corresponding to each first configuration file The unit is pre-compiled.
  • multiple first configuration files mentioned in this embodiment refer to multiple first configuration files obtained based on step S320, step S330, and step S340.
  • step S320, step S330, and step S340 can be performed sequentially or in parallel.
  • the pre-compilation stage corresponding to the included hot-spot compilation unit is that the electronic device where the target application is located is in the screen rest stage; the pre-compilation stage corresponding to the hot-spot compilation unit included in the first configuration file corresponding to the third part is configured as said The electronic device where the target application is located is in the idle phase.
  • the actual values of the first threshold and the second threshold involved in this embodiment are only given exemplarily, and the actual values of the first threshold and the second threshold can be determined according to actual conditions during operation.
  • the first threshold may be configured to be 5000, and the second threshold may be 15000.
  • the operation phase of the first configuration file corresponding to the second part and the first configuration file corresponding to the third part may not be limited to the above-mentioned manner.
  • the first configuration file corresponding to the second part may also be configured as The electronic device is in the idle phase, and the first configuration file corresponding to the third part is configured to indicate that the electronic device is in the screen rest phase.
  • the division operation involved in this embodiment can be understood as the server writing the hotspot compilation unit into the corresponding first configuration file.
  • the server may generate multiple first configuration files according to the pre-division rule, and the first configuration files with different configurations run in different stages.
  • the first configuration file A, the first configuration file B, and the first configuration file C may be generated first.
  • the first configuration file A is configured to run during the application installation phase, then in the process of dividing the multiple hotspot compilation units obtained in step S310, if a certain hotspot compilation unit is divided into the first part (the first part corresponds to The pre-compilation stage corresponding to the hotspot compilation unit included in the first configuration file is the installation stage of the target application), it can be understood as writing this hotspot compilation unit into the first configuration file A, and other parts
  • the division of can also be understood in this way, and will not be repeated here.
  • the electronic device may run the first configuration file corresponding to the first part during the process of installing the update file.
  • This application provides a method for pre-compilation of an application, so that multiple hot compilation units corresponding to a target application can be pre-compiled in multiple stages in stages, instead of centralized pre-compilation, thereby improving the pre-compilation.
  • the flexibility of the compilation also reduces the performance consumption caused by the compilation of the hotspot compilation unit concentratedly, and improves the running fluency of the electronic device.
  • the hotspot compilation unit related to the startup of the target application can be divided into a single part, and configured to be pre-compiled during the target application installation phase, and the first configuration file corresponding to the other parts is configured as Performing in the off-screen or idle state of the electronic device effectively reduces the overall time-consuming installation of the target application, and also reduces the impact of the pre-compilation operation on the running performance of the electronic device to a greater extent, and improves the user experience.
  • an application pre-compilation method provided in this application is applied to a server, and the method includes:
  • Step S410 Acquire multiple hotspot compilation units corresponding to the target application.
  • Step S420 Divide the hotspot compilation units whose code amount is less than the first code amount threshold among the plurality of hotspot compilation units into a first part, and generate a first configuration file corresponding to the first part.
  • Step S430 Divide the hotspot compilation units whose code amount is not less than the first code amount threshold and less than the second code amount threshold in the plurality of hotspot compilation units into a second part, and generate a first part corresponding to the second part. Configuration file.
  • Step S440 Divide the hotspot compilation units of the plurality of hotspot compilation units whose code amount is not less than the second code amount threshold into a third part, and generate a first configuration file corresponding to the third part.
  • Each of the first configuration files includes a corresponding part of hotspot compilation units, and the hotspot compilation units included in different first configuration files have different pre-compilation stages.
  • Step S450 Send the multiple first configuration files to the electronic device for the electronic device to compile the hot spots included in each first configuration file according to the pre-compilation stage corresponding to each first configuration file The unit is pre-compiled.
  • the pre-compilation stage corresponding to the included hot-spot compilation unit is that the electronic device where the target application is located is in the screen rest stage; the pre-compilation stage corresponding to the hot-spot compilation unit included in the first configuration file corresponding to the third part is configured as said The electronic device where the target application is located is in the idle phase.
  • This application provides a method for pre-compilation of an application, so that multiple hot compilation units corresponding to a target application can be pre-compiled in multiple stages in stages, instead of centralized pre-compilation, thereby improving the pre-compilation.
  • the flexibility of the compilation also reduces the performance consumption caused by the compilation of the hotspot compilation unit concentratedly, and improves the running fluency of the electronic device.
  • parts can be divided according to the amount of code of the hotspot compilation unit, and the part with the least amount of code of the hotspot compilation unit included in the configuration is pre-compiled in the target application installation phase, and the other parts correspond to
  • the first configuration file is configured to be performed when the electronic device is on the screen or in an idle state, which effectively reduces the overall time-consuming installation of the target application, and also reduces the impact of the pre-compilation operation on the operating performance of the electronic device to a greater extent. user experience.
  • a method for pre-compilation of an application program provided by the present application is applied to an electronic device, and the method includes:
  • Step S510 Acquire multiple first configuration files corresponding to the target application program sent by the server, each of the first configuration files includes a corresponding part of the hotspot compilation unit, and different hotspot compilation units included in the first configuration file The corresponding pre-compilation stage is different.
  • Step S520 Pre-compile the hotspot compilation units included in each of the first configuration files according to the pre-compilation stage corresponding to each of the first configuration files.
  • the multiple first configuration files include the first configuration file whose pre-compilation stage is the installation stage of the target application, and the pre-compilation stage is the first configuration file whose electronic device where the target application is located is in the screen rest stage.
  • a configuration file and the pre-compilation stage are the first configuration file in the idle stage of the electronic device where the target application is located.
  • the pre-compilation phase is run as the first configuration file of the target application's installation phase; if it is detected that the electronic device is in the off-screen state , Running the pre-compilation stage is the first configuration file of the electronic device where the target application is in the rest stage; if it is detected that the electronic device is in a charging state, running the pre-compilation stage is the target application The first configuration file of the electronic device in the idle phase.
  • the configuration file is stored in the path specified by the system. Take the Android system as an example. In the Android system, the configuration files of the application are stored in the path /data/misc/profiles/. As a way to adapt to multiple configuration files, the electronic device can be configured to further configure multiple storage areas under the specified path of the storage configuration file, and configure one storage area to store the same compilation stage Configuration file.
  • the compilation phases corresponding to the multiple first configuration files include an application program installation phase, a screen rest phase, and an idle phase.
  • the corresponding first storage area can be configured under the specified path to store the first configuration file corresponding to each application program that is pre-compiled during the application installation phase, and the second storage area can be configured to store each application corresponding The first configuration file that is pre-compiled in the screen rest phase, and the third storage area is configured to store the first configuration file that is pre-compiled in the idle phase corresponding to each application. Therefore, the electronic device can directly read the configuration files of the corresponding compilation stage through different storage areas under the specified path, which avoids placing the first configuration files of all the compilation stages of each application in one path. The search takes a long time, and the management is inconvenient.
  • a device 600 for pre-compilation of an application program provided by the present application runs on a server, and the device 600 includes:
  • the hotspot information obtaining unit 610 is used to obtain multiple hotspot compilation units corresponding to the target application.
  • the hotspot information obtaining unit 610 is specifically configured to obtain multiple hotspot compilation units corresponding to the target application if the target application version is detected to be updated.
  • the hotspot information obtaining unit 610 is specifically configured to obtain multiple second configuration files corresponding to the target application from multiple electronic devices, and the second configuration file is used to record the hotspot compilation of the target application. Unit; obtain multiple hotspot compilation units from the multiple second configuration file records.
  • the configuration file generating unit 620 is configured to divide the multiple hotspot compilation units into multiple parts, and respectively generate a first configuration file corresponding to each of the parts, to obtain multiple first configuration files, wherein each of the The first configuration file includes a corresponding part of hotspot compilation units, and the hotspot compilation units included in different first configuration files correspond to different pre-compilation stages.
  • the configuration file generating unit 620 is specifically configured to divide the hotspot compilation unit related to the target application startup process among the multiple hotspot compilation units into a first part, and generate a first configuration corresponding to the first part File; divide the hotspot compilation units whose running times are greater than the first threshold among the plurality of hotspot compilation units into a second part, and generate a first configuration file corresponding to the second part; run the plurality of hotspot compilation units The hotspot compilation unit whose number of times is greater than the second threshold is divided into a third part, and a first configuration file corresponding to the third part is generated; wherein, the first threshold is greater than the second threshold.
  • the configuration file generating unit 620 is specifically configured to divide the hotspot compilation units whose code amount is less than the first code amount threshold among the multiple hotspot compilation units into the first part, and generate the first part corresponding to the first part.
  • Configuration file divide the hotspot compilation units whose code amount is not less than the first code amount threshold and less than the second code amount threshold in the plurality of hotspot compilation units into the second part, and generate the first part corresponding to the second part
  • Configuration file dividing the hotspot compilation units of the plurality of hotspot compilation units whose code amount is not less than the second code amount threshold into a third part, and generate a first configuration file corresponding to the third part.
  • the configuration file generating unit 620 is further configured to configure the pre-compilation phase corresponding to the hotspot compilation unit included in the first configuration file corresponding to the first part as the installation phase of the target application; configure the second part
  • the pre-compilation stage corresponding to the hotspot compilation unit included in the first configuration file corresponding to the part is that the electronic device where the target application is located is in the screen rest stage; configure the hotspot compilation unit included in the first configuration file corresponding to the third part
  • the corresponding pre-compilation stage is that the electronic device where the target application is located is in an idle stage.
  • the configuration file distributing unit 630 is configured to send the multiple first configuration files to the electronic device, so that the electronic device can perform each first configuration file according to the pre-compilation stage corresponding to each first configuration file.
  • the hotspot compilation unit included in the pre-compilation included in the pre-compilation.
  • a device 700 for pre-compilation of an application program provided by the present application, which runs on an electronic device includes:
  • the configuration file obtaining unit 710 is configured to obtain a plurality of first configuration files corresponding to the target application program sent by the server, each of the first configuration files includes a corresponding part of the hotspot compilation unit, and is different from the first configuration file.
  • the included hotspot compilation units correspond to different pre-compilation stages.
  • the compiling unit 720 is configured to precompile the hotspot compiling units included in each of the first configuration files according to the precompilation stage corresponding to each of the first configuration files.
  • the multiple first configuration files include the first configuration file whose pre-compilation stage is the installation stage of the target application, and the pre-compilation stage is the first configuration file whose electronic device where the target application is located is in the screen rest stage.
  • a configuration file and the pre-compilation stage are the first configuration file in the idle stage of the electronic device where the target application is located.
  • the compiling unit 720 is specifically configured to run the first configuration file in the pre-compilation phase as the installation phase of the target application if the target application is detected to be installed; if the target application is detected When the electronic device is in the off-screen state, running the pre-compilation stage is the first configuration file of the electronic device where the target application is in the off-screen stage; if it is detected that the electronic device is in the charging state, run the pre-compilation The stage is the first configuration file of the electronic device where the target application is in the idle stage.
  • an embodiment of the present application also provides another electronic device 200 that can execute the aforementioned method of application pre-compilation.
  • the electronic device 200 includes one or more (only one is shown in the figure) processor 102, a memory 104, and a network module 106 that are coupled to each other.
  • the memory 104 stores a program that can execute the content in the foregoing embodiment, and the processor 102 can execute the program stored in the memory 104.
  • the processor 102 may include one or more processing cores.
  • the processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and calling data stored in the memory 104.
  • the processor 102 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 102 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented by a communication chip alone.
  • the memory 104 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 104 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 104 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
  • the memory 104 may store a device for pre-compilation of application programs.
  • the device for pre-compiling the application program may be the aforementioned device 600 or device 700.
  • the network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other equipment, such as communication with a wireless access point.
  • the network module 106 may include various existing circuit elements for performing these functions, for example, an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a subscriber identity module (SIM) card, a memory, etc. .
  • SIM subscriber identity module
  • the network module 106 can also be used as a network adapter for the electronic device 200 to directly connect to the network through a line connection.
  • the network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • FIG. 12 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 810 may be compressed in a suitable form, for example.
  • the method, device, server, and storage medium for application pre-compilation provided in this application, after obtaining multiple hot-spot compilation units corresponding to the target application, divide the multiple hot-spot compilation units into multiple Corresponding to each part, and correspondingly generate multiple first configuration files with different precompilation stages corresponding to each of the parts, and send the multiple first configuration files to the electronic device for use by the electronic device according to each
  • the pre-compilation stage corresponding to the first configuration file pre-compiles the hotspot compilation units included in each of the first configuration files.
  • multiple hot compilation units corresponding to the target application can be pre-compiled in multiple stages in stages, instead of centralized pre-compilation, which improves the flexibility of pre-compilation and reduces
  • the performance consumption brought by the centralized compilation of the hotspot compilation unit is improved, and the running fluency of the electronic device is improved.

Landscapes

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

Abstract

一种应用程序预编译的方法、装置、服务器及存储介质。该方法包括:获取目标应用程序对应的多个热点编译单元(S110,S310);将多个热点编译单元划分为多个部分,并对应每个部分分别生成第一配置文件,得到多个第一配置文件(S120),且不同第一配置文件所包括的热点编译单元对应的预编译阶段不同;将多个第一配置文件发送给电子设备(S130)。本方法使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。

Description

应用程序预编译的方法、装置、服务器及存储介质
相关申请的交叉引用
本申请要求于2019年12月09日提交的申请号为201911252047.6的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉计算机技术领域,更具体地,涉及一种应用程序预编译的方法、装置、服务器及存储介质。
背景技术
在电子设备中,可以通过提前编译的方式来实现一定程度的提升应用程序的运行效率。但是,在相关的编译方式会造成电子设备的运行性能受到影响,降低了用户体验。
发明内容
鉴于上述问题,本申请提出了一种应用程序预编译的方法、装置、服务器及存储介质,以改善上述问题。
第一方面,本申请提供了一种应用程序预编译的方法,应用于服务器,所述方法包括:获取目标应用程序对应的多个热点编译单元;将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
第二方面,本申请提供了一种应用程序预编译的方法,应用于电子设备,所述方法包括:获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
第三方面,本申请提供了一种应用程序预编译的装置,运行于服务器, 所述装置包括:热点信息获取单元,用于获取目标应用程序对应的多个热点编译单元;配置文件生成单元,用于将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;配置文件分发单元,用于将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
第四方面,本申请提供了一种应用程序预编译的装置,运行于电子设备,所述装置包括:配置文件获取单元,用于获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;编译单元,用于根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
第五方面,本申请提供了一种电子设备,包括一个或多个处理器以及存储器;一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述的方法。
第六方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本申请实施例提出的一种应用程序预编译的方法的运行环境示意图;
图2示出了本申请实施例提出的另一种应用程序预编译的方法的运行环境示意图;
图3示出了本申请实施例提出的再一种应用程序预编译的方法的运行环境示意图;
图4示出了本申请实施例提出的一种应用程序预编译的方法的流程图;
图5示出了本申请另一实施例提出的一种应用程序预编译的方法的流程图;
图6示出了本申请再一实施例提出的一种应用程序预编译的方法的流程图;
图7示出了本申请又一实施例提出的一种应用程序预编译的方法的流程 图;
图8示出了本申请又一实施例提出的一种应用程序预编译的方法的流程图;
图9示出了本申请提出的一种应用程序预编译的装置的结构框图;
图10示出了本申请提出的另一种应用程序预编译的装置的结构框图;
图11示出了本申请的用于执行根据本申请实施例的应用程序预编译的方法的电子设备的结构框图。
图12是本申请实施例的用于保存或者携带实现根据本申请实施例的应用程序预编译的方法的程序代码的存储单元。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
随着电子设备中应用程序的运行方式的发展,电子设备中的应用程序可以在运行时先通过解析器(Interpreter)直接解释执行,执行过程中记录每个编译单元的调用次数和循环次数,当调用次数和循环次数超过设定阈值,则对应的编译单元被记录为热点编译单元。其中,编译单元可以理解为应用程序的源码中的函数、方法(method)或者类(class)。进一步的,热点编译单元会被识别并被JIT(Just In Time,即时编译)编译后存储并生成profile文件以记录热点编译单元的信息。在这种情况下,在一些情况下,电子设备的***会扫描profile文件并执行AOT(Ahead Of Time,预编译)过程进行编译。
但是,发明人在对该方式进行研究中发现,在相关的profile文件运行以进行热点编译单元的编译过程中,都是集中在一个时间段进行的,这样就会造成整个编译过程会消耗较多的时间。例如,在一种相关的方式中,电子设备在获取所下载应用程序的安装包的过程中,就可以同时获取到所下载应用程序对应的profile文件,在对该安装包进行安装的过程中,就可以运行该profile文件,以对该profile文件内的编译单元进行编译,并且,在该profile文件内的编译单元完成编译后,该应用程序的安装过程才会结束,进而在需要编译的编译单元较多的情况下,会造成安装过程耗时较长。
因此,提出了申请提供的应用程序预编译的方法、装置、服务器及存储介质,以便使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。
下面先对本申请实施例所涉及的一种场景进行介绍。
请参阅图1,在图1所涉及的场景中,包括有多个电子设备100以及服务器200。其中,多个电子设备100通过网络与服务器200进行数据交互。
在多个电子设备100都运行有目标应用程序,而每个电子设备100所运行的目标应用程序都对应生成有配置文件(可以为前述的profile文件)120。在一种方式下,多个电子设备100可以将自己安装的目标应用程序的配置文件120上传到服务器200中,以便服务器可以得到目标应用程序对应的多个配置文件120,进而对该多个配置文件120进行融合处理,提取该多个配置文件120所包括的多个热点编译单元,然后按照配置的多个编译阶段,将该多个热点编译单元划分为多个配置文件,再将多个配置文件配置为一个文件集合210分别返回给该多个电子设备100。可以理解的是,这里对应于每个电子设备100均分别返回包括多个配置文件的文件集合210。
此外,如图2所示,还可以由服务器220直接将包括该文件集合210以及目标应用程序的安装程序220的程序安装包230发送给还未安装目标应用程序的电子设备130,以便可以使得电子设备130在安装目标应用程序时,就可以运行文件集合210的某个第一配置文件,以进行部分热点编译单元的预编译。
需要说明的是,在图2所示的环境中,进行收集多个配置文件120并对该多个配置文件120进行处理得到多个配置文件的服务器可以有为单个服务器,也可以服务器集群。并且,进行收集多个配置文件120并对该多个配置文件120进行处理得到多个配置文件的服务器可以和后续下发程序安装包230的服务器为不同的服务器。例如,如图3所示,在图3所示的情况下,服务器200只用于执行前述的收集多个电子设备100上传的配置文件,然后将所收集到的配置文件再发送给服务器201,然后由服务器201来执行提取该多个配置文件120所包括的多个热点编译单元,然后按照配置的多个编译阶段,将该多个热点编译单元划分为多个配置文件,再将多个配置文件210配置为一个文件集合210分别返回给该多个电子设备100。此外,也可以服务器201也可以将生成的包括多个配置文件的文件集合210发送给服务器200,进而由服务器200来转发给多个电子设备100(图中未示出)。其中,需要说明的是,服务器201中可以直接运行有应用分发平台,在这种情况下,服务器201可以直接将多个配置文件210以配置在程序安装包230的中发送给还未安装目标应用程序的电子设备130。而若应用分发平***立运行的情况下,可以服务器201可以将包括多个配置文件的文件集合210发送给应用分发平台,以便应用分发平台将文件集合210以配置在程序安装包230的中发送给还未安装目标应用程序的电子设备130。
再者,在后续实施例中所提及的第一配置文件可以为文件集合210中所包括的配置文件,所提及的第二配置文件可以为配置文件120。其中,新生成的配置文件210中的热点编译单元可以为服务器200编译后的热点编译单元,也可以为还未运行编译的热点编译单元。在服务器新生成的配置文件中的热点编译单元为还未运行编译的热点编译单元的情况下,可以由接收到新生成的配置文件的电子设备在运行目标应用程序之前进行编译,或者在安装目标应用程序时就进行编译。
下面将结合具体实施例对本申请内容进行介绍。
请参阅图4,本申请提供的一种应用程序预编译的方法,应用于服务器,所述方法包括:
步骤S110:获取目标应用程序对应的多个热点编译单元。
在本实施例中,可以有多种实际触发服务器获取目标应用程序对应的多个热点编译单元。
作为一种方式,若检测到所述目标应用程序版本更新时,获取目标应用程序对应的多个热点编译单元。可以理解的是,当应用程序的版本更新时,相比于更新之前的版本可能会有更多的功能,或者是对于同一个功能更换了实现的代码,那么为了能够更好的适配版本更新后的目标应用程序,可以在检测到所述目标应用程序版本更新时,获取目标应用程序对应的多个热点编译单元。
作为另外一种方式,可以周期性的获取目标应用程序对应的多个热点编译单元。需要说明的是,每次执行步骤S110所获取到的多个热点编译单元只是对应于当前阶段的热点编译单元,而并不一定是目标应用程序所有可能产生的热点编译单元。那么针对个别电子设备而言,在目标应用程序在实际运行过程中可能会生成执行步骤S110所获取到的多个热点编译单元以外的热点编译单元,那么服务器周期性的获取目标应用程序对应的多个热点编译单元,可以理解为周期性的收集不同用户所使用的电子设备中目标应用程序对应的热点编译单元,得到多个热点编译单元,进而实现可以快速的获取到更全面的多个热点编译单元。
在本实施例中,可以有多种方式来确定后续进行划分的多个热点编译单元。
作为一种方式,可以通过收集不同电子设备中所运行的目标应用程序对应的配置文件(profile文件)的方式,来获取到多个热点编译单元。作为另外一种方式,可以通过ART虚拟机中循环运行目标应用程序的方式,来获取到目标应用程序对应的多个热点编译单元。
步骤S120:将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
示例性的,获取到的多个热点编译单元包括热点编译单元A到H。可选的,可以将热点编译单元A到C划分为一个部分,将热点编译单元D到F划分为一个部分,将热点编译单元G到H划分为一个部分。那么在这种情况下,对应于热点编译单元A到C这个部分的第一配置文件包括热点编译单元A、热点编译单元B以及热点编译单元C。对应于热点编译单元D到F这个部分的第一配置文件包括热点编译单元D、热点编译单元E以及热点编译单元F。对应于热点编译单元G到H这个部分的第一配置文件包括热点编译单元G以及热点编译单元H。
步骤S130:将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包 括的热点编译单元进行预编译。
需要说明的是,服务器可以通过多种方式将多个第一配置文件发送给电子设备。可选的,服务器可以在电子设备初始下载该目标应用程序时,将所述多个第一配置文件伴随所述目标应用程序的安装包发送给电子设备。此外,也可以在电子设备更新所述目标应用程序时,伴随更新文件发送给电子设备。
需要说明的是,执行本实施例提供的应用程序预编译的方法服务器可以为图1和图2中的服务器200,也可以为图3中的服务器201。
本申请提供的一种应用程序预编译的方法,在获取目标应用程序对应的多个热点编译单元后,将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成对应的预编译阶段不同的多个第一配置文件,将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。从而通过上述方式,使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。
请参阅图5,本申请提供的一种应用程序预编译的方法,应用于服务器,所述方法包括:
步骤S210:从多个电子设备中获取目标应用程序对应的多个第二配置文件,所述第二配置文件用于记录所述目标应用程序的热点编译单元。
需要说明的是,电子设备中可以运行有多个应用程序。而每个应用程序在运行过程中都可以配置有一个所属的配置文件(profile文件)。该配置文件用于记录所属应用程序在运行过程中的热点编译单元。示例性的,在电子设备中安装有应用程序A、应用程序B以及应用程序C。那么应用程序A可以对应有一个所属的配置文件a,而应用程序B可以对应有一个所属的配置文件b,应用程序C可以对应有一个所属的配置文件c。那么在这种情况下,配置文件a中记录有应用程序A的热点编译单元,配置文件b中记录有应用程序B的热点编译单元,配置文件c中记录有应用程序C的热点编译单元。其中,对于不同的电子设备所安装的应用程序可以不同,也可以相同。例如,对于多个电子设备可以都安装有应用程序A、应用程序B以及应用程序C。
可以理解的是,目标应用程序为所属的配置文件会进行后续步骤处理的应用程序,在本申请实施例中,服务器可以有多种方式来确定目标应用程序。
作为一种方式,服务器可以将安装量较多的应用程序作为目标应用程序。可选的,电子设备可以定期的向服务器上传应用程序安装信息,在该应用程序安装信息中包括电子设备当前所已经安装的应用程序。那么服务器可以对多个电子设备定期上传应用程序安装信息进行统计,若检测到某个应用程序的安装量大于安装阈值,则可以将该安装量大于安装阈值的应用程序作为目标应用程序。
示例性的,有上传过应用程序安装信息给服务器的电子设备有100个,而其中90个电子设备中都安装有应用程序A,在安装阈值为80的情况下, 那么服务器可以将应用程序A作为目标应用程序。通过这种方式,可以使得服务器及时的对安装量较大的应用程序进行运行效率的优化。
作为另外一种方式,电子设备可以同时结合安装量以及对应的配置文件的大小来确定目标应用程序。需要说明的是,不同的应用程序因为自身的功能或者运行频率的不同,所属的配置文件的大小是不同的,而电子设备在应用程序运行前提前进行对配置文件中的热点编译单元进行编译是需要消耗一定的资源以及时间的,那么对于配置文件较小的应用程序,可以确定其运行频率可能较低,服务器就可以不对这些运行频率较低的应用程序所属的配置文件进行处理。对应的,在这种方式下,电子设备上报的应用程序安装信息中,除了有所安装的应用程序外,还可以包括每个应用程序所属的配置文件的大小。服务器在检测到多个电子设备中,某同一个应用程序所属的配置文件的大小大于指定阈值的数量大于阈值数量时,就可以将该同一个应用程序作为目标应用程序。
示例性的,有上传过应用程序安装信息给服务器的电子设备有100个,而其中90个电子设备中都安装有应用程序A,那么这90个电子设备所安装的应用程序A都各自有一个配置文件(即可以理解为有90个配置文件)。若服务器识别到其90个配置文件中,80个都是小于1kb的,那么在安装阈值为80,指定阈值为10kb,阈值数量为50的情况下,服务器不会将应用程序A作为目标应用程序。但是,若服务器识别到90个配置文件中有60个(大于阈值数量50)配置文件的大小都为11~12kb(大于指定阈值10kb),那么就可以判定该应用程序A为目标应用程序。
作为再一种方式,服务器还可以根据配置信息来确定目标应用程序。在这种方式下,可以通过人为配置的方式来确定哪些应用程序为目标应用程序。示例性的,服务器可以将多个电子设备上报的应用程序安装信息所涉及的应用程序作为待选的应用程序,操作人员可以从该待选的应用程序中选择一个或多个应用程序作为选中的应用程序,对应的,服务器将该选中的应用程序存储在配置文件中,那么在这种情况下,服务器可以将配置到该配置文件中的应用程序作为目标应用程序。
在基于前述方式确定目标应用程序后,服务器可以进一步的将目标应用程序所属的配置文件作为第二配置文件。而在本申请实施例中,目标应用程序对应的多个第二配置文件可以理解为多个电子设备中所安装的同一目标应用程序各自所属的配置文件。
步骤S220:从所述多个第二配置文件记录中获取多个热点编译单元。
作为一种方式,服务器可以直接将多个第二配置文件中的所有热点编译单元去重后作为获取的多个热点编译单元。
步骤S230:将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
步骤S240:将所述多个第一配置文件发送给电子设备,以用于所述电子 设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
需要说明的是,执行本实施例提供的应用程序预编译的方法服务器可以为图1和图2中的服务器200,也可以为图3中的服务器201。
本申请提供的一种应用程序预编译的方法,通过从多个电子设备中获取目标应用程序对应的多个第二配置文件的方式,从该多个第二配置文件中获取到与所述目标应用程序对应的多个热点编译单元,将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成对应的预编译阶段不同的多个第一配置文件,将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。从而通过上述方式,使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。并且,最开始所获取的多个热点编译单元为从关于电子设备的实际运行状态的第二配置文件中获取,使得所得到的多个热点编译单元更能贴合用户的实际使用习惯,使得生成的多个第一配置文件更加适配用户的实际使用习惯,提升了目标应用程序效率提升的有效性。
请参阅图6,本申请提供的一种应用程序预编译的方法,应用于服务器,所述方法包括:
步骤S310;获取目标应用程序对应的多个热点编译单元。
作为一种方式,可以如前述实施例所示的,从前述实施例中的多个第二配置文件记录中获取多个热点编译单元。并且,还可以同时获取到每个热点编译单元在多个第二配置文件中出现的次数。实例性的,服务器所收集到有同一目标应用程序对应的第二配置文件A、第二配置文件B以及第二配置文件C,其中第二配置文件A、第二配置文件B以及第二配置文件C分别从不同的电子设备中获取。
其中,第二配置文件A包括有热点编译单元A、热点编译单元B以及热点编译单元C,第二配置文件B包括有热点编译单元A、热点编译单元C以及热点编译单元D,第二配置文件C包括有热点编译单元A、热点编译单元B以及热点编译单元E。在这种情况下,所获取到的多个热点编译单元包括热点编译单元A(出现3次)、热点编译单元B(出现2次)、热点编译单元C(出现2次)、热点编译单元D(出现1次)以及热点编译单元E(出现1次)。
步骤S320:将所述多个热点编译单元中关于所述目标应用程序启动过程的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件。
需要说明的是,应用程序在启动过程中也会涉及相关的功能代码的编译以及运行。那么就可以将所述多个热点编译单元中与应用程序的启动过程相关的热点编译单元划分为第一部分,进而生成对应所述第一部分的第一配置文件。
步骤S330:将所述多个热点编译单元中运行次数大于第一阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件。
需要说明的是,本实施例中所涉及的运行次数可以理解为基于JIT方式运行的次数,也就是前述实例中第二配置文件A、第二配置文件B以及第二配置文件C各个热点编译单元出现的次数。示例性的,若第一阈值为1,那么依据前述实例中第二配置文件A、第二配置文件B以及第二配置文件C,划分为第二部分的热点编译单元包括热点编译单元A(出现3次)、热点编译单元B(出现2次)、热点编译单元C(出现2次)。
步骤S340:将所述多个热点编译单元中运行次数大于第二阈值的热点编译单元划分为第三部分,生成对应所述第三部分的第一配置文件,其中,所述第一阈值大于所述第二阈值,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
示例性的,若第二阈值为2,那么依据前述实例中第二配置文件A、第二配置文件B以及第二配置文件C,划分为第三部分的热点编译单元包括热点编译单元A(出现3次)。
步骤S350:将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
可以理解的是,本实施例所提及的多个第一配置文件是指基于步骤S320、步骤S330以及步骤S340所得到的多个第一配置文件。并且,其中步骤S320、步骤S330以及步骤S340可以依次进行,也可以并行进行。
作为一种方式,配置所述第一部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序的安装阶段;配置所述第二部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于息屏阶段;配置所述第三部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于空闲阶段。
需要说明的是,本实施例中所涉及的第一阈值以及第二阈值的实际值只是示例性的给出的,第一阈值和第二阈值的实际数值可以在运行中根据实际情况而确定,例如,可以配置第一阈值为5000,而第二阈值可以为15000。并且,对于第二部分对应的第一配置文件和第三部分对应的第一配置文件的运行阶段也可以不限于上述的方式,例如,也可以配置所述第二部分对应的第一配置文件为电子设备处于空闲阶段,而配置所述第三部分对应的第一配置文件为电子设备处于息屏阶段。
需要说明的是,在本实施例中所涉及的划分这个操作可以理解为服务器将热点编译单元写入到对应的第一配置文件中。作为一种方式,服务器可以按照预先划分规则生成多个第一配置文件,且配置不同的第一配置文件在不同的阶段运行。示例性的,可以先生成有第一配置文件A、第一配置文件B以及第一配置文件C。且配置第一配置文件A为在应用程序安装阶段运行, 那么在对步骤S310所获取的多个热点编译单元进行划分的过程中,若将某个热点编译单元划分为第一部分(该第一部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序的安装阶段),则可以理解为将该某个热点编译单元写入到第一配置文件A中,其他部分的划分也可以按照这种方式理解,此处不再赘述。
并且,若服务器是伴随更新文件将该多个第一配置文件发送给电子设备,那么在这种情况下,电子设备可以在安装更新文件的过程中,运行第一部分对应的第一配置文件。
本申请提供的一种应用程序预编译的方法,使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。并且,在本实施例中,可以将与目标应用程序启动相关的热点编译单元划分为单独一个部分,并且配置在目标应用程序安装阶段进行预编译,且将其他部分对应的第一配置文件配置为在电子设备息屏或者空闲状态进行,有效的减小了目标应用程序安装整体耗时,并且也更大程度的减少了预编译操作对电子设备运行性能的影响,提升了用户体验。
请参阅图7,本申请提供的一种应用程序预编译的方法,应用于服务器,所述方法包括:
步骤S410:获取目标应用程序对应的多个热点编译单元。
步骤S420:将所述多个热点编译单元中代码量小于第一代码量阈值的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件。
步骤S430:将所述多个热点编译单元中代码量不小于所述第一代码量阈值且小于第二代码量阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件。
步骤S440:将所述多个热点编译单元中代码量不小于所述第二代码量阈值的热点编译单元划分为第三部分,生成对应所述第三部分的第一配置文件。每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
步骤S450:将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
作为一种方式,配置所述第一部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序的安装阶段;配置所述第二部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于息屏阶段;配置所述第三部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于空闲阶段。
本申请提供的一种应用程序预编译的方法,使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集 中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。并且,在本实施例中,可以根据热点编译单元的代码量来进行部分划分,并且配置包括的热点编译单元的代码量最少的部分在目标应用程序安装阶段进行预编译,且将其他部分对应的第一配置文件配置为在电子设备息屏或者空闲状态进行,有效的减小了目标应用程序安装整体耗时,并且也更大程度的减少了预编译操作对电子设备运行性能的影响,提升了用户体验。
请参阅图8,本申请提供的一种应用程序预编译的方法,应用于电子设备,所述方法包括:
步骤S510:获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
步骤S520:根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
作为一种方式,所述多个第一配置文件包括预编译阶段为所述目标应用程序的安装阶段的第一配置文件、预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件以及预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件。在这种方式下,若检测到安装所述目标应用程序时,运行所述预编译阶段为所述目标应用程序的安装阶段的第一配置文件;若检测到所述电子设备处于息屏状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件;若检测到所述电子设备处于充电状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件。
需要说明的是,在电子设备中,配置文件是存储在***指定的路径下的。以安卓***为例,在安卓***中,应用程序的配置文件存储在路径/data/misc/profiles/中。那么作为一种适配有多个配置文件的这种方式,电子设备中可以配置在存储配置文件的指定的路径下进一步的配置多个存储区域,并且配置一个存储区域用于存储同一个编译阶段的配置文件。示例性的,在前述实施例中多个第一配置文件对应的编译阶段有应用程序安装阶段、息屏阶段以及空闲阶段。那么对应的在指定的路径下可以配置第一存储区域用于存储每个应用程序对应的在应用程序安装阶段进行预编译的第一配置文件,配置第二存储区域用于存储每个应用程序对应的在息屏阶段进行预编译的第一配置文件,配置第三存储区域用于存储每个应用程序对应的在空闲阶段进行预编译的第一配置文件。从而实现电子设备可以通过在指定的路径下的不同存储区域直接读取对应编译阶段的配置文件即可,避免了将每个应用程序的所有编译阶段的第一配置文件均放置在一个路径下造成的查找耗时较长,以及管理不便的问题。
请参阅图9,本申请提供的一种应用程序预编译的装置600,运行于服务器,所述装置600包括:
热点信息获取单元610,用于获取目标应用程序对应的多个热点编译单 元。
作为一种方式,热点信息获取单元610,具体用于若检测到所述目标应用程序版本更新时,获取目标应用程序对应的多个热点编译单元。
作为一种方式,热点信息获取单元610,具体用于从多个电子设备中获取目标应用程序对应的多个第二配置文件,所述第二配置文件用于记录所述目标应用程序的热点编译单元;从所述多个第二配置文件记录中获取多个热点编译单元。
配置文件生成单元620,用于将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
作为一种方式,配置文件生成单元620,具体用于将所述多个热点编译单元中关于所述目标应用程序启动过程的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件;将所述多个热点编译单元中运行次数大于第一阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件;将所述多个热点编译单元中运行次数大于第二阈值的热点编译单元划分为第三部分,生成对应所述第三部分的第一配置文件;其中,所述第一阈值大于所述第二阈值。
作为另外一种方式,配置文件生成单元620,具体用于将所述多个热点编译单元中代码量小于第一代码量阈值的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件;将所述多个热点编译单元中代码量不小于所述第一代码量阈值且小于第二代码量阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件;将所述多个热点编译单元中代码量不小于所述第二代码量阈值的热点编译单元划分为第三部分,生成对应所述第三部分的第一配置文件。
可选的,配置文件生成单元620,还用于配置所述第一部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序的安装阶段;配置所述第二部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于息屏阶段;配置所述第三部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于空闲阶段。
配置文件分发单元630,用于将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
请参阅图10,本申请提供的一种应用程序预编译的装置700,运行于电子设备,所述装置700包括:
配置文件获取单元710,用于获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同。
编译单元720,用于根据每个所述第一配置文件对应的预编译阶段对所 述第一每个配置文件中包括的热点编译单元进行预编译。
作为一种方式,所述多个第一配置文件包括预编译阶段为所述目标应用程序的安装阶段的第一配置文件、预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件以及预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件。在这种方式下,编译单元720,具体用于若检测到安装所述目标应用程序时,运行所述预编译阶段为所述目标应用程序的安装阶段的第一配置文件;若检测到所述电子设备处于息屏状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件;若检测到所述电子设备处于充电状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件。
需要说明的是,本申请中具体如何根据音频编码类型对音频数据进行编码是可以采用现有的技术,本申请就不再细述。
下面将结合图11对本申请提供的一种电子设备进行说明。
请参阅图11,基于上述的应用程序预编译的方法、装置,本申请实施例还提供的另一种可以执行前述应用程序预编译的方法的电子设备200。电子设备200包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及网络模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。
其中,处理器102可以包括一个或者多个处理核。处理器102利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作***、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作***的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。例如,存储器104中可以存储有应用程序预编译的装置。该应用程序预编译的装置可以为前述的装置600或者装置700。
所述网络模块106用于接收以及发送电磁波,实现电磁波与电信号的相互 转换,从而与通讯网络或者其他设备进行通讯,例如和无线接入点进行通讯。所述网络模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述网络模块106,还可以作为网络适配器,用于电子设备200直接通过线路连接的方式接入到网络中。该网络可包括蜂窝式电话网、无线局域网或者城域网。
请参考图12,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。
综上所述,本申请提供的一种应用程序预编译的方法、装置、服务器及存储介质,在获取目标应用程序对应的多个热点编译单元后,将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成对应的预编译阶段不同的多个第一配置文件,将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。从而通过上述方式,使得目标应用程序对应的多个热点编译单元可以分阶段的形式,在多个阶段分别进行预编译,而不用集中进行预编译,进而提升了预编译的灵活性,同时也减少了集中进行热点编译单元的编译所带来的性能消耗,提升了电子设备的运行流畅性。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种应用程序预编译的方法,其特征在于,应用于服务器,所述方法包括:
    获取目标应用程序对应的多个热点编译单元;
    将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;
    将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
  2. 根据权利要求1所述的方法,其特征在于,所述获取目标应用程序对应的多个热点编译单元的步骤,包括:
    从多个电子设备中获取目标应用程序对应的多个第二配置文件,所述第二配置文件用于记录所述目标应用程序的热点编译单元;
    从所述多个第二配置文件记录中获取多个热点编译单元。
  3. 根据权利要求2所述的方法,其特征在于,所述从所述多个第二配置文件记录中获取多个热点编译单元,包括:
    对所述多个第二配置文件中的所有热点编译单元进行去重,得到多个热点编译单元。
  4. 根据权利要求1-3任一所述的方法,其特征在于,所述将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件的步骤,包括:
    将所述多个热点编译单元中关于所述目标应用程序启动过程的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件;
    将所述多个热点编译单元中运行次数大于第一阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件;
    将所述多个热点编译单元中运行次数大于第二阈值的热点编译单元划分为第三部分,生成对应所述第三部分的第一配置文件;
    其中,所述第一阈值大于所述第二阈值。
  5. 根据权利要求1-3任一所述的方法,其特征在于,所述将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件的步骤,包括:
    将所述多个热点编译单元中代码量小于第一代码量阈值的热点编译单元划分为第一部分,生成对应所述第一部分的第一配置文件;
    将所述多个热点编译单元中代码量不小于所述第一代码量阈值且小于第二代码量阈值的热点编译单元划分为第二部分,生成对应所述第二部分的第一配置文件;
    将所述多个热点编译单元中代码量不小于所述第二代码量阈值的的热点 编译单元划分为第三部分,生成对应所述第三部分的第一配置文件。
  6. 根据权利要求4或5所述的方法,其特征在于,所述方法,还包括:
    配置所述第一部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序的安装阶段;
    配置所述第二部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于息屏阶段;
    配置所述第三部分对应的第一配置文件所包括的热点编译单元对应的预编译阶段为所述目标应用程序所在电子设备处于空闲阶段。
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    将所述第一部分对应的第一配置文件存储在指定的路径下的第一存储区域;
    将所述第二部分对应的第一配置文件存储在指定的路径下的第二存储区域;
    将所述第三部分对应的第一配置文件存储在指定的路径下的第三存储区域;
    其中,所述第一存储区域、第二存储区域以及所述第三存储区域不同。
  8. 根据权利要求1-7任一所述的方法,其特征在于,所述获取目标应用程序对应的多个热点编译单元的步骤包括:
    若检测到所述目标应用程序版本更新时,获取目标应用程序对应的多个热点编译单元。
  9. 根据权利要求1-8任一所述的方法,其特征在于,所述获取目标应用程序对应的多个热点编译单元,包括:
    若检测到所述目标应用程序版本更新时,获取目标应用程序对应的多个热点编译单元。
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述将所述多个第一配置文件发送给电子设备,包括:
    在电子设备初始下载所述目标应用程序时,将所述多个第一配置文件伴随所述目标应用程序的安装包发送给所述电子设备。
  11. 根据权利要求1-10任一所述的方法,其特征在于,所述方法还包括:
    若检测到应用程序对应的安装量大于安装阈值,将所述应用程序作为目标应用程序。
  12. 根据权利要求1-10任一所述的方法,其特征在于,所述方法还包括:
    获取多个电子设备中的同一个应用程序所属的配置文件的大小大于指定阈值的数量;
    若所述数量大于阈值数量,将该所述应用程序作为目标应用程序。
  13. 一种应用程序预编译的方法,其特征在于,应用于电子设备,所述方法包括:
    获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;
    根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
  14. 根据权利要求13所述的方法,其特征在于,所述多个第一配置文件包括预编译阶段为所述目标应用程序的安装阶段的第一配置文件、预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件以及预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件;所述根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译的步骤包括:
    若检测到安装所述目标应用程序时,运行所述预编译阶段为所述目标应用程序的安装阶段的第一配置文件;
    若检测到所述电子设备处于息屏状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件;
    若检测到所述电子设备处于充电状态时,运行所述预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件。
  15. 根据权利要求14所述的方法,其特征在于,所述方法还包括:
    将所述预编译阶段为所述目标应用程序的安装阶段的第一配置文件存储在指定的路径下的第一存储区域;
    将所述预编译阶段为所述目标应用程序所在电子设备处于息屏阶段的第一配置文件存储在指定的路径下的第二存储区域;
    将所述预编译阶段为所述目标应用程序所在电子设备处于空闲阶段的第一配置文件存储在指定的路径下的第三存储区域;
    其中,所述第一存储区域、第二存储区域以及所述第三存储区域不同。
  16. 一种应用程序预编译的装置,其特征在于,运行于服务器,所述装置包括:
    热点信息获取单元,用于获取目标应用程序对应的多个热点编译单元;
    配置文件生成单元,用于将所述多个热点编译单元划分为多个部分,并对应每个所述部分分别生成第一配置文件,得到多个第一配置文件,其中,每个所述第一配置文件包括所对应部分的热点编译单元,且不同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;
    配置文件分发单元,用于将所述多个第一配置文件发送给电子设备,以用于所述电子设备根据每个第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
  17. 根据权利要求14所述的装置,其特征在于,所述热点信息获取单元,具体用于从多个电子设备中获取目标应用程序对应的多个第二配置文件,所述第二配置文件用于记录所述目标应用程序的热点编译单元;从所述多个第二配置文件记录中获取多个热点编译单元。
  18. 一种应用程序预编译的装置,其特征在于,运行于电子设备,所述装置包括:
    配置文件获取单元,用于获取服务器发送的目标应用程序对应的多个第一配置文件,每个所述第一配置文件包括所对应部分的热点编译单元,且不 同所述第一配置文件所包括的热点编译单元对应的预编译阶段不同;
    编译单元,用于根据每个所述第一配置文件对应的预编译阶段对所述第一每个配置文件中包括的热点编译单元进行预编译。
  19. 一种服务器,其特征在于,包括一个或多个处理器以及存储器;
    一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行权利要求1-12任一所述的方法。
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-12任一所述的方法。
PCT/CN2020/133403 2019-12-09 2020-12-02 应用程序预编译的方法、装置、服务器及存储介质 WO2021115178A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911252047.6 2019-12-09
CN201911252047.6A CN113031953A (zh) 2019-12-09 2019-12-09 应用程序预编译的方法、装置、电子设备以及服务器

Publications (1)

Publication Number Publication Date
WO2021115178A1 true WO2021115178A1 (zh) 2021-06-17

Family

ID=76329516

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/133403 WO2021115178A1 (zh) 2019-12-09 2020-12-02 应用程序预编译的方法、装置、服务器及存储介质

Country Status (2)

Country Link
CN (1) CN113031953A (zh)
WO (1) WO2021115178A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118069154A (zh) * 2024-04-22 2024-05-24 荣耀终端有限公司 应用编译控制方法及相关设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775893A (zh) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 对程序预编译的方法及装置
US20170208150A1 (en) * 2016-01-20 2017-07-20 Google Inc. Methods and apparatus to selectively provide cached and presently compiled applications
CN107168749A (zh) * 2017-05-31 2017-09-15 腾讯科技(深圳)有限公司 一种编译方法、装置、设备和计算机可读存储介质
CN109460235A (zh) * 2018-10-09 2019-03-12 珠海格力电器股份有限公司 组态软件编译方法
CN109960507A (zh) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 编译优化方法、装置、存储介质、智能终端及服务器

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170208150A1 (en) * 2016-01-20 2017-07-20 Google Inc. Methods and apparatus to selectively provide cached and presently compiled applications
CN106775893A (zh) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 对程序预编译的方法及装置
CN107168749A (zh) * 2017-05-31 2017-09-15 腾讯科技(深圳)有限公司 一种编译方法、装置、设备和计算机可读存储介质
CN109960507A (zh) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 编译优化方法、装置、存储介质、智能终端及服务器
CN109460235A (zh) * 2018-10-09 2019-03-12 珠海格力电器股份有限公司 组态软件编译方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118069154A (zh) * 2024-04-22 2024-05-24 荣耀终端有限公司 应用编译控制方法及相关设备

Also Published As

Publication number Publication date
CN113031953A (zh) 2021-06-25

Similar Documents

Publication Publication Date Title
CN111061484B (zh) 代码编译方法、装置、服务器、用户终端及可读介质
CN111078318B (zh) 配置文件的处理方法、装置、***及存储介质
CN105302587B (zh) 数据更新方法及装置
CN105763602A (zh) 一种数据请求处理的方法、服务器及***
CN106970816B (zh) 一种软件升级处理方法、装置及音频播放设备
CN109791497B (zh) 一种执行热补丁的方法、装置及终端
CN112948026A (zh) 热点代码处理方法、装置、服务器、电子设备及存储介质
CN103870303A (zh) 减小软件安装包大小的方法及装置
WO2021115177A1 (zh) 应用安装方法、装置、终端设备、服务器及存储介质
CN112667405B (zh) 信息处理方法、装置、设备及存储介质
CN105511962A (zh) 渲染方法和装置
WO2021115178A1 (zh) 应用程序预编译的方法、装置、服务器及存储介质
CN109032685B (zh) 一种加速安卓***启动的方法及终端
CN104375854A (zh) 一种应用更新下载方法及用户终端
CN111865676A (zh) 配置文件的更新检查方法、装置、服务器及存储介质
CN111200744B (zh) 一种多媒体播放控制方法、装置及智能设备
CN113126994A (zh) 热点代码处理方法、装置、电子设备及存储介质
CN106550384A (zh) 基站批量升级方法及装置
WO2021129489A1 (zh) 应用程序预编译的方法、装置、电子设备及存储介质
CN105808268B (zh) 一种信息处理方法、电子设备及***
CN110851433B (zh) 键值存储***键优化方法、存储介质、电子设备及***
WO2021088624A1 (zh) 应用程序预编译的方法、装置、电子设备以及服务器
WO2021102849A1 (zh) 资源获取方法、装置以及电子设备
WO2021129339A1 (zh) 配置文件处理方法、装置、电子设备及存储介质
CN109803160B (zh) 一种资源分配方法、装置及***

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20900164

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20900164

Country of ref document: EP

Kind code of ref document: A1