WO2019114506A1 - Compilation optimization method and device, storage medium, intelligent terminal and server - Google Patents

Compilation optimization method and device, storage medium, intelligent terminal and server Download PDF

Info

Publication number
WO2019114506A1
WO2019114506A1 PCT/CN2018/116586 CN2018116586W WO2019114506A1 WO 2019114506 A1 WO2019114506 A1 WO 2019114506A1 CN 2018116586 W CN2018116586 W CN 2018116586W WO 2019114506 A1 WO2019114506 A1 WO 2019114506A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
preset
target application
hotspot
smart terminal
Prior art date
Application number
PCT/CN2018/116586
Other languages
French (fr)
Chinese (zh)
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 WO2019114506A1 publication Critical patent/WO2019114506A1/en

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/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4441Reducing the execution time required by the program code
    • G06F8/4442Reducing the number of cache misses; Data prefetching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • 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

  • the present disclosure relates to the field of computer technology, for example, to compiler optimization methods, apparatus, storage media, smart terminals, and servers.
  • smart devices such as smart phones, tablets and smart TVs have become indispensable electronic devices in people's lives.
  • An operating system is commonly installed in intelligent terminals, and Android (Android) operating system is one of the most common intelligent operating systems, and has been widely used.
  • the intelligent terminal usually includes the underlying layer and the application layer, and is written in different languages, and needs to be compiled by the virtual machine to enable the application to run normally in the smart terminal.
  • the underlying layer such as the Linux kernel layer
  • the application layer is generally written in the Java language
  • the Java-based program needs to run on the virtual machine.
  • a virtual machine (VM) is responsible for interpreting or compiling a file or code corresponding to a Java-developed application to an executable file or code to enable the application to run.
  • VM virtual machine
  • the present disclosure provides a compiler optimization method, apparatus, storage medium, and intelligent terminal, which can optimize a virtual machine based compilation scheme in an intelligent terminal.
  • the present disclosure provides a compiler optimization method applied to a smart terminal, including:
  • the target application includes at least one function
  • the preset server And acquiring, by the preset server, a first statistic value corresponding to each function in the target application, where the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, the first The frequency includes a frequency at which each function described by the preset user group is executed during use of the target application during the first preset statistical period;
  • Each first hotspot function is compiled into native machine code by pre-compilation of the virtual machine.
  • the present disclosure provides a compilation optimization method applied to a server, including:
  • the at least one first statistic value is used to indicate that the smart terminal is configured according to the at least one A statistic determines at least one first hotspot function in the application and compiles each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
  • the present disclosure provides a compiler optimization device, which is configured in a smart terminal, and includes:
  • Running a monitoring module configured to detect whether there is an unoperated target application in the smart terminal; wherein the target application includes at least one function;
  • the statistic value obtaining module is configured to: when detecting that the target application that is not running exists in the smart terminal, obtain a first statistic value corresponding to the function in the target application from the preset server, where the first statistic value includes And calculating, according to the first frequency corresponding to each function, the first frequency includes: in the first preset statistical period, the preset user group is executed during the use of the target application.
  • the hotspot function determining module is configured to determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function;
  • Compile the module set to compile each first hotspot function to native machine code by compiling the virtual machine before it runs.
  • the present disclosure provides a compiler optimization apparatus configured in a server, including:
  • the statistic value calculation module is configured to collect, during the first preset statistic period, a first frequency that the preset user group is executed during the use of the application, and each function is executed according to each function The first frequency calculates a first statistical value corresponding to each function; wherein the application includes at least one function;
  • Obtaining a request receiving module configured to receive, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to the at least one function in the application, wherein the smart terminal detects that the application is not running out of time Sending the acquisition request to the server;
  • a statistical value sending module configured to: when the smart terminal acquires an acquisition request of the at least one first statistic value corresponding to the at least one function in the application, Transmitting at least one first statistic value corresponding to a function to the smart terminal, the at least one first statistic value is used to indicate that the smart terminal determines the application according to the at least one first statistic value At least one first hotspot function, and compiling each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
  • the present disclosure provides a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements a compilation optimization method as described in embodiments of the present disclosure.
  • the present disclosure provides a smart terminal including a memory, a processor, and a computer program stored on the memory and executable by the processor, the processor executing the computer program to implement compilation optimization as described in the embodiments of the present disclosure method.
  • the compiling optimization scheme provided by the present disclosure enables the smart terminal to obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hotspot function that needs to be pre-compiled according to the statistical situation, and then Compile the hotspot function into local machine code by compiling the virtual machine before running, which improves the efficiency of the application for the first time.
  • the compiler optimization solution provided by the disclosure enables the server to calculate the frequency of execution of different functions of the preset user group in the process of using the application by using the big data method, thereby calculating the first statistic value, and sending the first statistic value to the smart
  • the terminal instructs the smart terminal to pre-compile the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
  • FIG. 1 is a schematic flow chart of a compiling optimization method provided by an embodiment
  • FIG. 2 is a schematic flowchart of a compiling optimization method provided by another embodiment
  • FIG. 3 is a schematic flowchart of a compiling optimization method provided by another embodiment
  • FIG. 4 is a schematic flowchart of a compiling optimization method provided by another embodiment
  • FIG. 5 is a signaling diagram of an intelligent terminal interacting with a server according to an embodiment
  • FIG. 6 is a structural block diagram of a compiler optimization apparatus according to an embodiment
  • FIG. 7 is a structural block diagram of a compiler optimization apparatus according to another embodiment.
  • FIG. 8 is a schematic structural diagram of an intelligent terminal according to an embodiment
  • FIG. 9 is a schematic structural diagram of an intelligent terminal according to another embodiment.
  • FIG. 10 is a schematic structural diagram of a server according to an embodiment.
  • the Android operating system is taken as an example to introduce a simple introduction of two virtual machine Dalvik virtual machines (DVM) and ART (Android Runtime) virtual machines. .
  • DVM virtual machine Dalvik virtual machines
  • ART Android Runtime
  • Dalvik is a virtual machine designed and developed by Google for the Android platform. It is an important part of the Android platform and supports the running of Java applications in the dex (Dalvik Executable) format.
  • the dex format is a compression format specially designed for Dalvik.
  • Java programs Java classes are compiled into one or more class files, and then the class files are converted to dex files by the DEX tool, and the Dalvik virtual machine reads commands from them. And data.
  • the Dalvik virtual machine is an interpretation execution mechanism that is responsible for interpreting the dex file as a machine code.
  • the Java bytecode is parsed and run in the dex file at each run time, but the disadvantage is poor performance and slow operation.
  • the Dalvik virtual machine has a Just In Time Compiler (JIT).
  • JIT Just In Time Compiler
  • the JIT compiler When the application runs, whenever a new class is encountered, the JIT compiler will compile the class.
  • the compiled code will be optimized to the native code so that the next time it reaches the same logic (also called a method or function), the speed will be faster, but using JIT is not necessarily the case.
  • Speed up execution if most of the code is executed a small number of times, then the compilation time is not necessarily less than the time to execute dex, and the dex bytecode translation cost machine code is the operation of the application (Application, APP) Every time the application is re-run, the translation work needs to be redone, that is, every time the application is reopened, JIT compilation is required.
  • the ART virtual machine adopts Ahead of Time (AOT), which is also called pre-compilation or pre-compilation. It is pre-compiled for all applications (after installing an application for the first time).
  • Execution file also known as local machine code or local machine code
  • the application starts no additional translation work is required, and the local machine code is used directly to speed up the operation, but the disadvantage is that the first boot time is too long. It may take up to ten minutes, resulting in a bad user experience and a certain amount of storage space.
  • a combination of the ART virtual machine, the JIT, and the explanation execution can be used to optimize the compilation scheme of the virtual machine, and the operation efficiency of the application in the smart terminal can be improved. For example, cancel the process of compiling all applications when booting for the first time, and change to a function based on the usage habit of the intelligent terminal user for high-frequency access or execution (also called execution hotspot or hotspot function).
  • execution hotspot or hotspot function also called execution hotspot or hotspot function.
  • the statistical result determines the scheme of the hotspot function, which will be described below in conjunction with the specific embodiments.
  • FIG. 1 is a schematic flowchart of a compiling optimization method provided by an embodiment.
  • the method may be implemented by a compiler optimization apparatus.
  • the apparatus may be implemented by software and/or hardware, and may be integrated into an intelligent terminal. As shown in FIG. 1, the method includes the following steps.
  • Step 1010 It is detected that there is an target application that is not running in the smart terminal.
  • the smart terminal in this embodiment may include a smart device installed with an operating system, such as a smart phone, a tablet computer, a media player, and a smart home appliance.
  • an operating system such as a smart phone, a tablet computer, a media player, and a smart home appliance.
  • the type of the operating system is not limited in this embodiment, and may be an Android operating system, an iOS operating system, and a Windows (Windows) operating system.
  • the Android operating system will be taken as an example for description.
  • the target application that has not been run may include an application that has been installed in the smart terminal but has not been run, and may also include an application during the installation process.
  • the detecting the presence or absence of the target application that has not been run in the smart terminal may include: when the smart terminal is powered on, detecting that the application installation file download event is triggered or downloaded after detecting the installation of the application, and When it is detected that the user triggers the program detection event not running (such as the user starts the application to run the acceleration switch for the first time).
  • Step 1020 Acquire a first statistic value corresponding to each function in the target application from a preset server.
  • the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, where the first frequency includes the preset user group in the first preset statistic period, The frequency at which each function described in the target application process is executed.
  • the step of calculating the first statistical value and collecting relevant data for calculating the first statistical value may be performed by a preset server.
  • the first preset statistical period may be determined according to the characteristics of the smart terminal or the user's use requirements, etc., and the disclosure is not limited.
  • the smart terminal is a smart phone, and most users use it for a long time almost every day.
  • the first preset statistical period can be set shorter, such as one week.
  • the preset user group may include all smart terminal users who have used the target application, or may select some users as a sample to form a preset user group, such as 20,000 users who agree to the data collection terms in advance.
  • the preset user group may also be a group having the same user attribute, such as a female user group, a user group of a specified age group (such as 20 to 30 years old), and the like.
  • the disclosure does not limit the collection objects of the user group, and can be selected according to actual needs.
  • the types of smart terminals actually used by the preset user group when using the target application may be the same or different, and may be determined by the difference of the same application in different smart terminals.
  • WeChat Take WeChat as an example. If the functions included in the mobile version of WeChat and the tablet version of WeChat are quite different, for smartphones, only the usage data of the default user group when using WeChat through the smartphone can be collected; if the mobile version is WeChat and tablet The functions included in WeChat are basically the same or identical. For smartphones, the usage data of the default user group when using WeChat through smartphones and tablets can also be collected.
  • Each class includes one or more functions (also called methods). Different functions generally correspond to different functions.
  • the frequency of use of different functions is different depending on the user's usage habits. Taking WeChat as an example, the chat function and the circle of friends are more common.
  • the corresponding function is executed (or called) at a higher frequency and is more important, and the collection function or card package function may not be used frequently for many users. Then the corresponding function will be executed at a lower frequency and less important.
  • the frequency at which multiple functions are executed by the preset user group in the process of using an application in the first preset statistical period is collected, and then the statistical value corresponding to each function is calculated, and the statistical value may reflect The frequency and importance of the corresponding function is used to facilitate the intelligent terminal to determine the hotspot function for performing precompilation related operations.
  • the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, and the method for calculating the first statistic value is not limited in the disclosure, for example, multiple first frequencies may be taken.
  • the highest value in the middle may be an average value or a weighted average of a plurality of first frequencies, and the like.
  • Step 1030 Determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function.
  • the local machine code occupies a certain storage space in the intelligent terminal, so it is necessary to selectively determine the hotspot function for compiling.
  • a corresponding function with a higher first statistical value may be selected as the first hotspot function. For example, there are a total of A functions in the target application, sorted from high to low according to the first statistical value, and the first bA functions can be selected as the first hotspot function, b is a coefficient smaller than 1, and bA can be rounded up or down.
  • the value of b can be freely set, or can be determined according to the current remaining storage space of the smart terminal; for example, the front B (B is less than or equal to A) functions can be selected as the first hotspot function, and B can be a fixed value, or The value determined dynamically according to the current remaining storage space of the smart terminal; for example, a statistical threshold may be preset, which may be recorded as a first preset statistical threshold, and the corresponding first statistical value reaches a function of the first preset statistical threshold.
  • a statistical threshold may be preset, which may be recorded as a first preset statistical threshold, and the corresponding first statistical value reaches a function of the first preset statistical threshold.
  • the advantage of this setting is to ensure that the more frequently used functions are precompiled. If there are only a few functions in the application that satisfy the requirements, the frequency of the application itself is used. It is not high, so you will not precompile functions that do not meet the requirements, in order to save storage space for hotspot functions of other applications.
  • Step 1040 Compile each first hotspot function into local machine code by means of pre-compilation of the virtual machine.
  • the first hotspot function is compiled into the local machine code by the pre-compilation of the virtual machine, and when the target application is first started, when the first hotspot function needs to be executed, Direct use of the corresponding local machine code, without the need to interpret execution or compile in a timely manner, can effectively improve the efficiency of the first application of the target application.
  • the compiling process of the first hotspot function may be determined by a virtual machine used in the operating system of the smart terminal, which is not limited in this embodiment. It can be compiled after the target application is installed, before the first run, or during the installation of the target application. In an embodiment, for other functions in the target application that are not determined as the first hotspot function, if the other functions need to be executed during the running of the target application, the execution may be interpreted in a manner that does not affect the target.
  • the application is running.
  • the compiler optimization method provided in this embodiment detects that there is an unexecuted target application in the smart terminal, and for each function in the target application, acquires a first statistic value corresponding to each function from the preset server.
  • the first statistic value includes a value calculated according to a frequency at which each function of the preset user group is executed in the process of using the target application in the first preset statistical period, and then determining the target application according to the first statistic value.
  • the first hotspot function in the program compiles the determined first hotspot function into local machine code by means of pre-compilation of the virtual machine.
  • the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time.
  • the present embodiment innovatively combines the ART virtual machine, the JIT, and the interpretation execution, and assists with the statistical results of the big data, thereby effectively improving the running speed and efficiency of the application in the intelligent terminal, and accumulating to the foot.
  • the amount of native statistics does not need to be interpreted to perform all functions in the target application.
  • the first statistic value corresponding to each function is determined by collecting, in the first preset statistic period, each user in the preset user group as described in the process of using the target application.
  • the first frequency of the function is performed; the usage intensity information corresponding to each user in the preset user group is acquired in the first preset statistical period; and the determining is performed according to the usage intensity information of each user a first weighting coefficient corresponding to each user, and performing a weighted average operation according to the first weighting coefficient and the first frequency, to obtain a first statistical value corresponding to each function.
  • the usage strength information may include the duration of use of the user, the duration of use of the smart terminal, or the duration of use of the target application, and the usage strength information may also include the total number of applications installed in the smart terminal. Etc., the disclosure is not specifically limited.
  • the usage duration may be the usage duration in the first preset statistical period, such as the cumulative usage duration in one week, or the usage duration in the first preset statistical period, such as the unit time is one day, and the usage duration is one day. The cumulative usage time within.
  • the method further includes: recording, by the user of the smart terminal, in the second preset statistical period. a second frequency in which each function in the target application is executed in the target application process, performing a weighted average operation according to a preset weight coefficient, the first statistical value, and the second frequency, to obtain each of the a second statistic corresponding to the function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, the first statistic value corresponding to the first preset weight coefficient, and the second frequency corresponding to the first Two preset weight coefficients; determining at least one second hotspot function in the target application according to at least one second statistical value corresponding to the at least one function; and applying the target according to the at least one second hotspot function
  • the compilation strategy of the program is updated.
  • the advantage of this setting is that the hotspot function can be changed according to the user's personal usage habits of the smart terminal, so that the pre-compiled hotspot function is more suitable for the user's personal habits and preferences.
  • the second preset statistical period may be the same as the first preset statistical period, or may be different, and is not limited in this embodiment.
  • the first statistic value is P
  • the second frequency is q
  • the first preset weight coefficient is k1
  • the second preset weight coefficient is k2
  • the values of /2, k1 and k2 are not limited in this embodiment.
  • k2 can be greater than k1 because the second frequency is more responsive to the user's personal habits, for example, k2 is 0.7 and k1 is 0.3.
  • the manner in which the second hotspot function is determined may be similar to the manner in which the first hotspot function is determined. For example, determining whether the second statistical value corresponding to each function reaches a second preset statistical threshold, and if so, determining each function as a second hotspot function in the target application.
  • the second preset statistical threshold may be the same as the first preset statistical threshold, or may be different, and is not limited in this embodiment.
  • the updating the compilation policy of the target application according to the at least one second hotspot function comprises: determining that the second hotspot function in the at least one second hotspot function is not compiled Compiling the uncompiled second hotspot function into local machine code by way of pre-compilation of the virtual machine; and/or determining that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to at least one The second hotspot function deletes the local machine code corresponding to the first hotspot function that has been compiled.
  • the advantage of the former is that it allows the function that can be compiled before running to be more suitable for the user's personal usage habits; the latter has the advantage that the local machine code of the first hotspot function that is used by the user who does not fit the smart terminal can be cleared. The storage space is released, so that the storage resources of the smart terminal can be more rationally utilized; both of the advantages include that the second hotspot function that fits the user's personal usage habits can be compiled into the local machine code, and can be cleared. Users who do not fit the smart terminal use the local machine code of the habit, and conform to the user's use requirements as a whole, and optimize the overall performance of the smart terminal.
  • the method before acquiring, by the preset server, the first statistic value corresponding to each function in the target application, the method further includes: acquiring target attribute information of the user of the smart terminal.
  • the obtaining, by the preset server, the first statistic value corresponding to each function includes: acquiring, by using a preset server, a first statistic value corresponding to each function that matches the target attribute information.
  • the attribute information may include, for example, a gender, an age group, a career, an area, and the like.
  • the preset server may collect and calculate the corresponding first statistical value according to the attribute information classification, when the smart When the terminal needs to obtain the first statistic value from the preset server, the preset server may find the corresponding first statistic value according to the target attribute information of the user of the smart terminal sent by the smart terminal, and feed back to the smart terminal, so that the smart terminal is more accurate. Determine the hotspot function.
  • the target application may include multiple, then the at least one first hotspot function in the target application may be determined according to the at least one first statistical value corresponding to the at least one function.
  • the method includes: determining, according to a comprehensive ranking of the first statistical values corresponding to all the functions in the plurality of applications, the first hotspot function corresponding to each application.
  • the target application when detecting that the smart terminal is powered on for the first time, includes all applications loaded in the smart terminal; and the at least one first one corresponding to the at least one function Determining, by a statistic value, the at least one first hotspot function in the target application, comprising: determining, according to a comprehensive ranking of the first statistic values corresponding to all the functions in all the applications, at least one first hotspot corresponding to each application function.
  • FIG. 2 is a schematic flowchart of a compiling optimization method provided by another embodiment, where the method includes the following steps.
  • Step 2010 It is detected that there is an target application that has not been run in the smart terminal.
  • the target application includes at least one function.
  • Step 2020 Obtain target attribute information of a user of the smart terminal.
  • Step 2030 Acquire, from a preset server, a first statistic value corresponding to each function in the target application that matches the target attribute information.
  • Step 2040 Determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function.
  • Step 2050 Compile each first hotspot function into local machine code by means of pre-compilation of the virtual machine.
  • Step 2060 Record, in a second preset statistical period, a second frequency that is executed by each user in the target application during use of the target application by the user of the smart terminal, according to a preset weight coefficient, first The statistic value and the second frequency are subjected to a weighted averaging operation to obtain a second statistic value corresponding to each function.
  • Step 2070 Determine at least one second hotspot function in the target application according to the at least one second statistic value corresponding to the at least one function.
  • Step 2080 When it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function, delete the local machine code corresponding to the first hotspot function that has been compiled, and determine at least one When the second hotspot function in the second hotspot function is not compiled, the uncompiled second hotspot function is compiled into the local machine code by the pre-compilation of the virtual machine.
  • the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation.
  • the hotspot function is compiled into the local machine code by means of pre-compilation of the virtual machine to improve the first-time running efficiency of the application.
  • the usage habit data of the local user is continuously collected, combined with the statistical data of the big data and the usage data of the local user.
  • the hotspot function performs self-feedback adjustment, so that the second hotspot function that fits the user's personal usage habits is compiled into the local machine code, and the local machine code that does not fit the user's usage habit of the smart terminal is cleared, and the user's use requirement is integrated as a whole. Rationally utilize the storage space of the intelligent terminal to optimize the overall performance of the intelligent terminal.
  • FIG. 3 is a schematic flowchart diagram of a compiling optimization method provided by another embodiment.
  • the method may be implemented by a compiler optimization apparatus, where the apparatus may be implemented by software and/or hardware, and may be integrated into a server. As shown in FIG. 3, the method includes the following steps.
  • Step 3010 Collect, in a first preset statistical period, a first frequency that each function in the application is executed by the preset user group during use of the application, and calculate each of the first frequency according to the first frequency.
  • the application includes at least one function.
  • the server may perform statistics on an application published in the application store or in the market.
  • the smart terminal uploads data such as the time and frequency of the user's use of the application to the server.
  • the server performs statistics based on the collected data, and obtains a first statistical value corresponding to each function in each application.
  • a preset data structure is established in the server.
  • the preset data structure may be in the form of a package name -Key-Value.
  • the package name refers to the package name corresponding to the application, which is the identity of the application, and has global uniqueness;
  • the value of the Key can be the class name + execution function name, and the class name and execution function name are generally characters.
  • the string in order to facilitate statistics and calculations, the string can be converted.
  • the hash name (Hash) is used to map the class name + execution function name to a fixed-length value, for example, using a message digest algorithm (Message Digest) Algorithm, MD)
  • MD5 message digest algorithm
  • the fifth version of MD5 encoding converts the class name + execution function name into a form of 8 bytes (Byte); Value can be the frequency information actually used by the function.
  • the cloud server After receiving statistics from a large number of users (when the number of samples of the preset user group is sufficient), the cloud server assigns a weight to each user based on the user's mobile phone usage intensity, and performs a weighted average calculation to obtain a global application. Weight information for each function in each class (ie, the first statistic in this embodiment).
  • Step 3020 Receive an acquisition request of the smart terminal to acquire at least one first statistic value corresponding to at least one function in the application.
  • the smart terminal sends the acquisition request to the server when detecting that the application is not running.
  • Step 3030 Send at least one first statistic value corresponding to the at least one function in the application to the smart terminal.
  • the at least one first statistic value is used to indicate that the smart terminal determines at least one first hotspot function in the application according to the at least one first statistic value, and compiles before running through a virtual machine. The manner of compiling each of the at least one first hotspot function into local machine code.
  • the server collects, for each function in the application, the first frequency that each function of the preset user group is executed during the use of the application program in the first preset statistical period. And calculating, according to the first frequency, the first statistic value corresponding to each function, and when receiving the acquisition request of the at least one first statistic value corresponding to the at least one function in the application by the smart terminal, at least one The first statistic value is sent to the smart terminal to instruct the smart terminal to determine, according to the at least one first statistic value, a hotspot function that needs to be compiled by means of pre-compilation of the virtual machine.
  • the server can calculate the frequency of execution of different functions in the process of using the application by the preset user group by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide
  • the smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
  • FIG. 4 is a schematic flowchart of a compiling optimization method provided by another embodiment, which is described in a scenario in which an intelligent terminal interacts with a preset server, and the method includes the following steps.
  • Step 4010 The server collects, in a first preset statistical period, a first frequency that each function is executed by the preset user group in using different applications, and calculates a corresponding function according to the first frequency that each function is executed. The first statistic.
  • Step 4020 When detecting that there is a target application that has not been run, the smart terminal sends an acquisition request for acquiring a first statistic value corresponding to each function in the target application to the server.
  • Step 4030 The server searches for a first statistic value corresponding to each function in the target application according to the obtaining request, and sends the first statistic value to the smart terminal.
  • Step 4040 The smart terminal determines a first hotspot function in the target application according to the first statistic value, and compiles the first hotspot function into a local machine code by using a pre-compilation manner of the virtual machine.
  • Step 4050 The smart terminal records, in the second preset statistical period, a second frequency that each user of the smart terminal performs during the process of using the target application.
  • Step 4060 The smart terminal determines a second hotspot function in the target application according to the second statistical value, and updates the compilation policy of the target application according to the second hotspot function.
  • FIG. 5 is a signaling diagram of an intelligent terminal interacting with a server according to an embodiment. The foregoing embodiment may be understood by using the signaling diagram.
  • the server performs the historical habit data of the application group by using the preset user group, and forms a big data statistical result to be fed back to the smart terminal, and the smart terminal determines the hotspot function in the non-running application based on the big data statistical result. , pre-compilation of hotspot functions, effectively improve the speed of the application.
  • FIG. 6 is a structural block diagram of a compiler optimization apparatus provided by an embodiment.
  • the apparatus may be implemented by software and/or hardware, and is generally integrated in an intelligent terminal, and may optimize a virtual machine based compilation in a smart terminal by executing a compiler optimization method. Program. As shown in FIG.
  • the device includes: an operation monitoring module 601, configured to detect whether there is an unexecuted target application in the smart terminal, where the target application includes at least one function; the first statistic value obtaining module 602, setting Obtaining, by the preset server, a first statistic value corresponding to each function in the target application, when the target application that is not running is detected in the smart terminal, where the first statistic value includes a statistic value calculated by the first frequency corresponding to the function, where the first frequency includes a frequency at which each function of the preset user group is executed during the use of the target application program in the first preset statistical period; a hotspot function determining module 603, configured to determine at least one first hotspot function in the target application according to the at least one first statistical value corresponding to the at least one function; the compiling module 604 is configured to pass the virtual machine The pre-run compilation method compiles each first hotspot function into native machine code.
  • the compiler optimization apparatus detects that there is an unexecuted target application in the smart terminal, and obtains, for each function in the target application, a first statistic value corresponding to each function from the preset server,
  • the first statistic value includes a value calculated according to a frequency at which each function of the preset user group is executed during the use of the target application program in the first preset statistical period, and then the target application is determined according to the first statistic value.
  • the first hotspot function in the first hotspot function compiles the determined first hotspot function into local machine code by means of pre-compilation of the virtual machine.
  • the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time.
  • the first statistical value corresponding to each function is determined by:
  • the apparatus further includes a second statistic value obtaining module configured to: after the first hotspot function is compiled into the local machine code in the manner of compiling by the virtual machine before running, in the second preset statistic Recording, in a period, a second frequency at which each function in the target application is executed by a user of the smart terminal during use of the target application, according to a preset weight coefficient, the first statistical value, and the Performing a weighted averaging operation on the second frequency to obtain a second statistic value corresponding to each function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, where the first statistic value corresponds to a first preset weight coefficient, the second frequency corresponding to the second preset weight coefficient; a second hotspot function determining module, configured to determine, according to the at least one second statistic value corresponding to the at least one function At least one second hotspot function in the target application; a compiling policy update module configured to apply to the target according to the at least one second hots
  • the compiling strategy update module is configured to: when determining that the second hotspot function in the at least one second hotspot function is not compiled, the method of compiling before running through the virtual machine is not compiled.
  • the second hotspot function is compiled into local machine code; and/or, when it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function, deleting the already The local machine code corresponding to the first hotspot function being compiled.
  • the first hotspot function determining module 603 is configured to determine at least one first hotspot function in the target application according to at least one first statistic value corresponding to the at least one function. And determining whether the first statistic value corresponding to each function reaches a first preset statistic threshold, and if so, determining each function as a first hotspot function in the target application.
  • the apparatus further includes an attribute information acquiring module, configured to acquire a user of the smart terminal before acquiring the first statistic value corresponding to each function in the target application from the preset server
  • the first statistic value obtaining module 602 is configured to acquire, by using a preset server, a first statistic value corresponding to each function in the target application program: obtaining and locating from a preset server The first statistical value corresponding to each function in the target application that matches the target attribute information.
  • the target application when detecting that the smart terminal is powered on for the first time, includes all applications loaded in the smart terminal; the first hotspot function determining module 603 is configured to be configured according to the following manner
  • the at least one first statistic value corresponding to the at least one function determines at least one first hotspot function in the target application: determining, according to a comprehensive ranking of the first statistic values respectively corresponding to all functions in all applications At least one first hotspot function corresponding to each application.
  • FIG. 7 is a structural block diagram of a compiler optimization apparatus provided by another embodiment, which may be implemented by software and/or hardware, generally integrated in a server, and may optimize a virtual machine based compilation in a smart terminal by executing a compiler optimization method.
  • Program As shown in FIG. 7, the apparatus includes: a statistical value calculation module 701, configured to collect, during a first preset statistical period, a first user group in which the function is executed in the application process during use of the application program a frequency, calculating a first statistic value corresponding to each function according to the first frequency, the application program includes at least one function, and an acquisition request receiving module 702 is configured to receive the smart terminal to obtain the application program.
  • a statistical value calculation module 701 configured to collect, during a first preset statistical period, a first user group in which the function is executed in the application process during use of the application program a frequency, calculating a first statistic value corresponding to each function according to the first frequency
  • the application program includes at least one function
  • an acquisition request receiving module 702 is
  • An acquisition request of at least one first statistic value corresponding to the at least one function wherein the smart terminal sends the acquisition request to the server when detecting that the application is not running; the statistic value sending module 703, configured to: when the smart terminal acquires an acquisition request of the at least one first statistic value corresponding to the at least one function in the application, the at least one function in the application Transmitting at least one first statistic value of the one-to-one correspondence to the smart terminal, where the at least one first statistic value is used to indicate that the smart terminal is configured according to the The at least one first statistical value determines at least one first hotspot function in the application, and each first hotspot function is compiled into local machine code by way of pre-compilation of the virtual machine.
  • the server collects, for each function in the application, the first frequency that each function of the preset user group is executed during the use of the application program in a first preset statistical period, Calculating, according to the first frequency, the first statistic value corresponding to each function, and when receiving the acquisition request of the at least one first statistic value corresponding to the at least one function in the application, A first statistic value is sent to the smart terminal to instruct the smart terminal to determine, according to the first statistic value, a hotspot function that needs to be compiled by means of pre-compilation of the virtual machine.
  • the server can calculate the frequency of execution of different functions in the process of using the application by the preset user group by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide
  • the smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
  • the embodiment further provides a storage medium containing computer executable instructions for executing a compilation optimization method when executed by a computer processor, the method comprising: detecting that there is an unrun in the smart terminal a target application, wherein the target application includes at least one function; acquiring, from a preset server, a first statistic value corresponding to each function in the target application, the first statistic value including corresponding to each function
  • the first frequency calculates a statistical value, where the first frequency includes a frequency at which each function of the preset user group is executed during use of the target application in the first preset statistical period; At least one first statistic value corresponding to a function one-to-one determines at least one first hotspot function in the target application; each first hotspot function is compiled into local machine code by way of pre-compilation of the virtual machine.
  • Storage medium any type of storage device or storage device.
  • the term "storage medium” is intended to include: a mounting medium such as a Compact Disc Read-Only Memory (CD-ROM), a floppy disk or a tape device; a computer system memory or a random access memory such as a dynamic random Dynamic Random Access Memory (DRAM), Double Data Rate Random Access Memory (DDRRAM), Static Random Access Memory (SRAM), and extended data output random storage Extended Data Output Random Access Memory (EDORAM), Rambus Random Access Memory (RAM), etc.; non-volatile memory such as flash memory, magnetic media (such as hard disk or optical storage) Register or other similar type of memory element, etc.
  • the storage medium may also include other types of memory or a combination thereof.
  • the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system, the second computer system being coupled to the first computer system via a network, such as the Internet.
  • the second computer system can provide program instructions to the first computer for execution.
  • the term "storage medium" can include two or more storage media that can reside in different locations (eg, in different computer systems connected through a network).
  • a storage medium may store program instructions (eg, program instructions are a computer program) executable by one or more processors.
  • the storage medium containing the computer executable instructions provided by the embodiment, the computer executable instructions are not limited to the compiler optimization operation as described above, and may also execute the compiler optimization method provided by any embodiment of the present disclosure corresponding to the smart terminal. Related operations in .
  • the embodiment further provides another storage medium containing computer executable instructions for executing a compilation optimization method when executed by a computer processor, the method comprising: collecting during a first predetermined statistical period Presetting a first frequency that each function in the application is executed during a process of using an application, and calculating, according to the first frequency, a first statistic corresponding to each function, the application Including at least one function; receiving, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to at least one function in the application, wherein the smart terminal detects that the application is not running, Sending the acquisition request to the server; sending at least one first statistic value corresponding to the at least one function in the application to the smart terminal, where the at least one first statistic value is used to indicate Determining, by the smart terminal, at least one first hotspot function in the application according to the at least one first statistic value Before running the virtual machine compiler of the first embodiment each function of the local hotspot compiled machine code.
  • FIG. 8 is a schematic structural diagram of an intelligent terminal according to an embodiment.
  • the smart terminal 800 can include a memory 801, a processor 802, and a computer program stored on the memory 801 and executable by the processor 802, the processor 802 executing the computer program to implement a corresponding implementation as described in an embodiment of the present disclosure. Compilation optimization method for intelligent terminals.
  • the smart terminal provided in this embodiment can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time.
  • FIG. 9 is a schematic structural diagram of another smart terminal provided by another embodiment.
  • the smart terminal 900 may include: a casing (not shown in FIG. 9), a memory 901, and a central processing unit (CPU) 902. (also referred to as a processor, hereinafter referred to as CPU), a circuit board (not shown in FIG. 9), and a power supply circuit (not shown in FIG. 9).
  • CPU central processing unit
  • the circuit board is disposed inside a space enclosed by the casing; the CPU 902 and the memory 901 are disposed on the circuit board; and the power circuit is configured to be at least one circuit or device of the smart terminal
  • the memory 901 is configured to store executable program code; the CPU 902 runs a computer program corresponding to the executable program code by reading executable program code stored in the memory 901 to implement the following steps Detecting that there is an unexecuted target application in the smart terminal, wherein the target application includes at least one function; acquiring, from the preset server, a first statistic value corresponding to each function in the target application, the a statistic value includes a statistic value calculated according to the first frequency corresponding to each function, where the first frequency includes a preset user group in the first preset statistic period, in the process of using the target application Frequency at which a function is executed; determining the target application based on at least one first statistic value corresponding to the at least one function At least one first hot function; by way of the front of the virtual machine running the compiler
  • the smart terminal further includes: a peripheral interface 903, a radio frequency (RF) circuit 905, an audio circuit 906, a speaker 911, a power management chip 908, an input/output (I/O) subsystem 909, and other inputs/controls.
  • RF radio frequency
  • I/O input/output
  • Device 910, touch screen 912, other input/control devices 910, and external port 904, these components communicate over one or more communication buses or signal lines 907.
  • the smart terminal 900 illustrated in FIG. 9 is merely one example of a smart terminal, and the smart terminal 900 may have more or fewer components than those illustrated in FIG. 9, and two or more components may be combined, Or it can have different component configurations.
  • the various components shown in Figure 9 can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the smart terminal for optimizing virtual machine compilation provided by the embodiment is described below.
  • the smart terminal takes a mobile phone as an example.
  • the memory 901 can be accessed by the CPU 902 and the peripheral interface 903, etc., and the memory 901 can include a high speed random access memory, and can also include a nonvolatile memory such as one or more magnetic disk storage devices, flash memory devices. Or other volatile solid-state storage devices.
  • a nonvolatile memory such as one or more magnetic disk storage devices, flash memory devices. Or other volatile solid-state storage devices.
  • a peripheral interface 903 that can connect the input and output peripherals of the device to the CPU 902 and the memory 901.
  • the I/O subsystem 909 can connect input and output peripherals on the device, such as touch screen 912 and other input/control devices 910, to peripheral interface 903.
  • the I/O subsystem 909 can include a display controller 9091 and one or more input controllers 9092 that are configured to control other input/control devices 910.
  • one or more input controllers 9092 receive electrical signals from other input/control devices 910 or transmit electrical signals to other input/control devices 910, and other input/control devices 910 may include physical buttons (pressing buttons and rocker buttons, etc.) ), dial, slide switch, joystick, and click wheel.
  • the input controller 9092 can be connected to any one of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
  • the touch screen 912 is an input interface and an output interface between the user intelligent terminal and the user, and displays the visual output to the user.
  • the visual output may include graphics, text, icons, videos, and the like.
  • Display controller 9091 in I/O subsystem 909 receives an electrical signal from touch screen 912 or an electrical signal to touch screen 912.
  • the touch screen 912 detects the contact on the touch screen 912, and the display controller 9091 converts the detected contact into an interaction with the user interface object displayed on the touch screen 912, that is, realizes human-computer interaction, and the user interface object displayed on the touch screen 912 may be Run the game's icons or icons that are networked to the appropriate network.
  • the device may further include a light mouse, which is a touch sensitive surface that does not display a visual output, or an extension of a touch sensitive surface formed by the touch screen.
  • the RF circuit 905 is mainly configured to establish communication between the mobile phone and the wireless network (ie, the network side), and implement data reception and transmission between the mobile phone and the wireless network. For example, sending and receiving short messages and emails.
  • RF circuit 905 receives and transmits an RF signal, also referred to as an electromagnetic signal, and RF circuit 905 converts the electrical signal into an electromagnetic signal or converts the electromagnetic signal into an electrical signal, and through the electromagnetic signal and communication network And other devices to communicate.
  • RF circuitry 905 may include known circuitry for performing these functions, including but not limited to an antenna system, an RF transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, Coder-CODEter (CODEC) chipset and Subscriber Identity Module (SIM) and so on.
  • CDDEC Coder-CODEter
  • SIM Subscriber Identity Module
  • the audio circuit 906 is primarily configured to receive audio data from the peripheral interface 903, convert the audio data into an electrical signal, and transmit the electrical signal to the speaker 911.
  • the speaker 911 is arranged to restore the voice signal received by the mobile phone from the wireless network through the RF circuit 905 to sound and play the sound to the user.
  • the power management chip 908 is configured to provide power and power management for the hardware connected to the CPU 902, the I/O subsystem, and the peripheral interface.
  • FIG. 10 is a schematic structural diagram of a server according to another embodiment.
  • the server 1000 may include a memory 1001, a computer program stored on the memory 1001 and operable on the processor 1002, and the processor 1002 executing the computer program to implement a corresponding server as described in the embodiment of the present disclosure. Compilation optimization method.
  • the server provided in this embodiment can calculate the frequency of execution of different functions of the preset user group in the process of using the application program by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide
  • the smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
  • the compiler optimization device, the storage medium, the smart terminal and the server provided in the above embodiments can execute the compiler optimization method provided by the corresponding embodiment of the present disclosure, and have the corresponding functional modules and beneficial effects of the execution method.
  • the compiler optimization method provided by the related embodiments of the present disclosure can execute the compiler optimization method provided by the related embodiments of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

A compilation optimization method and device, a storage medium, an intelligent terminal and a server. The method comprises: detecting a target application program which has not been run and which is present in an intelligent terminal, the target application program comprising at least one function; acquiring from a preset server first statistical values corresponding to each function of the target application program, the first statistical values comprising statistical values calculated according to a first frequency corresponding to each function, and the first frequency comprising the frequency of each function executed by a preset user group in the process of using the target application program within a first preset statistical period; determining at least one first hotspot function in the target application program according to at least one first statistical value corresponding one-to-one with at least one function; and compiling each first hotspot function into a local machine code by means of a virtual machine running a pre-compilation mode.

Description

编译优化方法、装置、存储介质、智能终端及服务器Compilation optimization method, device, storage medium, intelligent terminal and server
本申请要求在2017年12月14日提交中国专利局、申请号为201711341481.2的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。The present application claims the priority of the Chinese Patent Application No. PCT Application No.
技术领域Technical field
本公开涉及计算机技术领域,例如涉及编译优化方法、装置、存储介质、智能终端及服务器。The present disclosure relates to the field of computer technology, for example, to compiler optimization methods, apparatus, storage media, smart terminals, and servers.
背景技术Background technique
随着智能终端技术的快速发展,诸如智能手机、平板电脑以及智能电视等智能设备已成为人们生活中必不可少的电子设备。With the rapid development of smart terminal technology, smart devices such as smart phones, tablets and smart TVs have become indispensable electronic devices in people's lives.
智能终端中普遍安装有操作系统,安卓(Android)操作系统是最常见的智能操作系统之一,已经得到了广泛的使用。智能终端中通常包括底层和应用层,并采用不同的语言进行编写,需要通过虚拟机进行编译后才能够使应用程序在智能终端中正常运行。以Android操作系统为例,底层(如Linux内核层)一般由C/C++语言编写,而应用层一般由Java语言编写,而基于Java的程序需要在虚拟机上运行。虚拟机(Virtual Machine,VM)负责将基于Java开发的应用程序对应的文件或代码解释或编译成本地可执行的文件或代码,使得应用程序得以运行。然而,在解释或编译的过程中,通常需要消耗较多的时间,影响运行速度,因此,基于虚拟机的编译方案仍需要改进。An operating system is commonly installed in intelligent terminals, and Android (Android) operating system is one of the most common intelligent operating systems, and has been widely used. The intelligent terminal usually includes the underlying layer and the application layer, and is written in different languages, and needs to be compiled by the virtual machine to enable the application to run normally in the smart terminal. Taking the Android operating system as an example, the underlying layer (such as the Linux kernel layer) is generally written in the C/C++ language, while the application layer is generally written in the Java language, and the Java-based program needs to run on the virtual machine. A virtual machine (VM) is responsible for interpreting or compiling a file or code corresponding to a Java-developed application to an executable file or code to enable the application to run. However, in the process of interpretation or compilation, it usually takes more time and affects the running speed. Therefore, the virtual machine-based compilation scheme still needs improvement.
发明内容Summary of the invention
本公开提供一种编译优化方法、装置、存储介质及智能终端,可以优化智能终端中基于虚拟机的编译方案。The present disclosure provides a compiler optimization method, apparatus, storage medium, and intelligent terminal, which can optimize a virtual machine based compilation scheme in an intelligent terminal.
本公开提供了一种编译优化方法,应用于智能终端,包括:The present disclosure provides a compiler optimization method applied to a smart terminal, including:
检测到智能终端中存在未运行过的目标应用程序;其中,目标应用程序包括至少一个函数;Detecting that there is an unoperated target application in the smart terminal; wherein the target application includes at least one function;
从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;And acquiring, by the preset server, a first statistic value corresponding to each function in the target application, where the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, the first The frequency includes a frequency at which each function described by the preset user group is executed during use of the target application during the first preset statistical period;
根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;Determining at least one first hotspot function in the target application according to the at least one first statistical value corresponding to the at least one function;
通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Each first hotspot function is compiled into native machine code by pre-compilation of the virtual machine.
本公开提供了一种编译优化方法,应用于服务器,包括:The present disclosure provides a compilation optimization method applied to a server, including:
在第一预设统计周期内收集预设用户群体在使用应用程序过程中应用程序中的每个函数被执行的第一频次,根据所述每个函数被执行的第一频次计算出所述每个函数对应的第一统计值;Collecting, in a first preset statistical period, a first frequency that each function in the application is executed by the preset user group during use of the application, and calculating the each frequency according to the first frequency that each function is executed The first statistical value corresponding to the function;
接收到智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到应用程序未运行过时,向所述服务器发送所述获取请求;Receiving, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to the at least one function in the application, wherein the smart terminal sends the server to the server when detecting that the application is not running The obtaining request;
将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译 为本地机器代码。Sending, to the smart terminal, at least one first statistic value corresponding to the at least one function in the application, the at least one first statistic value is used to indicate that the smart terminal is configured according to the at least one A statistic determines at least one first hotspot function in the application and compiles each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
本公开提供了一种编译优化装置,配置于智能终端中,包括:The present disclosure provides a compiler optimization device, which is configured in a smart terminal, and includes:
运行监测模块,设置为检测智能终端中是否存在未运行过的目标应用程序;其中,所述目标应用程序包括至少一个函数;Running a monitoring module, configured to detect whether there is an unoperated target application in the smart terminal; wherein the target application includes at least one function;
统计值获取模块,设置为在检测到智能终端中存在未运行过的目标应用程序时,从预设服务器获取所述目标应用程序中的函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;The statistic value obtaining module is configured to: when detecting that the target application that is not running exists in the smart terminal, obtain a first statistic value corresponding to the function in the target application from the preset server, where the first statistic value includes And calculating, according to the first frequency corresponding to each function, the first frequency includes: in the first preset statistical period, the preset user group is executed during the use of the target application. Frequency
热点函数确定模块,设置为根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;The hotspot function determining module is configured to determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function;
编译模块,设置为通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Compile the module, set to compile each first hotspot function to native machine code by compiling the virtual machine before it runs.
本公开提供了一种编译优化装置,配置于服务器中,包括:The present disclosure provides a compiler optimization apparatus configured in a server, including:
统计值计算模块,设置为在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述应用程序中的每个函数被执行的第一频次,根据所述每个函数被执行的第一频次计算出所述每个函数对应的第一统计值;其中,所述应用程序包括至少一个函数;The statistic value calculation module is configured to collect, during the first preset statistic period, a first frequency that the preset user group is executed during the use of the application, and each function is executed according to each function The first frequency calculates a first statistical value corresponding to each function; wherein the application includes at least one function;
获取请求接收模块,设置为接收智能终端获取应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求;Obtaining a request receiving module, configured to receive, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to the at least one function in the application, wherein the smart terminal detects that the application is not running out of time Sending the acquisition request to the server;
统计值发送模块,设置为在接收到所述智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求时,将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。And a statistical value sending module, configured to: when the smart terminal acquires an acquisition request of the at least one first statistic value corresponding to the at least one function in the application, Transmitting at least one first statistic value corresponding to a function to the smart terminal, the at least one first statistic value is used to indicate that the smart terminal determines the application according to the at least one first statistic value At least one first hotspot function, and compiling each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
本公开提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该程序被处理器执行时实现如本公开实施例所述的编译优化方法。The present disclosure provides a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements a compilation optimization method as described in embodiments of the present disclosure.
本公开提供了一种智能终端,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如本公开实施例所述的编译优化方法。The present disclosure provides a smart terminal including a memory, a processor, and a computer program stored on the memory and executable by the processor, the processor executing the computer program to implement compilation optimization as described in the embodiments of the present disclosure method.
本公开提供的编译优化方案使得智能终端可以在首次运行应用程序前,从预设服务器获取针对应用程序中多个函数的大数据统计情况,并根据统计情况确定需要进行预编译的热点函数,进而通过虚拟机运行前编译的方式将热点函数编译为本地机器代码,提升应用程序首次运行效率。The compiling optimization scheme provided by the present disclosure enables the smart terminal to obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hotspot function that needs to be pre-compiled according to the statistical situation, and then Compile the hotspot function into local machine code by compiling the virtual machine before running, which improves the efficiency of the application for the first time.
本公开提供的编译优化方案,使得服务器能够通过大数据方式统计出预设用户群体在使用应用程序过程中不同函数的执行频次情况,进而计算出第一统计值,将第一统计值发送给智能终端,指导智能终端在首次运行应用程序前对热点函数进行预编译,提升应用程序首次运行效率。The compiler optimization solution provided by the disclosure enables the server to calculate the frequency of execution of different functions of the preset user group in the process of using the application by using the big data method, thereby calculating the first statistic value, and sending the first statistic value to the smart The terminal instructs the smart terminal to pre-compile the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
附图说明DRAWINGS
图1为一实施例提供的一种编译优化方法的流程示意图;1 is a schematic flow chart of a compiling optimization method provided by an embodiment;
图2为另一实施例提供的一种编译优化方法的流程示意图;2 is a schematic flowchart of a compiling optimization method provided by another embodiment;
图3为另一实施例提供的一种编译优化方法的流程示意图;3 is a schematic flowchart of a compiling optimization method provided by another embodiment;
图4为另一实施例提供的一种编译优化方法的流程示意图;4 is a schematic flowchart of a compiling optimization method provided by another embodiment;
图5为一实施例提供的一种智能终端与服务器进行交互的信令图;FIG. 5 is a signaling diagram of an intelligent terminal interacting with a server according to an embodiment;
图6为一实施例提供的一种编译优化装置的结构框图;6 is a structural block diagram of a compiler optimization apparatus according to an embodiment;
图7为另一实施例提供的一种编译优化装置的结构框图;FIG. 7 is a structural block diagram of a compiler optimization apparatus according to another embodiment;
图8为一实施例提供的一种智能终端的结构示意图;FIG. 8 is a schematic structural diagram of an intelligent terminal according to an embodiment; FIG.
图9为另一实施例提供的一种智能终端的结构示意图;FIG. 9 is a schematic structural diagram of an intelligent terminal according to another embodiment;
图10为一实施例提供的一种服务器的结构示意图。FIG. 10 is a schematic structural diagram of a server according to an embodiment.
具体实施方式Detailed ways
下面结合附图并通过具体实施方式来说明本公开的技术方案。此处所描述的具体实施例仅仅用于解释本公开,而非对本公开的限定。另外,为了便于描述,附图中仅示出了与本公开相关的部分而非全部结构。The technical solutions of the present disclosure will be described below with reference to the accompanying drawings and specific embodiments. The specific embodiments described herein are merely illustrative of the disclosure and are not intended to be limiting. In addition, for the convenience of description, only some but not all of the structures related to the present disclosure are shown in the drawings.
为了更好地理解本公开的技术方案,以Android操作系统为例,对Android操作系统常见的两种虚拟机Dalvik虚拟机(Dalvik Virtual Machine,DVM)以及ART(Android Runtime)虚拟机进行简单的介绍。In order to better understand the technical solution of the present disclosure, the Android operating system is taken as an example to introduce a simple introduction of two virtual machine Dalvik virtual machines (DVM) and ART (Android Runtime) virtual machines. .
Dalvik是谷歌(Google)公司设计开发的用于Android平台的虚拟机,它是Android平台的重要组成部分,支持dex(Dalvik Executable)格式的Java应用程序的运行。dex格式是专门为Dalvik设计的一种压缩格式,Java程序中,Java类会被编译成一个或多个class文件,然后通过DEX工具将class文件转换成dex文件,Dalvik虚拟机再从中读取指令和数据。Dalvik虚拟机是解释执行机制,负责解释dex文件为机器码,在每次运行时刻对dex文件中Java字节码给予解析运行,但缺点是性能不佳,运行速度慢。随着Android版本的不断升级,基于Dalvik虚拟机出现了即时编译技术(Just In Time Compiler,JIT),当应用程序运行时,每当遇到一个新类,JIT编译器就会对这个类进行编译,经过编译后的代码,会被优化成原生型指令码(native code),这样在下次执行到相同逻辑(又称方法或函数)的时候,速度就会变快,但是,使用JIT也不一定加快执行速度,如果大部分代码的执行次数很少,那么编译花费的时间不一定少于执行dex的时间,另外dex字节码翻译成本地机器码是发生在应用程序(Application,APP)的运行过程中的,并且应用程序每一次重新运行的时候,都要做重做这个翻译工作,也即每次重新打开App,都需要JIT编译。Dalvik is a virtual machine designed and developed by Google for the Android platform. It is an important part of the Android platform and supports the running of Java applications in the dex (Dalvik Executable) format. The dex format is a compression format specially designed for Dalvik. In Java programs, Java classes are compiled into one or more class files, and then the class files are converted to dex files by the DEX tool, and the Dalvik virtual machine reads commands from them. And data. The Dalvik virtual machine is an interpretation execution mechanism that is responsible for interpreting the dex file as a machine code. The Java bytecode is parsed and run in the dex file at each run time, but the disadvantage is poor performance and slow operation. As the Android version continues to upgrade, the Dalvik virtual machine has a Just In Time Compiler (JIT). When the application runs, whenever a new class is encountered, the JIT compiler will compile the class. The compiled code will be optimized to the native code so that the next time it reaches the same logic (also called a method or function), the speed will be faster, but using JIT is not necessarily the case. Speed up execution, if most of the code is executed a small number of times, then the compilation time is not necessarily less than the time to execute dex, and the dex bytecode translation cost machine code is the operation of the application (Application, APP) Every time the application is re-run, the translation work needs to be redone, that is, every time the application is reopened, JIT compilation is required.
ART虚拟机采用运行前编译(Ahead of Time,AOT,又称提前编译或预编译)方式,在第一次开机时将所有应用(之后是安装某个应用时针对该应用)预先编译成本地可执行文件(又称本地机器码或本地机器代码),之后应用程序启动时,不需要额外的翻译工作,直接使用本地机器码运行,从而加快运行效率,但缺点是第一次开机等待时间过长,可能达到十分钟,从而带来的用户体验不好,另外需要的存储空间也有一定开销。The ART virtual machine adopts Ahead of Time (AOT), which is also called pre-compilation or pre-compilation. It is pre-compiled for all applications (after installing an application for the first time). Execution file (also known as local machine code or local machine code), after the application starts, no additional translation work is required, and the local machine code is used directly to speed up the operation, but the disadvantage is that the first boot time is too long. It may take up to ten minutes, resulting in a bad user experience and a certain amount of storage space.
本公开中,对于Android操作系统可采用ART虚拟机、JIT以及解释执行相结合的机制来优化虚拟机的编译方案,可以提升智能终端中应用程序的运行效率。例如,取消第一次开机时将所有应用程序全部进行编译的流程,改成基于智能终端用户的使用习惯对高频访问或执行的函数(又称执行热点或热点函数)择机编译,能够达到越用越快的效果,然而在得到足够量的本机统计数据前,智能终端中的应用程序仍需要以解释执行的方式运行,速度较慢,因此针对统计数据不足的情况,提出了基于大数据统计结果确定热点函数的方案,下面结合具体实施方式进行说明。In the present disclosure, for the Android operating system, a combination of the ART virtual machine, the JIT, and the explanation execution can be used to optimize the compilation scheme of the virtual machine, and the operation efficiency of the application in the smart terminal can be improved. For example, cancel the process of compiling all applications when booting for the first time, and change to a function based on the usage habit of the intelligent terminal user for high-frequency access or execution (also called execution hotspot or hotspot function). The faster the effect is, however, before the sufficient amount of local statistical data is obtained, the application in the intelligent terminal still needs to run in an interpreted and executed manner, and the speed is slow. Therefore, based on the insufficient statistical data, a big data based method is proposed. The statistical result determines the scheme of the hotspot function, which will be described below in conjunction with the specific embodiments.
图1为一实施例提供的一种编译优化方法的流程示意图,该方法可以由编译优化装置执行,该装置可由软件和/或硬件实现,一般可集成在智能终端中。如图1所示,该方法包括如下步骤。FIG. 1 is a schematic flowchart of a compiling optimization method provided by an embodiment. The method may be implemented by a compiler optimization apparatus. The apparatus may be implemented by software and/or hardware, and may be integrated into an intelligent terminal. As shown in FIG. 1, the method includes the following steps.
步骤1010、检测到智能终端中存在未运行过的目标应用程序。Step 1010: It is detected that there is an target application that is not running in the smart terminal.
在一实施例中,本实施例中的智能终端可包括智能手机、平板电脑、媒体播放器以及智能家电等安装有操作系统的智能设备。本实施例中对操作系统的类型不做限定,可以是Android操作系统,iOS操作系统以及窗口(Windows)操作系统等,为了便于说明,将以Android操作系统为例进行说明。In an embodiment, the smart terminal in this embodiment may include a smart device installed with an operating system, such as a smart phone, a tablet computer, a media player, and a smart home appliance. The type of the operating system is not limited in this embodiment, and may be an Android operating system, an iOS operating system, and a Windows (Windows) operating system. For convenience of description, the Android operating system will be taken as an example for description.
本实施例中,未运行过的目标应用程序可包括已经在智能终端中安装完毕但未运行过的应用程序,还可包括安装过程中的应用程序。本步骤中检测智能终端中是否存在未运行过的目标应用程序的时机可以包括:智能终端开机时,检测到应用程序安装完毕时,检测到应用程序安装文件下载事件被触发或下载完毕时,以及检测到用户触发未运行程序检测事件时(如用户开启应用程序首次运行加速开关)等。In this embodiment, the target application that has not been run may include an application that has been installed in the smart terminal but has not been run, and may also include an application during the installation process. The detecting the presence or absence of the target application that has not been run in the smart terminal may include: when the smart terminal is powered on, detecting that the application installation file download event is triggered or downloaded after detecting the installation of the application, and When it is detected that the user triggers the program detection event not running (such as the user starts the application to run the acceleration switch for the first time).
步骤1020、从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值。Step 1020: Acquire a first statistic value corresponding to each function in the target application from a preset server.
本实施例中,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次。In this embodiment, the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, where the first frequency includes the preset user group in the first preset statistic period, The frequency at which each function described in the target application process is executed.
在一实施例中,计算第一统计值以及收集用于计算第一统计值的相关数据的相关步骤可由预设服务器来完成。第一预设统计周期可根据智能终端的特性或用户使用需求等情况来确定,本公开不做限定。例如智能终端为智能手机,多数用户几乎每天都会长时间使用,第一预设统计周期可设置得短一些,如一周。In an embodiment, the step of calculating the first statistical value and collecting relevant data for calculating the first statistical value may be performed by a preset server. The first preset statistical period may be determined according to the characteristics of the smart terminal or the user's use requirements, etc., and the disclosure is not limited. For example, the smart terminal is a smart phone, and most users use it for a long time almost every day. The first preset statistical period can be set shorter, such as one week.
在一实施例中,预设用户群体可包括所有使用过目标应用程序的智能终端用户,也可以选择部分用户作为样本组成预设用户群体,如事先同意数据收集条款的2万名用户。预设用户群体还可以是具备相同用户属性的群体,例如女性用户群体,指定年龄段(如20到30岁)的用户群体等。本公开对用户群体采集对象不做限定,可根据实际需求进行选取。In an embodiment, the preset user group may include all smart terminal users who have used the target application, or may select some users as a sample to form a preset user group, such as 20,000 users who agree to the data collection terms in advance. The preset user group may also be a group having the same user attribute, such as a female user group, a user group of a specified age group (such as 20 to 30 years old), and the like. The disclosure does not limit the collection objects of the user group, and can be selected according to actual needs.
在一实施例中,预设用户群体在使用目标应用程序时实际使用的智能终端的类型可以相同也可以不同,可以由不同智能终端中的同一款应用程序的差异性来确定。以微信为例,若手机版微信和平板版微信中包含的函数差别较大,对于智能手机来说,可仅收集预设用户群体通过智能手机使用微信时的使用数据;若手机版微信和平板版微信中包含的函数基本相同或完全相同,对于智能手机来说,也可同时收集预设用户群体通过智能手机和平板电脑使用微信时的使用数据。In an embodiment, the types of smart terminals actually used by the preset user group when using the target application may be the same or different, and may be determined by the difference of the same application in different smart terminals. Take WeChat as an example. If the functions included in the mobile version of WeChat and the tablet version of WeChat are quite different, for smartphones, only the usage data of the default user group when using WeChat through the smartphone can be collected; if the mobile version is WeChat and tablet The functions included in WeChat are basically the same or identical. For smartphones, the usage data of the default user group when using WeChat through smartphones and tablets can also be collected.
在一个应用程序中,通常会包含一个或多个类,每个类中又包括一个或多个函数(又称方法),不同的函数一般对应不同的功能,在应用程序运行的过程中,由于用户使用习惯的不同,不同功能被使用的频率也不同。以微信为例,聊天功能和朋友圈功能比较常用,对应的函数被执行(或调用)的频率较高,重要程度高,而收藏功能或卡包功能对于很多用户来说可能并不经常使用,那么对应的函数被执行的频率就会比较低,重要程度低。本公开中,收集第一预设统计周期内预设用户群体在使用一个应用程序的过程中多个函数分别被执行的频次,进而计算出每个函数对应的统计值,该统计值可反映出对应的函数被使用的频繁程度以及重要程度,进而有利于智能终端确定热点函数,用于执行预编译相关操作。本实施例中,第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,第一统计值的计算方式本公开不做限定,例如,可以是取多个第一频次中的最高值,可以是计算多个第一频次的平均值或加权平均值等。In an application, usually one or more classes are included. Each class includes one or more functions (also called methods). Different functions generally correspond to different functions. During the running of the application, The frequency of use of different functions is different depending on the user's usage habits. Taking WeChat as an example, the chat function and the circle of friends are more common. The corresponding function is executed (or called) at a higher frequency and is more important, and the collection function or card package function may not be used frequently for many users. Then the corresponding function will be executed at a lower frequency and less important. In the present disclosure, the frequency at which multiple functions are executed by the preset user group in the process of using an application in the first preset statistical period is collected, and then the statistical value corresponding to each function is calculated, and the statistical value may reflect The frequency and importance of the corresponding function is used to facilitate the intelligent terminal to determine the hotspot function for performing precompilation related operations. In this embodiment, the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, and the method for calculating the first statistic value is not limited in the disclosure, for example, multiple first frequencies may be taken. The highest value in the middle may be an average value or a weighted average of a plurality of first frequencies, and the like.
步骤1030、根据至少一个函数一一对应的至少一个第一统计值确定目标应用程序中的至少一个第一热点函数。Step 1030: Determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function.
本实施例中,由于通过虚拟机运行前编译的方式将函数编译为本地机器代码后,本地机器代码会占用智能终端中一定的存储空间,因此需要有选择性地确定热点函数进行编译。本实施例中,可选取所对应的第一统计值较高的函数作为第一热点函数。例如,目标应用程序中共有函数A个,按照第一统计值由高到低排序,可选取前bA个函数作为第一热点函数,b为小于1的系数,bA可向上或向下取整,b的数值可自由设定,也可根据智能终端当前的剩余存储空间确定;又如,还可选取前B(B小于或等于A)个函数作为第一热点函数,B可以是固定数值,或根据智能终端当前的剩余存储空间动态确定的数值;再如,可预先设置一个统计阈值,可记为第一预设统计阈值,将所对应的第一统计值达到第一预设统计阈值的函数确定为目标应用程序中的第一热点函数,这样设置的好处在于,确保使用频率较高的函数被预编译,若应用程序中仅有少量满足要求的函数,说明该应用程序本身被使用的频率就不高,那么不会预编译不满足要求的函数,以为其他应用程序的热点函数节省存储空间。In this embodiment, since the function is compiled into the local machine code by the pre-compilation mode of the virtual machine, the local machine code occupies a certain storage space in the intelligent terminal, so it is necessary to selectively determine the hotspot function for compiling. In this embodiment, a corresponding function with a higher first statistical value may be selected as the first hotspot function. For example, there are a total of A functions in the target application, sorted from high to low according to the first statistical value, and the first bA functions can be selected as the first hotspot function, b is a coefficient smaller than 1, and bA can be rounded up or down. The value of b can be freely set, or can be determined according to the current remaining storage space of the smart terminal; for example, the front B (B is less than or equal to A) functions can be selected as the first hotspot function, and B can be a fixed value, or The value determined dynamically according to the current remaining storage space of the smart terminal; for example, a statistical threshold may be preset, which may be recorded as a first preset statistical threshold, and the corresponding first statistical value reaches a function of the first preset statistical threshold. Determined as the first hotspot function in the target application, the advantage of this setting is to ensure that the more frequently used functions are precompiled. If there are only a few functions in the application that satisfy the requirements, the frequency of the application itself is used. It is not high, so you will not precompile functions that do not meet the requirements, in order to save storage space for hotspot functions of other applications.
步骤1040、通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Step 1040: Compile each first hotspot function into local machine code by means of pre-compilation of the virtual machine.
本实施例中,在确定了第一热点函数后,通过虚拟机运行前编译的方式将第一热点函数编译为本地机器代码,当目标应用程序首次启动时,需要执行第一热点函数时,可直接使用对应的本地机器代码,而不需要以解释执行或及时编译的方式进行编译,可有效提高目标应用程序的首次运行效率。第一热点函数的编译过程可由智能终端操作系统中采用的虚拟机来确定,本实施例不做限定。可以在目标应用程序安装完毕,首次运行前进行编译,也可以在目标应用程序的安装过程中进行编译。在一实施例中,对于目标应用程序中未被确定为第一热点函数的其他函数,在目标应用程序运行过程中,如果需要执行这些其他函数,可以解释执行的方式进行编译,不会影响目标应用程序的运行。In this embodiment, after the first hotspot function is determined, the first hotspot function is compiled into the local machine code by the pre-compilation of the virtual machine, and when the target application is first started, when the first hotspot function needs to be executed, Direct use of the corresponding local machine code, without the need to interpret execution or compile in a timely manner, can effectively improve the efficiency of the first application of the target application. The compiling process of the first hotspot function may be determined by a virtual machine used in the operating system of the smart terminal, which is not limited in this embodiment. It can be compiled after the target application is installed, before the first run, or during the installation of the target application. In an embodiment, for other functions in the target application that are not determined as the first hotspot function, if the other functions need to be executed during the running of the target application, the execution may be interpreted in a manner that does not affect the target. The application is running.
本实施例中提供的编译优化方法,检测到智能终端中存在未运行过的目标应用程序,对于目标应用程序中的每个函数,从预设服务器获取所述每个函数对应的第一统计值,所述第一统计值包括根据第一预设统计周期内预设用户群体在使用目标应用程序过程中所述每个函数被执行的频次计算得到的数值,再根据第一统计值确定目标应用程序中的第一热点函数,通过虚拟机运行前编译的方式将所确定的第一热点函数编译为本地机器代码。通过采用上述技术方案,智能终端可以在首次运行应用程序前,从预设服务器获取针对应用程序中多个函数的大数据统计情况,并根据统计情况确定需要进行预编译的热点函数,进而通过虚拟机运行前编译的方式将热点函数编译为本地机器代码,提升应用程序首次运行效率。对于Android操作系统,本实施例创新性地将ART虚拟机、JIT以及解释执行相结合,并以大数据统计结果加以辅助,有效提升应用程序在智能终端中的运行速度及效率,在积累到足量的本机统计数据之前无需采用解释执行的方式执行目标应用程序中的所有函数。The compiler optimization method provided in this embodiment detects that there is an unexecuted target application in the smart terminal, and for each function in the target application, acquires a first statistic value corresponding to each function from the preset server. The first statistic value includes a value calculated according to a frequency at which each function of the preset user group is executed in the process of using the target application in the first preset statistical period, and then determining the target application according to the first statistic value. The first hotspot function in the program compiles the determined first hotspot function into local machine code by means of pre-compilation of the virtual machine. By adopting the above technical solution, the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time. For the Android operating system, the present embodiment innovatively combines the ART virtual machine, the JIT, and the interpretation execution, and assists with the statistical results of the big data, thereby effectively improving the running speed and efficiency of the application in the intelligent terminal, and accumulating to the foot. The amount of native statistics does not need to be interpreted to perform all functions in the target application.
在一些实施例中,每个函数对应的第一统计值通过以下方式确定:在第一预设统计周期内收集预设用户群体中的每个用户在使用所述目标应用程序过程中所述每个函数被执行的第一频次;在所述第一预设统计周期内获取所述预设用户群体中的每个用户对应的使用强度信息;根据所述每个用户的使用强度信息确定所述每个用户对应的第一权重系数,并根据所述第一权重系数和所述第一频次进行加权平均运算,得到所述每个函数对应的第一统计值。这样设置的好处在于,充分考虑预设用户群体中不同个体的差异,以及对统计结果的影响。在一实施例中,使用强度信息可包括用户的使用时长,可以是对智能终端的使用时长,也可以是目标应用程序的使用时长等,使用强度信息还可以包括智能终端中安装的应用程序总数等等,本公开不做具体限定。上述使用时长可以是第一预设统计周期内的使用时长,如一周内累计使用时长,还可以是第一预设统计周期内单位时间内的使用时长,如单位时间为一天, 使用时长为一天内累计使用时长。In some embodiments, the first statistic value corresponding to each function is determined by collecting, in the first preset statistic period, each user in the preset user group as described in the process of using the target application. The first frequency of the function is performed; the usage intensity information corresponding to each user in the preset user group is acquired in the first preset statistical period; and the determining is performed according to the usage intensity information of each user a first weighting coefficient corresponding to each user, and performing a weighted average operation according to the first weighting coefficient and the first frequency, to obtain a first statistical value corresponding to each function. The advantage of this setup is that it takes into account the differences between different individuals in the pre-set user community and the impact on the statistical results. In an embodiment, the usage strength information may include the duration of use of the user, the duration of use of the smart terminal, or the duration of use of the target application, and the usage strength information may also include the total number of applications installed in the smart terminal. Etc., the disclosure is not specifically limited. The usage duration may be the usage duration in the first preset statistical period, such as the cumulative usage duration in one week, or the usage duration in the first preset statistical period, such as the unit time is one day, and the usage duration is one day. The cumulative usage time within.
在一些实施例中,在所述通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码之后,还包括:在第二预设统计周期内记录智能终端的用户在使用所述目标应用程序过程中所述目标应用程序中每个函数被执行的第二频次,根据预设权重系数、所述第一统计值和所述第二频次进行加权平均运算,得到所述每个函数对应的第二统计值,其中,预设权重系数包括第一预设权重系数和第二预设权重系数,所述第一统计值对应第一预设权重系数,所述第二频次对应第二预设权重系数;根据至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数;根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新。这样设置的好处在于,能够根据智能终端的用户个人的使用习惯对热点函数进行变更,使得被预编译的热点函数更加贴合用户的个人习惯与偏好。第二预设统计周期可以与第一预设统计周期相同,也可不同,本实施例不做限定。例如,第一统计值为P,第二频次为q,第一预设权重系数为k1,第二预设权重系数为k2,第二统计值Q,那么可以得到Q=(k1*P+k2q)/2,k1和k2的数值本实施例不做限定。一般的,k2可大于k1,因为第二频次更能够反应用户的个人习惯,例如,k2为0.7,k1为0.3。第二热点函数的确定方式可与第一热点函数的确定方式类似。例如,判断每个函数对应的第二统计值是否达到第二预设统计阈值,若达到,则将所述每个函数确定为所述目标应用程序中的一个第二热点函数。第二预设统计阈值可以与第一预设统计阈值相同,也可以不同,本实施例不做限定。In some embodiments, after the first hotspot function is compiled into the local machine code by the pre-compilation by the virtual machine, the method further includes: recording, by the user of the smart terminal, in the second preset statistical period. a second frequency in which each function in the target application is executed in the target application process, performing a weighted average operation according to a preset weight coefficient, the first statistical value, and the second frequency, to obtain each of the a second statistic corresponding to the function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, the first statistic value corresponding to the first preset weight coefficient, and the second frequency corresponding to the first Two preset weight coefficients; determining at least one second hotspot function in the target application according to at least one second statistical value corresponding to the at least one function; and applying the target according to the at least one second hotspot function The compilation strategy of the program is updated. The advantage of this setting is that the hotspot function can be changed according to the user's personal usage habits of the smart terminal, so that the pre-compiled hotspot function is more suitable for the user's personal habits and preferences. The second preset statistical period may be the same as the first preset statistical period, or may be different, and is not limited in this embodiment. For example, the first statistic value is P, the second frequency is q, the first preset weight coefficient is k1, the second preset weight coefficient is k2, and the second statistic value Q, then Q=(k1*P+k2q) The values of /2, k1 and k2 are not limited in this embodiment. In general, k2 can be greater than k1 because the second frequency is more responsive to the user's personal habits, for example, k2 is 0.7 and k1 is 0.3. The manner in which the second hotspot function is determined may be similar to the manner in which the first hotspot function is determined. For example, determining whether the second statistical value corresponding to each function reaches a second preset statistical threshold, and if so, determining each function as a second hotspot function in the target application. The second preset statistical threshold may be the same as the first preset statistical threshold, or may be different, and is not limited in this embodiment.
在一实施例中,所述根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新,包括:在确定所述至少一个第二热点函数中的第二热点函数未被编译时,通过虚拟机运行前编译的方式将未被编译的第二热点函数编译为本地机器代码;和/或,在确定至少一个第一热点函数中已被编译的第一热点函数不属于至少一个第二热点函数时,删除所述已被编译的第一热点函数对应的本地机器代码。前者的好处在于,让能够得到运行前编译的函数更加贴合用户个人的使用习惯;后者的好处在于,可以让不贴合智能终端的用户使用习惯的第一热点函数的本地机器代码被清除,释放存储空间,让智能终端的存储资源能够得到更加合理地利用;两者均包括的好处在于,即能够让贴合用户个人使用习惯的第二热点函数被编译成本地机器代码,又能够清除不贴合智能终端的用户使用习惯的本地机器代码,从整体上贴合用户使用需求,优化智能终端的整体性能。In an embodiment, the updating the compilation policy of the target application according to the at least one second hotspot function comprises: determining that the second hotspot function in the at least one second hotspot function is not compiled Compiling the uncompiled second hotspot function into local machine code by way of pre-compilation of the virtual machine; and/or determining that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to at least one The second hotspot function deletes the local machine code corresponding to the first hotspot function that has been compiled. The advantage of the former is that it allows the function that can be compiled before running to be more suitable for the user's personal usage habits; the latter has the advantage that the local machine code of the first hotspot function that is used by the user who does not fit the smart terminal can be cleared. The storage space is released, so that the storage resources of the smart terminal can be more rationally utilized; both of the advantages include that the second hotspot function that fits the user's personal usage habits can be compiled into the local machine code, and can be cleared. Users who do not fit the smart terminal use the local machine code of the habit, and conform to the user's use requirements as a whole, and optimize the overall performance of the smart terminal.
在一些实施例中,从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值之前,还包括:获取智能终端的用户的目标属性信息。所述从预设服务器获取所述每个函数对应的第一统计值,包括:从预设服务器中获取与所述目标属性信息相匹配的所述每个函数对应的第一统计值。这样设置的好处在于,能够让基于大数据的第一统计值更加贴合当前用户的属性,使得获取的第一统计值更加准确。属性信息可包括如性别、年龄段、职业以及所处区域等等,预设服务器在进行第一统计值相关数据收集时,可按照属性信息分类进行收集并计算对应的第一统计值,当智能终端需要从预设服务器获取第一统计值时,预设服务器可根据智能终端发送的智能终端的用户的目标属性信息查找到相应的第一统计值,并反馈给智能终端,以便智能终端更加准确地确定热点函数。In some embodiments, before acquiring, by the preset server, the first statistic value corresponding to each function in the target application, the method further includes: acquiring target attribute information of the user of the smart terminal. The obtaining, by the preset server, the first statistic value corresponding to each function, includes: acquiring, by using a preset server, a first statistic value corresponding to each function that matches the target attribute information. The advantage of this setting is that the first statistical value based on big data can be made more suitable for the current user's attributes, so that the obtained first statistical value is more accurate. The attribute information may include, for example, a gender, an age group, a career, an area, and the like. When the first server collects the first statistical value related data, the preset server may collect and calculate the corresponding first statistical value according to the attribute information classification, when the smart When the terminal needs to obtain the first statistic value from the preset server, the preset server may find the corresponding first statistic value according to the target attribute information of the user of the smart terminal sent by the smart terminal, and feed back to the smart terminal, so that the smart terminal is more accurate. Determine the hotspot function.
在一些实施例中,目标应用程序可能包含多个,那么所述根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数,可包括:根据多个应用程序中的所有函数分别对应的第一统计值的综合排序确定每个应用程序对应的第一热点函数。这样设置的好处在于,由于智能终端中的存储空间有限,为了减少本地机器代码 对存储空间的占用,可综合考虑多个应用程序中多个函数对应的大数据统计情况,从而确定需要进行运行前编译的热点函数。在一实施例中,当检测到所述智能终端首次开机时,所述目标应用程序包括所述智能终端中装载的所有应用程序;所述根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数,包括:根据所有应用程序中的所有函数分别对应的第一统计值的综合排序确定每个应用程序对应的至少一个第一热点函数。这样,在智能终端首次开机时,能够基于大数据有选择性的预编译热点函数,相比与传统的ART虚拟机工作方式能够避免开机集中编译的缺点,有效减少开机等待时长,并且能够做到在本机统计数据不足的情况下,利用大数据精准地筛选出热点函数,能够兼顾绝大部分用户的使用场景,而不需在积累到足够的本机统计数据之前采用解释执行的方式执行所有函数,即利用大数据统计结果避免单个用户一一统计的真空期,让用户更快地享受到流畅的应用执行效果,提升应用程序的运行速度。In some embodiments, the target application may include multiple, then the at least one first hotspot function in the target application may be determined according to the at least one first statistical value corresponding to the at least one function. The method includes: determining, according to a comprehensive ranking of the first statistical values corresponding to all the functions in the plurality of applications, the first hotspot function corresponding to each application. The advantage of this setting is that, due to the limited storage space in the smart terminal, in order to reduce the occupation of the storage space by the local machine code, the big data statistics corresponding to multiple functions in multiple applications can be comprehensively considered to determine the need to run before running. Compiled hotspot function. In an embodiment, when detecting that the smart terminal is powered on for the first time, the target application includes all applications loaded in the smart terminal; and the at least one first one corresponding to the at least one function Determining, by a statistic value, the at least one first hotspot function in the target application, comprising: determining, according to a comprehensive ranking of the first statistic values corresponding to all the functions in all the applications, at least one first hotspot corresponding to each application function. In this way, when the smart terminal is first booted up, it can selectively pre-compile the hotspot function based on big data. Compared with the traditional ART virtual machine working mode, it can avoid the disadvantages of centralized boot compiling, effectively reduce the boot waiting time, and can do In the case of insufficient local statistical data, using the big data to accurately filter out the hotspot function can take into account the usage scenarios of most users, without having to perform all the explanations and executions before accumulating enough local statistical data. The function, which uses the statistical results of big data to avoid the vacuum period of individual users, allows users to enjoy smooth application execution and improve the running speed of the application.
图2为另一实施例提供的一种编译优化方法的流程示意图,该方法包括如下步骤。FIG. 2 is a schematic flowchart of a compiling optimization method provided by another embodiment, where the method includes the following steps.
步骤2010、检测到智能终端中存在未运行过的目标应用程序。Step 2010: It is detected that there is an target application that has not been run in the smart terminal.
本实施例中,目标应用程序包括至少一个函数。In this embodiment, the target application includes at least one function.
步骤2020、获取所述智能终端的用户的目标属性信息。Step 2020: Obtain target attribute information of a user of the smart terminal.
步骤2030、从预设服务器中获取与所述目标属性信息相匹配的所述目标应用程序中的每个函数对应的第一统计值。Step 2030: Acquire, from a preset server, a first statistic value corresponding to each function in the target application that matches the target attribute information.
步骤2040、根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数。Step 2040: Determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function.
步骤2050、通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Step 2050: Compile each first hotspot function into local machine code by means of pre-compilation of the virtual machine.
步骤2060、在第二预设统计周期内记录所述智能终端的用户在使用目标应用程序过程中所述目标应用程序中的每个函数被执行的第二频次,根据预设权重系数、第一统计值和第二频次进行加权平均运算,得到所述每个函数对应的第二统计值。Step 2060: Record, in a second preset statistical period, a second frequency that is executed by each user in the target application during use of the target application by the user of the smart terminal, according to a preset weight coefficient, first The statistic value and the second frequency are subjected to a weighted averaging operation to obtain a second statistic value corresponding to each function.
步骤2070、根据所述至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数。Step 2070: Determine at least one second hotspot function in the target application according to the at least one second statistic value corresponding to the at least one function.
步骤2080、在确定至少一个第一热点函数中已被编译的第一热点函数不属于至少一个第二热点函数时,删除已被编译的第一热点函数对应的本地机器代码,在确定至少一个第二热点函数中的第二热点函数未被编译时,通过虚拟机运行前编译的方式将未被编译的第二热点函数编译为本地机器代码。Step 2080: When it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function, delete the local machine code corresponding to the first hotspot function that has been compiled, and determine at least one When the second hotspot function in the second hotspot function is not compiled, the uncompiled second hotspot function is compiled into the local machine code by the pre-compilation of the virtual machine.
本实施例提供的编译优化方法,智能终端可以在首次运行应用程序前,从预设服务器获取针对应用程序中多个函数的大数据统计情况,并根据统计情况确定需要进行预编译的热点函数,进而通过虚拟机运行前编译的方式将热点函数编译为本地机器代码,提升应用程序首次运行效率,随后,继续采集本机用户的使用习惯数据,结合大数据统计情况和本机用户使用习惯数据对热点函数进行自回馈调整,让贴合用户个人使用习惯的第二热点函数被编译成本地机器代码,清除不贴合智能终端的用户使用习惯的本地机器代码,从整体上贴合用户使用需求,合理利用智能终端的存储空间,优化智能终端的整体性能。In the compiler optimization method provided by the embodiment, the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation. In turn, the hotspot function is compiled into the local machine code by means of pre-compilation of the virtual machine to improve the first-time running efficiency of the application. Subsequently, the usage habit data of the local user is continuously collected, combined with the statistical data of the big data and the usage data of the local user. The hotspot function performs self-feedback adjustment, so that the second hotspot function that fits the user's personal usage habits is compiled into the local machine code, and the local machine code that does not fit the user's usage habit of the smart terminal is cleared, and the user's use requirement is integrated as a whole. Rationally utilize the storage space of the intelligent terminal to optimize the overall performance of the intelligent terminal.
图3为另一实施例提供的一种编译优化方法的流程示意图,该方法可以由编译优化装置执行,其中该装置可由软件和/或硬件实现,一般可集成在服务器中。如图3所示,该方法包括如下步骤。FIG. 3 is a schematic flowchart diagram of a compiling optimization method provided by another embodiment. The method may be implemented by a compiler optimization apparatus, where the apparatus may be implemented by software and/or hardware, and may be integrated into a server. As shown in FIG. 3, the method includes the following steps.
步骤3010、在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述应用程序中的每个函数被执行的第一频次,根据所述第一频次计算出所述每个函数对应的第一统计 值。Step 3010: Collect, in a first preset statistical period, a first frequency that each function in the application is executed by the preset user group during use of the application, and calculate each of the first frequency according to the first frequency. The first statistical value corresponding to the function.
本实施例中,应用程序包括至少一个函数。In this embodiment, the application includes at least one function.
在一实施例中,服务器可以针对应用商店中或市面上发布的应用程序进行统计,预设用户群体在使用智能终端时,智能终端会将用户的使用应用程序的时间及频次等数据上传至服务器,服务器基于收集到数据进行统计,得到每个应用程序中的每个函数对应的第一统计值。In an embodiment, the server may perform statistics on an application published in the application store or in the market. When the preset user group uses the smart terminal, the smart terminal uploads data such as the time and frequency of the user's use of the application to the server. The server performs statistics based on the collected data, and obtains a first statistical value corresponding to each function in each application.
下面给出一种确定第一统计值的实现方式,作为示意性说明。在服务器中建立预设数据结构,例如,该预设数据结构的形式可以是包名-Key-Value。其中,包名指应用程序对应的包名(package name),是应用程序的身份标识,具有全局唯一性;Key的取值形式可以是类名+执行函数名,类名和执行函数名一般为字符串形式,为了方便统计及计算,可对字符串进行转换,如采用哈希(Hash)计算的方式,将类名+执行函数名映射为固定长度的值,例如,采用消息摘要算法(Message Digest Algorithm,MD)第五版MD5编码的方式将类名+执行函数名转换为8字节(Byte)的形式;Value可以是该函数实际使用的频次信息。云端的服务器在得到海量用户(当预设用户群体的样本数量足够多时)统计结果后,基于用户的手机使用强度,对每个用户赋以权值,做加权平均计算,得到全局每个应用中每个类中的每个函数的权重信息(即本实施例中的第一统计值)。An implementation for determining the first statistical value is given below as a schematic illustration. A preset data structure is established in the server. For example, the preset data structure may be in the form of a package name -Key-Value. The package name refers to the package name corresponding to the application, which is the identity of the application, and has global uniqueness; the value of the Key can be the class name + execution function name, and the class name and execution function name are generally characters. In the form of a string, in order to facilitate statistics and calculations, the string can be converted. For example, the hash name (Hash) is used to map the class name + execution function name to a fixed-length value, for example, using a message digest algorithm (Message Digest) Algorithm, MD) The fifth version of MD5 encoding converts the class name + execution function name into a form of 8 bytes (Byte); Value can be the frequency information actually used by the function. After receiving statistics from a large number of users (when the number of samples of the preset user group is sufficient), the cloud server assigns a weight to each user based on the user's mobile phone usage intensity, and performs a weighted average calculation to obtain a global application. Weight information for each function in each class (ie, the first statistic in this embodiment).
步骤3020、接收到智能终端获取所述应用程序中至少一个函数一一对应的至少一个第一统计值的获取请求。Step 3020: Receive an acquisition request of the smart terminal to acquire at least one first statistic value corresponding to at least one function in the application.
本实施例中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求。In this embodiment, the smart terminal sends the acquisition request to the server when detecting that the application is not running.
步骤3030、将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端。Step 3030: Send at least one first statistic value corresponding to the at least one function in the application to the smart terminal.
本实施例中,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将所述至少一个第一热点函数中每个第一热点函数编译为本地机器代码。In this embodiment, the at least one first statistic value is used to indicate that the smart terminal determines at least one first hotspot function in the application according to the at least one first statistic value, and compiles before running through a virtual machine. The manner of compiling each of the at least one first hotspot function into local machine code.
本实施例中提供的编译优化方法,服务器对于应用程序中的每个函数,在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述每个函数被执行的第一频次,根据第一频次计算出所述每个函数对应的第一统计值,在接收到智能终端获取应用程序中至少一个函数一一对应的至少一个第一统计值的获取请求时,将至少一个第一统计值发送至智能终端,以指示智能终端根据至少一个第一统计值确定需要通过虚拟机运行前编译的方式进行编译的热点函数。通过采用上述技术方案,服务器能够通过大数据方式统计出预设用户群体在使用应用程序过程中不同函数的执行频次情况,进而计算出第一统计值,将第一统计值发送给智能终端,指导智能终端在首次运行应用程序前对热点函数进行预编译,提升应用程序首次运行效率。In the compiler optimization method provided in this embodiment, the server collects, for each function in the application, the first frequency that each function of the preset user group is executed during the use of the application program in the first preset statistical period. And calculating, according to the first frequency, the first statistic value corresponding to each function, and when receiving the acquisition request of the at least one first statistic value corresponding to the at least one function in the application by the smart terminal, at least one The first statistic value is sent to the smart terminal to instruct the smart terminal to determine, according to the at least one first statistic value, a hotspot function that needs to be compiled by means of pre-compilation of the virtual machine. By adopting the above technical solution, the server can calculate the frequency of execution of different functions in the process of using the application by the preset user group by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide The smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
图4为另一实施例提供的一种编译优化方法的流程示意图,以智能终端与预设服务器交互的场景进行描述,该方法包括如下步骤。FIG. 4 is a schematic flowchart of a compiling optimization method provided by another embodiment, which is described in a scenario in which an intelligent terminal interacts with a preset server, and the method includes the following steps.
步骤4010、服务器在第一预设统计周期内收集预设用户群体在使用不同应用程序过程中每个函数被执行的第一频次,根据每个函数被执行的第一频次计算出每个函数对应的第一统计值。Step 4010: The server collects, in a first preset statistical period, a first frequency that each function is executed by the preset user group in using different applications, and calculates a corresponding function according to the first frequency that each function is executed. The first statistic.
步骤4020、智能终端在检测到存在未运行过的目标应用程序时,向服务器发送获取目标应用程序中每个函数对应的第一统计值的获取请求。Step 4020: When detecting that there is a target application that has not been run, the smart terminal sends an acquisition request for acquiring a first statistic value corresponding to each function in the target application to the server.
步骤4030、服务器根据获取请求查找目标应用程序中每个函数对应的第一统计值,并发 送给智能终端。Step 4030: The server searches for a first statistic value corresponding to each function in the target application according to the obtaining request, and sends the first statistic value to the smart terminal.
步骤4040、智能终端根据第一统计值确定目标应用程序中的第一热点函数,并通过虚拟机运行前编译的方式将第一热点函数编译为本地机器代码。Step 4040: The smart terminal determines a first hotspot function in the target application according to the first statistic value, and compiles the first hotspot function into a local machine code by using a pre-compilation manner of the virtual machine.
步骤4050、智能终端在第二预设统计周期内记录所述智能终端的用户在使用目标应用程序过程中每个函数被执行的第二频次。Step 4050: The smart terminal records, in the second preset statistical period, a second frequency that each user of the smart terminal performs during the process of using the target application.
步骤4060、智能终端根据第二统计值确定所述目标应用程序中的第二热点函数,根据第二热点函数对目标应用程序的编译策略进行更新。Step 4060: The smart terminal determines a second hotspot function in the target application according to the second statistical value, and updates the compilation policy of the target application according to the second hotspot function.
图5为一实施例提供的一种智能终端与服务器进行交互的信令图,可结合该信令图对上述实施例进行理解。FIG. 5 is a signaling diagram of an intelligent terminal interacting with a server according to an embodiment. The foregoing embodiment may be understood by using the signaling diagram.
本实施例提供的编译优化方法,由服务器进行预设用户群体使用应用程序的历史习惯数据,形成大数据统计结果反馈给智能终端,智能终端基于大数据统计结果确定未运行应用程序中的热点函数,对热点函数进行运行前编译,有效提升应用程序的运行速度。In the compiling optimization method provided by the embodiment, the server performs the historical habit data of the application group by using the preset user group, and forms a big data statistical result to be fed back to the smart terminal, and the smart terminal determines the hotspot function in the non-running application based on the big data statistical result. , pre-compilation of hotspot functions, effectively improve the speed of the application.
图6为一实施例提供的一种编译优化装置的结构框图,该装置可由软件和/或硬件实现,一般集成在智能终端中,可通过执行编译优化方法来优化智能终端中基于虚拟机的编译方案。如图6所示,该装置包括:运行监测模块601,设置为检测智能终端中是否存在未运行过的目标应用程序,其中,目标应用程序包括至少一个函数;第一统计值获取模块602,设置为在检测到智能终端中存在未运行过的目标应用程序时,从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;第一热点函数确定模块603,设置为根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;编译模块604,设置为通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。6 is a structural block diagram of a compiler optimization apparatus provided by an embodiment. The apparatus may be implemented by software and/or hardware, and is generally integrated in an intelligent terminal, and may optimize a virtual machine based compilation in a smart terminal by executing a compiler optimization method. Program. As shown in FIG. 6, the device includes: an operation monitoring module 601, configured to detect whether there is an unexecuted target application in the smart terminal, where the target application includes at least one function; the first statistic value obtaining module 602, setting Obtaining, by the preset server, a first statistic value corresponding to each function in the target application, when the target application that is not running is detected in the smart terminal, where the first statistic value includes a statistic value calculated by the first frequency corresponding to the function, where the first frequency includes a frequency at which each function of the preset user group is executed during the use of the target application program in the first preset statistical period; a hotspot function determining module 603, configured to determine at least one first hotspot function in the target application according to the at least one first statistical value corresponding to the at least one function; the compiling module 604 is configured to pass the virtual machine The pre-run compilation method compiles each first hotspot function into native machine code.
本实施例提供的编译优化装置,检测到智能终端中存在未运行过的目标应用程序,对于目标应用程序中的每个函数,从预设服务器获取所述每个函数对应的第一统计值,所述第一统计值包括根据第一预设统计周期内预设用户群体在使用目标应用程序过程中所述每个函数被执行的频次计算得到的数值,再根据第一统计值确定目标应用程序中的第一热点函数,通过虚拟机运行前编译的方式将所确定的第一热点函数编译为本地机器代码。通过采用上述技术方案,智能终端可以在首次运行应用程序前,从预设服务器获取针对应用程序中多个函数的大数据统计情况,并根据统计情况确定需要进行预编译的热点函数,进而通过虚拟机运行前编译的方式将热点函数编译为本地机器代码,提升应用程序首次运行效率。The compiler optimization apparatus provided in this embodiment detects that there is an unexecuted target application in the smart terminal, and obtains, for each function in the target application, a first statistic value corresponding to each function from the preset server, The first statistic value includes a value calculated according to a frequency at which each function of the preset user group is executed during the use of the target application program in the first preset statistical period, and then the target application is determined according to the first statistic value. The first hotspot function in the first hotspot function compiles the determined first hotspot function into local machine code by means of pre-compilation of the virtual machine. By adopting the above technical solution, the smart terminal can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time.
在一实施例中,每个函数对应的第一统计值通过以下方式确定:In an embodiment, the first statistical value corresponding to each function is determined by:
在第一预设统计周期内收集预设用户群体中的每个用户在使用所述目标应用程序过程中所述每个函数被执行的第一频次,其中,预设用户群体包括多个用户;在所述第一预设统计周期内获取所述预设用户群体中的每个用户对应的使用强度信息;根据所述每个用户的使用强度信息确定所述每个用户分别对应的第一权重系数,并根据所述多个用户一一对应的多个第一权重系数和所述多个用户一一对应的多个第一频次进行加权平均运算,得到所述每个函数对应的第一统计值。Collecting, in a first preset statistical period, a first frequency that each function in the preset user group is executed during use of the target application, where the preset user group includes multiple users; Obtaining the usage intensity information corresponding to each user in the preset user group in the first preset statistical period; determining the first weight corresponding to each user according to the usage intensity information of each user a coefficient, and performing a weighted averaging operation according to the plurality of first weight coefficients corresponding to the plurality of users and the plurality of first frequencies corresponding to the plurality of users, to obtain a first statistic corresponding to each function value.
在一实施例中,该装置还包括第二统计值获取模块,设置为在所述通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码之后,在第二预设统计周期内记录所述智能终端的用户在使用所述目标应用程序过程中所述目标应用程序中的每个函数被执行的第二 频次,根据预设权重系数、所述第一统计值和所述第二频次进行加权平均运算,得到所述每个函数对应的第二统计值,其中,预设权重系数包括第一预设权重系数和第二预设权重系数,所述第一统计值对应所述第一预设权重系数,所述第二频次对应所述第二预设权重系数;第二热点函数确定模块,设置为根据所述至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数;编译策略更新模块,设置为根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新。In an embodiment, the apparatus further includes a second statistic value obtaining module configured to: after the first hotspot function is compiled into the local machine code in the manner of compiling by the virtual machine before running, in the second preset statistic Recording, in a period, a second frequency at which each function in the target application is executed by a user of the smart terminal during use of the target application, according to a preset weight coefficient, the first statistical value, and the Performing a weighted averaging operation on the second frequency to obtain a second statistic value corresponding to each function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, where the first statistic value corresponds to a first preset weight coefficient, the second frequency corresponding to the second preset weight coefficient; a second hotspot function determining module, configured to determine, according to the at least one second statistic value corresponding to the at least one function At least one second hotspot function in the target application; a compiling policy update module configured to apply to the target according to the at least one second hotspot function The compilation strategy of the sequence is updated.
在一实施例中,所述编译策略更新模块,是设置为:在确定所述至少一个第二热点函数中的第二热点函数未被编译时,通过虚拟机运行前编译的方式将未被编译的第二热点函数编译为本地机器代码;和/或,在确定所述至少一个第一热点函数中已被编译的第一热点函数不属于所述至少一个第二热点函数时,删除所述已被编译的第一热点函数对应的本地机器代码。In an embodiment, the compiling strategy update module is configured to: when determining that the second hotspot function in the at least one second hotspot function is not compiled, the method of compiling before running through the virtual machine is not compiled. The second hotspot function is compiled into local machine code; and/or, when it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function, deleting the already The local machine code corresponding to the first hotspot function being compiled.
在一实施例中,第一热点函数确定模块603是设置为通过如下方式根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数:判断每个函数对应的第一统计值是否达到第一预设统计阈值,若达到,则将所述每个函数确定为所述目标应用程序中的一个第一热点函数。In an embodiment, the first hotspot function determining module 603 is configured to determine at least one first hotspot function in the target application according to at least one first statistic value corresponding to the at least one function. And determining whether the first statistic value corresponding to each function reaches a first preset statistic threshold, and if so, determining each function as a first hotspot function in the target application.
在一实施例中,该装置还包括属性信息获取模块,设置为在所述从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值之前,获取所述智能终端的用户的目标属性信息;所述第一统计值获取模块602是设置为通过如下方式从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值:从预设服务器中获取与所述目标属性信息相匹配的所述目标应用程序中的每个函数对应的第一统计值。In an embodiment, the apparatus further includes an attribute information acquiring module, configured to acquire a user of the smart terminal before acquiring the first statistic value corresponding to each function in the target application from the preset server The first statistic value obtaining module 602 is configured to acquire, by using a preset server, a first statistic value corresponding to each function in the target application program: obtaining and locating from a preset server The first statistical value corresponding to each function in the target application that matches the target attribute information.
在一实施例中,当检测到所述智能终端首次开机时,所述目标应用程序包括所述智能终端中装载的所有应用程序;所述第一热点函数确定模块603是设置为通过如下方式根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数:根据所有应用程序中的所有函数分别对应的第一统计值的综合排序确定每个应用程序对应的至少一个第一热点函数。In an embodiment, when detecting that the smart terminal is powered on for the first time, the target application includes all applications loaded in the smart terminal; the first hotspot function determining module 603 is configured to be configured according to the following manner The at least one first statistic value corresponding to the at least one function determines at least one first hotspot function in the target application: determining, according to a comprehensive ranking of the first statistic values respectively corresponding to all functions in all applications At least one first hotspot function corresponding to each application.
图7为另一实施例提供的一种编译优化装置的结构框图,该装置可由软件和/或硬件实现,一般集成在服务器中,可通过执行编译优化方法来优化智能终端中基于虚拟机的编译方案。如图7所示,该装置包括:统计值计算模块701,设置为在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述应用程序中的每个函数被执行的第一频次,根据所述第一频次计算出所述每个函数对应的第一统计值,所述应用程序包括至少一个函数;获取请求接收模块702,设置为接收智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求;统计值发送模块703,设置为在接收到所述智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求时,将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。FIG. 7 is a structural block diagram of a compiler optimization apparatus provided by another embodiment, which may be implemented by software and/or hardware, generally integrated in a server, and may optimize a virtual machine based compilation in a smart terminal by executing a compiler optimization method. Program. As shown in FIG. 7, the apparatus includes: a statistical value calculation module 701, configured to collect, during a first preset statistical period, a first user group in which the function is executed in the application process during use of the application program a frequency, calculating a first statistic value corresponding to each function according to the first frequency, the application program includes at least one function, and an acquisition request receiving module 702 is configured to receive the smart terminal to obtain the application program. An acquisition request of at least one first statistic value corresponding to the at least one function, wherein the smart terminal sends the acquisition request to the server when detecting that the application is not running; the statistic value sending module 703, configured to: when the smart terminal acquires an acquisition request of the at least one first statistic value corresponding to the at least one function in the application, the at least one function in the application Transmitting at least one first statistic value of the one-to-one correspondence to the smart terminal, where the at least one first statistic value is used to indicate that the smart terminal is configured according to the The at least one first statistical value determines at least one first hotspot function in the application, and each first hotspot function is compiled into local machine code by way of pre-compilation of the virtual machine.
本实施例提供的编译优化装置,服务器对于应用程序中的每个函数,在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述每个函数被执行的第一频次,根据第一频次计算出所述每个函数对应的第一统计值,在接收到智能终端获取所述应用程序中至少一个函数一一对应的至少一个第一统计值的获取请求时,将至少一个第一统计值发送至智能终端,以指示智能终端根据第一统计值确定需要通过虚拟机运行前编译的方式进行编译的热点函数。 通过采用上述技术方案,服务器能够通过大数据方式统计出预设用户群体在使用应用程序过程中不同函数的执行频次情况,进而计算出第一统计值,将第一统计值发送给智能终端,指导智能终端在首次运行应用程序前对热点函数进行预编译,提升应用程序首次运行效率。In the compiler optimization apparatus provided by the embodiment, the server collects, for each function in the application, the first frequency that each function of the preset user group is executed during the use of the application program in a first preset statistical period, Calculating, according to the first frequency, the first statistic value corresponding to each function, and when receiving the acquisition request of the at least one first statistic value corresponding to the at least one function in the application, A first statistic value is sent to the smart terminal to instruct the smart terminal to determine, according to the first statistic value, a hotspot function that needs to be compiled by means of pre-compilation of the virtual machine. By adopting the above technical solution, the server can calculate the frequency of execution of different functions in the process of using the application by the preset user group by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide The smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
本实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行编译优化方法,该方法包括:检测到智能终端中存在未运行过的目标应用程序,其中,目标应用程序包括至少一个函数;从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。The embodiment further provides a storage medium containing computer executable instructions for executing a compilation optimization method when executed by a computer processor, the method comprising: detecting that there is an unrun in the smart terminal a target application, wherein the target application includes at least one function; acquiring, from a preset server, a first statistic value corresponding to each function in the target application, the first statistic value including corresponding to each function The first frequency calculates a statistical value, where the first frequency includes a frequency at which each function of the preset user group is executed during use of the target application in the first preset statistical period; At least one first statistic value corresponding to a function one-to-one determines at least one first hotspot function in the target application; each first hotspot function is compiled into local machine code by way of pre-compilation of the virtual machine.
存储介质——任何的一种类型的存储器设备或存储设备。术语“存储介质”旨在包括:安装介质,例如紧凑型光盘只读储存器(Compact Disc Read-Only Memory,CD-ROM)、软盘或磁带装置;计算机系统存储器或随机存取存储器,诸如动态随机存取存储器(Dynamic Random Access Memory,DRAM)、双倍数据速率随机存取存储器(Double Data Rate Random Access Memory,DDRRAM)、静态随机存取存储器(Static Random Access Memory,SRAM)、扩展数据输出随机存取存储器(Extended Data Output Random Access Memory,EDORAM),兰巴斯(Rambus)随机存取存储器(Random Access Memory,RAM)等;非易失性存储器,诸如闪存、磁介质(例如硬盘或光存储);寄存器或其它相似类型的存储器元件等。存储介质可以还包括其它类型的存储器或其组合。另外,存储介质可以位于程序在其中被执行的第一计算机系统中,或者可以位于不同的第二计算机系统中,第二计算机系统通过网络(诸如因特网)连接到第一计算机系统。第二计算机系统可以提供程序指令给第一计算机用于执行。术语“存储介质”可以包括可以驻留在不同位置中(例如在通过网络连接的不同计算机系统中)的两个或更多存储介质。存储介质可以存储可由一个或多个处理器执行的程序指令(例如程序指令为计算机程序)。Storage medium - any type of storage device or storage device. The term "storage medium" is intended to include: a mounting medium such as a Compact Disc Read-Only Memory (CD-ROM), a floppy disk or a tape device; a computer system memory or a random access memory such as a dynamic random Dynamic Random Access Memory (DRAM), Double Data Rate Random Access Memory (DDRRAM), Static Random Access Memory (SRAM), and extended data output random storage Extended Data Output Random Access Memory (EDORAM), Rambus Random Access Memory (RAM), etc.; non-volatile memory such as flash memory, magnetic media (such as hard disk or optical storage) Register or other similar type of memory element, etc. The storage medium may also include other types of memory or a combination thereof. Additionally, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system, the second computer system being coupled to the first computer system via a network, such as the Internet. The second computer system can provide program instructions to the first computer for execution. The term "storage medium" can include two or more storage media that can reside in different locations (eg, in different computer systems connected through a network). A storage medium may store program instructions (eg, program instructions are a computer program) executable by one or more processors.
本实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的编译优化操作,还可以执行本公开对应智能终端的任意实施例所提供的编译优化方法中的相关操作。The storage medium containing the computer executable instructions provided by the embodiment, the computer executable instructions are not limited to the compiler optimization operation as described above, and may also execute the compiler optimization method provided by any embodiment of the present disclosure corresponding to the smart terminal. Related operations in .
本实施例还提供另一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行编译优化方法,该方法包括:在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述应用程序中的每个函数被执行的第一频次,根据所述第一频次计算出所述每个函数对应的第一统计值,所述应用程序包括至少一个函数;接收到智能终端获取所述应用程序中至少一个函数一一对应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求;将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。The embodiment further provides another storage medium containing computer executable instructions for executing a compilation optimization method when executed by a computer processor, the method comprising: collecting during a first predetermined statistical period Presetting a first frequency that each function in the application is executed during a process of using an application, and calculating, according to the first frequency, a first statistic corresponding to each function, the application Including at least one function; receiving, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to at least one function in the application, wherein the smart terminal detects that the application is not running, Sending the acquisition request to the server; sending at least one first statistic value corresponding to the at least one function in the application to the smart terminal, where the at least one first statistic value is used to indicate Determining, by the smart terminal, at least one first hotspot function in the application according to the at least one first statistic value Before running the virtual machine compiler of the first embodiment each function of the local hotspot compiled machine code.
本实施例的计算机存储介质的具体细节与上面所述的计算机存储介质相似,此处不再赘述。The specific details of the computer storage medium of this embodiment are similar to those of the computer storage medium described above, and are not described herein again.
本实施例提供了一种智能终端,该智能终端中可集成本实施例提供的对应智能终端的编 译优化装置。图8为一实施例提供的一种智能终端的结构示意图。智能终端800可以包括:存储器801,处理器802及存储在存储器801上并可在处理器802运行的计算机程序,所述处理器802执行所述计算机程序时实现如本公开实施例所述的对应智能终端的编译优化方法。The embodiment provides an intelligent terminal, and the compiling and optimizing device of the corresponding smart terminal provided by the embodiment is integrated in the smart terminal. FIG. 8 is a schematic structural diagram of an intelligent terminal according to an embodiment. The smart terminal 800 can include a memory 801, a processor 802, and a computer program stored on the memory 801 and executable by the processor 802, the processor 802 executing the computer program to implement a corresponding implementation as described in an embodiment of the present disclosure. Compilation optimization method for intelligent terminals.
本实施例提供的智能终端,可以在首次运行应用程序前,从预设服务器获取针对应用程序中多个函数的大数据统计情况,并根据统计情况确定需要进行预编译的热点函数,进而通过虚拟机运行前编译的方式将热点函数编译为本地机器代码,提升应用程序首次运行效率。The smart terminal provided in this embodiment can obtain the big data statistics for multiple functions in the application from the preset server before running the application for the first time, and determine the hot function that needs to be pre-compiled according to the statistical situation, and then pass the virtual The way to compile before running the machine compiles the hotspot function into local machine code, which improves the efficiency of the application for the first time.
图9为另一实施例提供的另一种智能终端的结构示意图,该智能终端900可以包括:壳体(图9中未示出)、存储器901、中央处理器(central processing unit,CPU)902(又称处理器,以下简称CPU)、电路板(图9中未示出)和电源电路(图9中未示出)。所述电路板安置在所述壳体围成的空间内部;所述CPU902和所述存储器901设置在所述电路板上;所述电源电路,设置为为所述智能终端的至少一个电路或器件供电;所述存储器901,设置为存储可执行程序代码;所述CPU902通过读取所述存储器901中存储的可执行程序代码来运行与所述可执行程序代码对应的计算机程序,以实现以下步骤:检测到智能终端中存在未运行过的目标应用程序,其中,目标应用程序包括至少一个函数;从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。FIG. 9 is a schematic structural diagram of another smart terminal provided by another embodiment. The smart terminal 900 may include: a casing (not shown in FIG. 9), a memory 901, and a central processing unit (CPU) 902. (also referred to as a processor, hereinafter referred to as CPU), a circuit board (not shown in FIG. 9), and a power supply circuit (not shown in FIG. 9). The circuit board is disposed inside a space enclosed by the casing; the CPU 902 and the memory 901 are disposed on the circuit board; and the power circuit is configured to be at least one circuit or device of the smart terminal The memory 901 is configured to store executable program code; the CPU 902 runs a computer program corresponding to the executable program code by reading executable program code stored in the memory 901 to implement the following steps Detecting that there is an unexecuted target application in the smart terminal, wherein the target application includes at least one function; acquiring, from the preset server, a first statistic value corresponding to each function in the target application, the a statistic value includes a statistic value calculated according to the first frequency corresponding to each function, where the first frequency includes a preset user group in the first preset statistic period, in the process of using the target application Frequency at which a function is executed; determining the target application based on at least one first statistic value corresponding to the at least one function At least one first hot function; by way of the front of the virtual machine running the compiler to compile the function of each of the first hot native machine code.
所述智能终端还包括:外设接口903、射频(Radio Frequency,RF)电路905、音频电路906、扬声器911、电源管理芯片908、输入/输出(I/O)子系统909、其他输入/控制设备910、触摸屏912、其他输入/控制设备910以及外部端口904,这些部件通过一个或多个通信总线或信号线907来通信。The smart terminal further includes: a peripheral interface 903, a radio frequency (RF) circuit 905, an audio circuit 906, a speaker 911, a power management chip 908, an input/output (I/O) subsystem 909, and other inputs/controls. Device 910, touch screen 912, other input/control devices 910, and external port 904, these components communicate over one or more communication buses or signal lines 907.
图9中示出的智能终端900仅仅是智能终端的一个范例,并且智能终端900可以具有比图9中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图9中所示出的多种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The smart terminal 900 illustrated in FIG. 9 is merely one example of a smart terminal, and the smart terminal 900 may have more or fewer components than those illustrated in FIG. 9, and two or more components may be combined, Or it can have different component configurations. The various components shown in Figure 9 can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
下面就本实施例提供的用于优化虚拟机编译的智能终端进行描述,该智能终端以手机为例。The smart terminal for optimizing virtual machine compilation provided by the embodiment is described below. The smart terminal takes a mobile phone as an example.
存储器901,所述存储器901可以被CPU902以及外设接口903等访问,所述存储器901可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 901 can be accessed by the CPU 902 and the peripheral interface 903, etc., and the memory 901 can include a high speed random access memory, and can also include a nonvolatile memory such as one or more magnetic disk storage devices, flash memory devices. Or other volatile solid-state storage devices.
外设接口903,所述外设接口903可以将设备的输入外设和输出外设连接到CPU902和存储器901。A peripheral interface 903 that can connect the input and output peripherals of the device to the CPU 902 and the memory 901.
I/O子系统909,所述I/O子系统909可以将设备上的输入输出外设,例如触摸屏912和其他输入/控制设备910,连接到外设接口903。I/O子系统909可以包括显示控制器9091和设置为控制其他输入/控制设备910的一个或多个输入控制器9092。其中,一个或多个输入控制器9092从其他输入/控制设备910接收电信号或者向其他输入/控制设备910发送电信号,其他输入/控制设备910可以包括物理按钮(按压按钮以及摇臂按钮等)、拨号盘、滑动开关、操纵杆以及点击滚轮。本实施例中,输入控制器9092可以与以下任一个连接:键盘、红外端口、USB接口以及诸如鼠标的指示设备。I/O subsystem 909, which can connect input and output peripherals on the device, such as touch screen 912 and other input/control devices 910, to peripheral interface 903. The I/O subsystem 909 can include a display controller 9091 and one or more input controllers 9092 that are configured to control other input/control devices 910. Wherein, one or more input controllers 9092 receive electrical signals from other input/control devices 910 or transmit electrical signals to other input/control devices 910, and other input/control devices 910 may include physical buttons (pressing buttons and rocker buttons, etc.) ), dial, slide switch, joystick, and click wheel. In this embodiment, the input controller 9092 can be connected to any one of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
触摸屏912,所述触摸屏912是用户智能终端与用户之间的输入接口和输出接口,将可视输出显示给用户,可视输出可以包括图形、文本、图标以及视频等。The touch screen 912 is an input interface and an output interface between the user intelligent terminal and the user, and displays the visual output to the user. The visual output may include graphics, text, icons, videos, and the like.
I/O子系统909中的显示控制器9091从触摸屏912接收电信号或者向触摸屏912发送电信号。触摸屏912检测触摸屏912上的接触,显示控制器9091将检测到的接触转换为与显示在触摸屏912上的用户界面对象的交互,即实现人机交互,显示在触摸屏912上的用户界面对象可以是运行游戏的图标或联网到相应网络的图标等。本实施例中,设备还可以包括光鼠,光鼠是不显示可视输出的触摸敏感表面,或者是由触摸屏形成的触摸敏感表面的延伸。 Display controller 9091 in I/O subsystem 909 receives an electrical signal from touch screen 912 or an electrical signal to touch screen 912. The touch screen 912 detects the contact on the touch screen 912, and the display controller 9091 converts the detected contact into an interaction with the user interface object displayed on the touch screen 912, that is, realizes human-computer interaction, and the user interface object displayed on the touch screen 912 may be Run the game's icons or icons that are networked to the appropriate network. In this embodiment, the device may further include a light mouse, which is a touch sensitive surface that does not display a visual output, or an extension of a touch sensitive surface formed by the touch screen.
RF电路905,主要设置为建立手机与无线网络(即网络侧)的通信,实现手机与无线网络的数据接收和发送。例如收发短信息以及电子邮件等。在一实施例中,RF电路905接收并发送RF信号,RF信号也称为电磁信号,RF电路905将电信号转换为电磁信号或将电磁信号转换为电信号,并且通过该电磁信号与通信网络以及其他设备进行通信。RF电路905可以包括用于执行这些功能的已知电路,RF电路905包括但不限于天线系统、RF收发机、一个或多个放大器、调谐器、一个或多个振荡器、数字信号处理器、编译码器(COder-DECoder,CODEC)芯片组以及用户标识模块(Subscriber Identity Module,SIM)等等。The RF circuit 905 is mainly configured to establish communication between the mobile phone and the wireless network (ie, the network side), and implement data reception and transmission between the mobile phone and the wireless network. For example, sending and receiving short messages and emails. In one embodiment, RF circuit 905 receives and transmits an RF signal, also referred to as an electromagnetic signal, and RF circuit 905 converts the electrical signal into an electromagnetic signal or converts the electromagnetic signal into an electrical signal, and through the electromagnetic signal and communication network And other devices to communicate. RF circuitry 905 may include known circuitry for performing these functions, including but not limited to an antenna system, an RF transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, Coder-CODEter (CODEC) chipset and Subscriber Identity Module (SIM) and so on.
音频电路906,主要设置为从外设接口903接收音频数据,将该音频数据转换为电信号,并且将该电信号发送给扬声器911。The audio circuit 906 is primarily configured to receive audio data from the peripheral interface 903, convert the audio data into an electrical signal, and transmit the electrical signal to the speaker 911.
扬声器911,设置为将手机通过RF电路905从无线网络接收的语音信号,还原为声音并向用户播放该声音。The speaker 911 is arranged to restore the voice signal received by the mobile phone from the wireless network through the RF circuit 905 to sound and play the sound to the user.
电源管理芯片908,设置为为CPU902、I/O子系统及外设接口所连接的硬件进行供电及电源管理。The power management chip 908 is configured to provide power and power management for the hardware connected to the CPU 902, the I/O subsystem, and the peripheral interface.
本实施例还提供了一种服务器,该服务器中可集成本公开实施例提供的对应服务器的编译优化装置。图10为另一实施例提供的一种服务器的结构示意图。服务器1000可以包括:存储器1001,处理器1002及存储在存储器1001上并可在处理器1002运行的计算机程序,所述处理器1002执行所述计算机程序时实现如本公开实施例所述的对应服务器的编译优化方法。The embodiment further provides a server in which the compiler optimization device of the corresponding server provided by the embodiment of the present disclosure can be integrated. FIG. 10 is a schematic structural diagram of a server according to another embodiment. The server 1000 may include a memory 1001, a computer program stored on the memory 1001 and operable on the processor 1002, and the processor 1002 executing the computer program to implement a corresponding server as described in the embodiment of the present disclosure. Compilation optimization method.
本实施例提供的服务器,能够通过大数据方式统计出预设用户群体在使用应用程序过程中不同函数的执行频次情况,进而计算出第一统计值,将第一统计值发送给智能终端,指导智能终端在首次运行应用程序前对热点函数进行预编译,提升应用程序首次运行效率。The server provided in this embodiment can calculate the frequency of execution of different functions of the preset user group in the process of using the application program by using the big data method, and then calculate the first statistic value, and send the first statistic value to the intelligent terminal to guide The smart terminal pre-compiles the hotspot function before running the application for the first time, improving the efficiency of the application for the first time.
上述实施例中提供的编译优化装置、存储介质、智能终端及服务器可执行本公开对应实施例所提供的编译优化方法,具备执行方法相应的功能模块和有益效果。未在上述实施例中描述的技术细节,可参见本公开相关实施例所提供的编译优化方法。The compiler optimization device, the storage medium, the smart terminal and the server provided in the above embodiments can execute the compiler optimization method provided by the corresponding embodiment of the present disclosure, and have the corresponding functional modules and beneficial effects of the execution method. For the technical details not described in the above embodiments, reference may be made to the compiler optimization method provided by the related embodiments of the present disclosure.

Claims (20)

  1. 一种编译优化方法,应用于智能终端,包括:A compiler optimization method applied to a smart terminal, including:
    检测到智能终端中存在未运行过的目标应用程序;其中,所述目标应用程序包括至少一个函数;Detecting that there is an inactive target application in the smart terminal; wherein the target application includes at least one function;
    从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;And acquiring, by the preset server, a first statistic value corresponding to each function in the target application, where the first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, the first The frequency includes a frequency at which each function described by the preset user group is executed during use of the target application during the first preset statistical period;
    根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;Determining at least one first hotspot function in the target application according to the at least one first statistical value corresponding to the at least one function;
    通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Each first hotspot function is compiled into native machine code by pre-compilation of the virtual machine.
  2. 根据权利要求1所述的方法,其中,每个函数对应的第一统计值通过以下方式确定:The method of claim 1 wherein the first statistical value corresponding to each function is determined by:
    在第一预设统计周期内收集预设用户群体中的每个用户在使用所述目标应用程序过程中所述每个函数被执行的第一频次;其中,所述预设用户群体包括多个用户;Collecting, in a first preset statistical period, a first frequency that each function in the preset user group is executed during use of the target application; wherein the preset user group includes multiple user;
    在所述第一预设统计周期内获取所述预设用户群体中的每个用户对应的使用强度信息;Obtaining usage intensity information corresponding to each user in the preset user group in the first preset statistical period;
    根据所述每个用户对应的使用强度信息确定所述每个用户对应的第一权重系数,并根据所述多个用户一一对应的多个第一权重系数和所述多个用户一一对应的多个第一频次进行加权平均运算,得到所述每个函数对应的第一统计值。Determining, according to the usage intensity information corresponding to each user, a first weighting coefficient corresponding to each user, and correspondingly corresponding to the plurality of users according to the plurality of first weighting coefficients corresponding to the plurality of users The plurality of first frequencies are subjected to a weighted averaging operation to obtain a first statistic value corresponding to each of the functions.
  3. 根据权利要求1或2所述的方法,在所述通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码之后,还包括:The method according to claim 1 or 2, after compiling each first hotspot function into local machine code by means of pre-compilation by the virtual machine, further comprising:
    在第二预设统计周期内记录所述智能终端的用户在使用所述目标应用程序过程中所述目标应用程序中的每个函数被执行的第二频次,根据预设权重系数、所述第一统计值和所述第二频次进行加权平均运算,得到所述每个函数对应的第二统计值,其中,所述预设权重系数包括第一预设权重系数和第二预设权重系数,所述第一统计值对应所述第一预设权重系数,所述第二频次对应所述第二预设权重系数;Recording, in a second preset statistical period, a second frequency that each function in the target application is executed by a user of the smart terminal during use of the target application, according to a preset weight coefficient, the first Performing a weighted average operation on the statistic value and the second frequency to obtain a second statistic value corresponding to each function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, The first statistic value corresponds to the first preset weight coefficient, and the second frequency corresponds to the second preset weight coefficient;
    根据所述至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数;Determining at least one second hotspot function in the target application according to the at least one second statistical value corresponding to the at least one function;
    根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新。Updating the compilation policy of the target application according to the at least one second hotspot function.
  4. 根据权利要求3所述的方法,其中,所述根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新,包括以下至少之一:The method of claim 3, wherein the updating the compilation policy of the target application according to the at least one second hotspot function comprises at least one of the following:
    在确定所述至少一个第二热点函数中的第二热点函数未被编译时,通过虚拟机运行前编译的方式将未被编译的第二热点函数编译为本地机器代码;When it is determined that the second hotspot function in the at least one second hotspot function is not compiled, compiling the uncompiled second hotspot function into local machine code by way of pre-compilation of the virtual machine;
    和,with,
    在确定所述至少一个第一热点函数中已被编译的第一热点函数不属于所述至少一个第二热点函数时,删除所述已编译的第一热点函数对应的本地机器代码。The local machine code corresponding to the compiled first hotspot function is deleted when it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function.
  5. 根据权利要求1-4任一项所述的方法,其中,所述根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数,包括:The method according to any one of claims 1 to 4, wherein the at least one first hotspot function in the target application is determined according to at least one first statistical value corresponding to the at least one function, include:
    判断每个函数对应的第一统计值是否达到第一预设统计阈值,若达到,则将所述每个函数确定为所述目标应用程序中的一个第一热点函数。Determining whether the first statistical value corresponding to each function reaches a first preset statistical threshold, and if so, determining each function as a first hotspot function in the target application.
  6. 根据权利要求1所述的方法,在所述从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值之前,还包括:The method according to claim 1, before the obtaining, by the preset server, the first statistic corresponding to each function in the target application, the method further includes:
    获取所述智能终端的用户的目标属性信息;Obtaining target attribute information of a user of the smart terminal;
    所述从预设服务器获取所述每个函数对应的第一统计值,包括:The obtaining, by the preset server, the first statistic value corresponding to each function, includes:
    从预设服务器中获取与所述目标属性信息相匹配的所述目标应用程序中的每个函数对应的第一统计值。And acquiring, from the preset server, a first statistic value corresponding to each function in the target application that matches the target attribute information.
  7. 根据权利要求1所述的方法,其中,当检测到所述智能终端首次开机时,所述目标应用程序包括所述智能终端中装载的所有应用程序;The method according to claim 1, wherein when it is detected that the smart terminal is powered on for the first time, the target application includes all applications loaded in the smart terminal;
    所述根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数,包括:Determining, according to the at least one first statistic value corresponding to the at least one function, the at least one first hotspot function in the target application, including:
    根据所有应用程序中的所有函数分别对应的第一统计值的综合排序确定所有应用程序中每个应用程序对应的至少一个第一热点函数。At least one first hotspot function corresponding to each application in all applications is determined according to a comprehensive ranking of the first statistical values corresponding to all functions in all applications.
  8. 根据权利要求3所述的方法,其中,所述根据所述至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数包括:判断每个函数对应的第二统计值是否达到第二预设统计阈值,若达到,则将所述每个函数确定为所述目标应用程序中的一个第二热点函数。The method of claim 3, wherein the determining the at least one second hotspot function in the target application based on the at least one second statistical value of the at least one function-to-one correspondence comprises: determining each function Whether the corresponding second statistical value reaches the second preset statistical threshold, and if so, determining each function as a second hotspot function in the target application.
  9. 一种编译优化方法,应用于服务器,包括:A compilation optimization method applied to a server, including:
    在第一预设统计周期内收集预设用户群体在使用应用程序过程中所述应用程序中的每个函数函数被执行的第一频次,根据所述每个函数被执行的第一频次计算出所述每个函数对应的第一统计值;其中,所述应用程序包括至少一个函数;Collecting, in a first preset statistical period, a first frequency that each function function in the application is executed by the preset user group during use of the application, and calculating according to the first frequency that each function is executed The first statistical value corresponding to each function; wherein the application includes at least one function;
    接收到智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求;Receiving, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to the at least one function in the application, wherein the smart terminal detects that the application is not running, to the The server sends the acquisition request;
    将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Sending, to the smart terminal, at least one first statistic value corresponding to the at least one function in the application, the at least one first statistic value is used to indicate that the smart terminal is configured according to the at least one A statistic determines at least one first hotspot function in the application and compiles each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
  10. 一种编译优化装置,配置于智能终端中,包括:A compiling and optimizing device is configured in the smart terminal, including:
    运行监测模块,设置为检测智能终端中是否存在未运行过的目标应用程序;其中,所述目标应用程序包括至少一个函数;Running a monitoring module, configured to detect whether there is an unoperated target application in the smart terminal; wherein the target application includes at least one function;
    第一统计值获取模块,设置为在检测到所述智能终端中存在未运行过的目标应用程序时,从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值,所述第一统计值包括根据所述每个函数对应的第一频次计算得到的统计值,所述第一频次包括第一预设统计周期内预设用户群体在使用所述目标应用程序过程中所述每个函数被执行的频次;a first statistic value obtaining module, configured to: when detecting that the target application program that is not running in the smart terminal exists, obtain a first statistic value corresponding to each function in the target application program from a preset server, where The first statistic value includes a statistic value calculated according to the first frequency corresponding to each function, where the first frequency includes a preset user group in the process of using the target application program in the first preset statistic period. Describe the frequency at which each function is executed;
    第一热点函数确定模块,设置为根据所述至少一个函数一一对应的至少一个第一统计值确定所述目标应用程序中的至少一个第一热点函数;The first hotspot function determining module is configured to determine at least one first hotspot function in the target application according to the at least one first statistic value corresponding to the at least one function;
    编译模块,设置为通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。Compile the module, set to compile each first hotspot function to native machine code by compiling the virtual machine before it runs.
  11. 根据权利要求10所述的装置,其中,每个函数对应的第一统计值通过以下方式确定:The apparatus of claim 10, wherein the first statistical value corresponding to each function is determined by:
    在第一预设统计周期内收集预设用户群体中的每个用户在使用所述目标应用程序过程中所述每个函数被执行的第一频次;其中,所述预设用户群体包括多个用户;Collecting, in a first preset statistical period, a first frequency that each function in the preset user group is executed during use of the target application; wherein the preset user group includes multiple user;
    在所述第一预设统计周期内获取所述预设用户群体中的每个用户对应的使用强度信息;Obtaining usage intensity information corresponding to each user in the preset user group in the first preset statistical period;
    根据所述每个用户对应的使用强度信息确定所述每个用户对应的第一权重系数,并根据所述多个用户一一对应的多个第一权重系数和所述多个用户一一对应的多个第一频次进行加权平均运算,得到所述每个函数对应的第一统计值。Determining, according to the usage intensity information corresponding to each user, a first weighting coefficient corresponding to each user, and correspondingly corresponding to the plurality of users according to the plurality of first weighting coefficients corresponding to the plurality of users The plurality of first frequencies are subjected to a weighted averaging operation to obtain a first statistic value corresponding to each of the functions.
  12. 根据权利要求10或11所述的装置,还包括:第二统计值获取模块,设置为:在所述通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码之后,在第二预设统计周期内记录所述智能终端的用户在使用所述目标应用程序过程中所述目标应用程序中的每个函数被执行的第二频次,根据预设权重系数、所述第一统计值和所述第二频次进行加权平均运算,得到所述每个函数对应的第二统计值,其中,所述预设权重系数包括第一预设权重系数和第二预设权重系数,所述第一统计值对应所述第一预设权重系数,所述第二频次对应所述第二预设权重系数;The apparatus according to claim 10 or 11, further comprising: a second statistic value obtaining module, configured to: after compiling each first hotspot function into local machine code in a manner of compiling by the virtual machine before running, Recording, in a second preset statistical period, a second frequency in which each function in the target application is executed by a user of the smart terminal during use of the target application, according to a preset weight coefficient, the first And performing a weighted averaging operation on the second frequency to obtain a second statistic value corresponding to each function, where the preset weight coefficient includes a first preset weight coefficient and a second preset weight coefficient, The first statistic value corresponds to the first preset weight coefficient, and the second frequency corresponds to the second preset weight coefficient;
    第二热点函数确定模块,设置为:根据所述至少一个函数一一对应的至少一个第二统计值确定所述目标应用程序中的至少一个第二热点函数;a second hotspot function determining module, configured to: determine at least one second hotspot function in the target application according to the at least one second statistic value corresponding to the at least one function;
    编译策略更新模块,设置为:根据所述至少一个第二热点函数对所述目标应用程序的编译策略进行更新。Compiling a policy update module, configured to: update a compilation policy of the target application according to the at least one second hotspot function.
  13. 根据权利要求12所述的装置,其中,所述编译策略更新模块,是设置为进行以下操作中的至少之一:在确定所述至少一个第二热点函数中的第二热点函数未被编译时,通过虚拟机运行前编译的方式将未被编译的第二热点函数编译为本地机器代码;The apparatus of claim 12, wherein the compilation policy update module is configured to perform at least one of: when determining that the second hotspot function in the at least one second hotspot function is not compiled Compiling the uncompiled second hotspot function into local machine code by compiling the virtual machine before running;
    和,with,
    在确定所述至少一个第一热点函数中已被编译的第一热点函数不属于所述至少一个第二热点函数时,删除所述已编译的第一热点函数对应的本地机器代码。The local machine code corresponding to the compiled first hotspot function is deleted when it is determined that the first hotspot function that has been compiled in the at least one first hotspot function does not belong to the at least one second hotspot function.
  14. 根据权利要求10-13任一项所述的装置,其中,所述第一热点函数确定模块是设置为:判断每个函数对应的第一统计值是否达到第一预设统计阈值,若达到,则将所述每个函数确定为所述目标应用程序中的一个第一热点函数。The device according to any one of claims 10 to 13, wherein the first hotspot function determining module is configured to: determine whether a first statistical value corresponding to each function reaches a first preset statistical threshold, and if so, Each of the functions is then determined as a first hotspot function in the target application.
  15. 根据权利要求10所述的装置,还包括:属性信息获取模块,设置为在所述从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值之前,获取所述智能终端的用户的目标属性信息;The apparatus according to claim 10, further comprising: an attribute information acquiring module, configured to acquire the smart terminal before acquiring the first statistic value corresponding to each function in the target application from the preset server Target attribute information of the user;
    所述第一统计值获取模块是设置为通过如下方式从预设服务器获取所述目标应用程序中的每个函数对应的第一统计值:从预设服务器中获取与所述目标属性信息相匹配的所述目标应用程序中的每个函数对应的第一统计值。The first statistic value obtaining module is configured to acquire, by using a preset server, a first statistic value corresponding to each function in the target application program: obtaining, by using a preset server, matching the target attribute information The first statistical value corresponding to each function in the target application.
  16. 根据权利要求10所述的装置,其中,当检测到所述智能终端首次开机时,所述目标应用程序包括所述智能终端中装载的所有应用程序;The apparatus according to claim 10, wherein when it is detected that the smart terminal is powered on for the first time, the target application includes all applications loaded in the smart terminal;
    所述第一热点函数确定模块是设置为:根据所有应用程序中的所有函数分别对应的第一统计值的综合排序确定所有应用程序中每个应用程序对应的至少一个第一热点函数。The first hotspot function determining module is configured to: determine, according to a comprehensive sorting of the first statistical values corresponding to all the functions in all the applications, at least one first hotspot function corresponding to each application in all the applications.
  17. 一种编译优化装置,配置于服务器中,包括:A compiler optimization device, configured in the server, comprising:
    统计值计算模块,设置为在第一预设统计周期内收集预设用户群体在使用所述应用程序过程中所述应用程序中的每个函数被执行的第一频次,根据所述每个函数被执行的第一频次计算出所述每个函数对应的第一统计值;其中,所述应用程序包括至少一个函数;a statistical value calculation module, configured to collect, during a first preset statistical period, a first frequency that the preset user group is executed in each of the applications in the process of using the application, according to each function Calculating, by the first frequency, a first statistical value corresponding to each function; wherein the application program includes at least one function;
    获取请求接收模块,设置为接收智能终端获取所述应用程序中所述至少一个函数一一对 应的至少一个第一统计值的获取请求,其中,所述智能终端在检测到所述应用程序未运行过时,向所述服务器发送所述获取请求;Obtaining a request receiving module, configured to receive, by the smart terminal, an acquisition request for acquiring at least one first statistic value corresponding to the at least one function in the application, wherein the smart terminal detects that the application is not When the operation is out of date, the acquisition request is sent to the server;
    统计值发送模块,设置为在接收到所述智能终端获取所述应用程序中所述至少一个函数一一对应的至少一个第一统计值的获取请求时,将所述应用程序中所述至少一个函数一一对应的至少一个第一统计值发送至所述智能终端,所述至少一个第一统计值用于指示所述智能终端根据所述至少一个第一统计值确定所述应用程序中的至少一个第一热点函数,并通过虚拟机运行前编译的方式将每个第一热点函数编译为本地机器代码。And a statistical value sending module, configured to: when the smart terminal acquires an acquisition request of the at least one first statistic value corresponding to the at least one function in the application, Transmitting at least one first statistic value corresponding to a function to the smart terminal, the at least one first statistic value is used to indicate that the smart terminal determines the application according to the at least one first statistic value At least one first hotspot function, and compiling each first hotspot function into local machine code by way of pre-compilation of the virtual machine.
  18. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-9中任一所述的编译优化方法。A computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the compilation optimization method of any of claims 1-9.
  19. 一种智能终端,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1-8任一所述的编译优化方法。An intelligent terminal comprising a memory, a processor, and a computer program stored on the memory and operable by the processor, the processor executing the computer program to implement the compiling optimization method according to any one of claims 1-8 .
  20. 一种服务器,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求9所述的编译优化方法。A server comprising a memory, a processor, and a computer program stored on the memory and executable by the processor, the processor executing the computer program to implement the compiler optimization method of claim 9.
PCT/CN2018/116586 2017-12-14 2018-11-21 Compilation optimization method and device, storage medium, intelligent terminal and server WO2019114506A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711341481.2A CN109960507B (en) 2017-12-14 2017-12-14 Compiling optimization method and device, storage medium, intelligent terminal and server
CN201711341481.2 2017-12-14

Publications (1)

Publication Number Publication Date
WO2019114506A1 true WO2019114506A1 (en) 2019-06-20

Family

ID=66818934

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116586 WO2019114506A1 (en) 2017-12-14 2018-11-21 Compilation optimization method and device, storage medium, intelligent terminal and server

Country Status (2)

Country Link
CN (1) CN109960507B (en)
WO (1) WO2019114506A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116382702A (en) * 2023-06-06 2023-07-04 湖南天河国云科技有限公司 Intelligent contract hot spot detection method and device, electronic equipment and storage medium
CN116661909A (en) * 2023-08-01 2023-08-29 北京小米移动软件有限公司 Application program running method and device, terminal equipment and storage medium

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110543338A (en) * 2019-09-09 2019-12-06 北京安云世纪科技有限公司 dynamic loading method and device for files
CN112783500B (en) * 2019-11-08 2024-01-05 Oppo广东移动通信有限公司 Method and device for generating compiling optimization information and electronic equipment
CN112783499A (en) * 2019-11-08 2021-05-11 Oppo广东移动通信有限公司 Application program pre-compiling method and device, electronic equipment and server
CN111061483B (en) * 2019-11-28 2023-12-01 Oppo广东移动通信有限公司 Compiling optimization method and device and electronic equipment
CN110941424B (en) * 2019-11-28 2023-06-13 Oppo广东移动通信有限公司 Compiling parameter optimization method and device and electronic equipment
CN113031953A (en) * 2019-12-09 2021-06-25 Oppo广东移动通信有限公司 Application program pre-compiling method and device, electronic equipment and server
CN112988169A (en) * 2019-12-13 2021-06-18 Oppo广东移动通信有限公司 Application installation method and device, terminal equipment, server and storage medium
CN113032035B (en) * 2019-12-24 2022-07-12 Oppo广东移动通信有限公司 Configuration file processing method and device and electronic equipment
CN113031955A (en) * 2019-12-24 2021-06-25 Oppo广东移动通信有限公司 Application program pre-compiling method and device and electronic equipment
CN113126994A (en) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 Hotspot code processing method and device, electronic equipment and storage medium
CN113127047A (en) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 Hot spot code processing method and device, server and storage medium
CN113126995A (en) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 Hotspot code processing method, request method and device and electronic equipment
CN112148386A (en) * 2020-10-12 2020-12-29 Oppo广东移动通信有限公司 Application loading method and device and computer readable storage medium
CN112540767B (en) * 2020-12-25 2023-07-25 北京百度网讯科技有限公司 Program code generation method and device, electronic equipment and storage medium
CN112631609A (en) * 2021-01-05 2021-04-09 北京字节跳动网络技术有限公司 Compiling method, device, terminal and storage medium
CN112929449B (en) * 2021-03-10 2023-04-07 深圳创维-Rgb电子有限公司 OTA upgrade package compiling method, system and computer readable storage medium
CN113886251B (en) * 2021-09-30 2023-04-11 四川大学 Hot spot function determination method based on thermodynamic diagram

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794004A (en) * 2015-03-17 2015-07-22 中国石油天然气集团公司 Information pre-loading method
CN106406966A (en) * 2016-10-31 2017-02-15 维沃移动通信有限公司 Preloading method for application and mobile terminal
CN106648747A (en) * 2016-11-14 2017-05-10 腾讯科技(深圳)有限公司 Method and device for processing pre-loading of process
CN106775893A (en) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 To the method and device of program precompile
CN107193610A (en) * 2017-05-31 2017-09-22 广东欧珀移动通信有限公司 A kind of loading method of dynamic base, device, terminal device and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0125176D0 (en) * 2001-10-19 2001-12-12 Koninkl Philips Electronics Nv A method of compiling bytecode to native code
US8832672B2 (en) * 2011-01-28 2014-09-09 International Business Machines Corporation Ensuring register availability for dynamic binary optimization
US8880991B2 (en) * 2011-04-21 2014-11-04 Qualcomm Innovation Center, Inc. Methods and apparatus for improved browsing performance by precompilation of high-priority JavaScripts in a webpage and delaying the removal of corresponding compiled code
US10324741B2 (en) * 2014-08-30 2019-06-18 Oracle International Corporation Speeding up dynamic language execution on a virtual machine with type speculation
US10129359B2 (en) * 2016-01-20 2018-11-13 Google Llc Methods and apparatus to selectively provide cached and presently compiled applications
CN106201611B (en) * 2016-07-07 2019-07-23 北京小米移动软件有限公司 Run the method and device of application

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794004A (en) * 2015-03-17 2015-07-22 中国石油天然气集团公司 Information pre-loading method
CN106406966A (en) * 2016-10-31 2017-02-15 维沃移动通信有限公司 Preloading method for application and mobile terminal
CN106648747A (en) * 2016-11-14 2017-05-10 腾讯科技(深圳)有限公司 Method and device for processing pre-loading of process
CN106775893A (en) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 To the method and device of program precompile
CN107193610A (en) * 2017-05-31 2017-09-22 广东欧珀移动通信有限公司 A kind of loading method of dynamic base, device, terminal device and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116382702A (en) * 2023-06-06 2023-07-04 湖南天河国云科技有限公司 Intelligent contract hot spot detection method and device, electronic equipment and storage medium
CN116382702B (en) * 2023-06-06 2023-08-18 湖南天河国云科技有限公司 Intelligent contract hot spot detection method and device, electronic equipment and storage medium
CN116661909A (en) * 2023-08-01 2023-08-29 北京小米移动软件有限公司 Application program running method and device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN109960507B (en) 2021-06-08
CN109960507A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
WO2019114506A1 (en) Compilation optimization method and device, storage medium, intelligent terminal and server
CN111061484B (en) Code compiling method, device, server, user terminal and readable medium
KR101790190B1 (en) Application scenario identification method, power consumption management method, apparatus, and terminal device
WO2019223510A1 (en) Application program preloading method and apparatus, storage medium, and mobile terminal
CN106970790B (en) Application program creating method, related equipment and system
US20190370657A1 (en) Method and apparatus for updating application prediction model, storage medium, and terminal
CN111736980B (en) Memory management method and device
US10241718B2 (en) Electronic device and method of analyzing fragmentation of electronic device
CN108038231B (en) Log processing method and device, terminal equipment and storage medium
US20140229848A1 (en) Provision of a user interface based on user interaction with a computing device
WO2019223511A1 (en) Application program preloading method and apparatus, storage medium, and terminal
US11269663B2 (en) Method and apparatus for adapting handle device to third-party application, and storage medium
WO2018045934A1 (en) Application process management method and terminal device
WO2021143338A1 (en) Live broadcast room page loading method and apparatus, and terminal, server and storage medium
US20200404046A1 (en) Application Download Method and Apparatus, Application Sending Method and Apparatus, and System
CN109491736B (en) Display method and device of pop-up frame window
US10209915B2 (en) Electronic device and file read and write method thereof
CN109948090B (en) Webpage loading method and device
TW201441934A (en) Method and device for updating client
CN110222288B (en) Page display method, device and storage medium
WO2020062985A1 (en) Block device access tracking method and apparatus, storage medium and terminal
WO2021115177A1 (en) Application installation method and apparatus, terminal device, server and storage medium
CN109144834B (en) User behavior data acquisition method and device, android system and terminal equipment
US11662992B2 (en) Algorithm downloading method, device, and related product
US10530732B2 (en) Method for using a content subscription list and electronic device supporting the same

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: 18888266

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: 18888266

Country of ref document: EP

Kind code of ref document: A1