Application pre-compilation method, device, electronic device and server

By obtaining and fusion of the configuration files of the target application, extracting and pre-compiling the hotspot compilation units, the problems of slow optimization process and dispersed functional modules in the existing technology are solved, and more efficient application operation and optimization are achieved.

CN112783499BActive Publication Date: 2025-01-14GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201911087183.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-08
Publication Date
2025-01-14
Estimated Expiration
2039-11-08

AI Technical Summary

Technical Problem

In the application compilation optimization, the prior art relies on user usage frequency statistics, resulting in a slow optimization process, and the hot-spot compilation units are scattered in different functional modules, making it difficult to centrally optimize common functions.

Method used

By obtaining the target application configuration files of multiple electronic devices, the fused process is integrated to extract the hotspot compilation units of the target functional module, a second configuration file is generated, and these hotspot compilation units are precompiled before the target application is run.

Benefits of technology

It improves the operation efficiency and optimization efficiency of application function modules, reduces the time of the optimization process, and concentrates on optimizing commonly used functional modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112783499B_ABST
    Figure CN112783499B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, electronic device and server for pre-compiling an application. The method includes: obtaining multiple first configuration files corresponding to a target application, obtaining multiple target hotspot compilation units based on multiple hotspot compilation units recorded in the multiple first configuration files, the multiple target hotspot compilation units including hotspot compilation units belonging to a target functional module in the target application, generating a second configuration file including multiple target hotspot compilation units for pre-compiling multiple target hotspot compilation units before the target functional module runs. Thus, through this method, the hotspot compilation unit associated with the target functional module in the target application can be compiled in advance before the target functional module runs, so that the operating efficiency of the target functional module can be improved, and the efficiency of optimizing the operating efficiency of the target functional module is also improved at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a method, device, electronic device and server for pre-compiling an application program. Background Art

[0002] In electronic devices, the operating efficiency of applications can be improved to a certain extent by pre-compiling. However, in the relevant compilation methods, which compilation units are pre-compiled is determined based on the calling frequency or loop number of the compilation unit, which cannot effectively achieve fast optimization in the application. Summary of the invention

[0003] In view of the above problems, the present application proposes a method, device, electronic device and server for pre-compiling an application program to improve the above problems.

[0004] In a first aspect, the present application provides a method for pre-compiling an application, the method comprising: obtaining multiple first configuration files corresponding to a target application, the first configuration files being used to record hotspot compilation units of the target application; obtaining multiple target hotspot compilation units based on the multiple hotspot compilation units recorded in the multiple first configuration files, the multiple target hotspot compilation units including hotspot compilation units associated with target functional modules in the target application; generating a second configuration file including the multiple target hotspot compilation units; and pre-compiling the multiple target hotspot compilation units based on the second configuration file.

[0005] In a second aspect, the present application provides a method for pre-compiling an application, which is applied to an electronic device, and the method includes: obtaining a second configuration file, where the second configuration file is generated by a server based on the above-mentioned method; when it is detected that the electronic device meets specified conditions, running the second configuration file to compile the hotspot compilation unit in the second configuration file.

[0006] In a third aspect, the present application provides an application pre-compilation device, the device comprising: a file acquisition unit, used to acquire multiple first configuration files corresponding to a target application, the multiple first configuration files are used to record the hotspot compilation units of the target application installed in the electronic devices to which they belong, the hotspot compilation units being compilation units that allow advance compilation before the target application runs; a compilation unit processing unit, used to acquire multiple target hotspot compilation units based on the multiple hotspot compilation units recorded in the multiple first configuration files, the multiple target hotspot compilation units including hotspot compilation units belonging to target functional modules in the target application; a file generation unit, used to generate a second configuration file including the multiple target hotspot compilation units; a pre-compilation unit, used to pre-compile the multiple target hotspot compilation units based on the second configuration file.

[0007] In a fourth aspect, the present application provides a device for pre-compiling an application, which runs on an electronic device, and the device includes: a file acquisition unit, used to obtain a second configuration file, and the second configuration file is obtained based on the processing of the above-mentioned device; a file processing unit, used to run the second configuration file when it is detected that the electronic device meets specified conditions, so as to compile the hotspot compilation unit in the second configuration file.

[0008] In a fifth aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.

[0009] In a sixth aspect, the present application provides a computer-readable storage medium, in which a program code is stored, wherein the above method is executed when the program code is run.

[0010] The present application provides a method, device, electronic device and server for pre-compiling an application program, which obtains a first configuration file corresponding to a target application program installed in each of multiple electronic devices, so as to obtain a plurality of first configuration files for recording hotspot compilation units of the target application program installed in each of the electronic devices, obtains a plurality of target hotspot compilation units belonging to a target function module in the target application program from the plurality of hotspot compilation units included in the plurality of first configuration files, and generates a second configuration file including the plurality of target hotspot compilation units. Thus, through this method, the hotspot compilation unit associated with the target function module in the target application program can be compiled in advance before the target function module is run, so that the operating efficiency of the target function module can be improved, and the efficiency of optimizing the operating efficiency of the target function module is also improved at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0012] Figure 1 A schematic diagram of an operating environment of a method for pre-compiling an application program proposed in an embodiment of the present application is shown;

[0013] Figure 2 A schematic diagram of an operating environment of another application pre-compilation method proposed in an embodiment of the present application is shown;

[0014] Figure 3 A flowchart of a method for precompiling an application program proposed in an embodiment of the present application is shown;

[0015] Figure 4 A flowchart of a method for precompiling an application program proposed in another embodiment of the present application is shown;

[0016] Figure 5 A flowchart of obtaining multiple target hotspot compilation units in a method for pre-compiling an application program proposed in another embodiment of the present application is shown;

[0017] Figure 6 A schematic diagram showing a probability model matrix in a method for pre-compiling an application program proposed in another embodiment of the present application is shown;

[0018] Figure 7 A schematic diagram showing a probability model in a method for pre-compiling an application program proposed in another embodiment of the present application is shown;

[0019] Figure 8 A flowchart of a method for precompiling an application program proposed in another embodiment of the present application is shown;

[0020] Fig. 9 A flowchart of a method for precompiling an application program proposed in another embodiment of the present application is shown;

[0021] Fig.10 A structural block diagram of a device for pre-compiling an application program proposed in the present application is shown;

[0022] Fig.11 A structural block diagram of another application pre-compilation device proposed in the present application is shown;

[0023] Fig.12A structural block diagram of another application pre-compilation device proposed in the present application is shown;

[0024] Fig.13 A structural block diagram of an electronic device of the present application for executing a method for precompiling an application according to an embodiment of the present application is shown.

[0025] Fig.14 It is a storage unit of an embodiment of the present application for storing or carrying a program code for implementing the image processing method according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0027] With the development of the operation mode of applications in electronic devices, applications in electronic devices can be directly interpreted and executed by an interpreter at runtime, and the number of calls and loops of each compilation unit is recorded during the execution process. When the number of calls and loops exceeds the set threshold, the corresponding compilation unit is recorded as a hot compilation unit. Among them, the compilation unit can be understood as a function, method or class in the source code of the application.

[0028] Furthermore, the hotspot compilation unit will be identified and compiled by JIT (Just In Time) and stored to generate a profile file to record the information of the hotspot compilation unit. In this case, when the electronic device enters the idle or charging state, the system of the electronic device will scan the profile file and perform the AOT (Ahead Of Time) process for compilation.

[0029] However, the inventors found in their research on this method that this method relies on the electronic device optimizing the application according to the profile file in idle mode, and because the content of the compilation unit in the profile file is related to the number of times the user uses the application, this optimization method generally achieves the best performance after the user installs or updates the application for a period of time (maybe several days). Furthermore, the inventors also found in their further research that in this related method, the compilation units stored in the profile file corresponding to the application are usually scattered in different functional modules, which is not conducive to the centralized optimization of certain commonly used functions.

[0030] Therefore, the application provides a method, device, electronic device and server for pre-compilation of an application, so that the hotspot compilation unit associated with the target functional module in the target application can be compiled in advance before the target functional module is run, so that the operating efficiency of the target functional module can be improved, and the efficiency of optimizing the operating efficiency of the target functional module can also be improved at the same time.

[0031] The following first introduces a scenario involved in an embodiment of the present application.

[0032] See also Figure 1 ,exist Figure 1 The scenario involved includes multiple electronic devices 100 and a server 200. The multiple electronic devices 100 perform data exchange with the server 200 through a network.

[0033] The target application is running on multiple electronic devices 100, and a configuration file (which may be the aforementioned profile file) 120 is generated corresponding to the target application running on each electronic device 100. In one mode, the multiple electronic devices 100 may upload the configuration files 120 of the target application installed by themselves to the server 200, so that the server may obtain multiple configuration files 120 corresponding to the target application, and then perform fusion processing on the multiple configuration files 120, extract the hotspot compilation unit to which the designated functional module of the target application belongs, store the extracted hotspot compilation unit in the newly generated configuration file 210, and then return the configuration file 210 to the multiple electronic devices 100.

[0034] In addition, if Figure 2 As shown, the server 220 can also directly send the program installation package 230 including the configuration file 210 and the installation program 220 of the target application to the electronic device 130 that has not yet installed the target application, so that when the electronic device 130 installs the target application, it can obtain the configuration file 210 that can directly optimize the operating efficiency of the specified functional modules in the target application.

[0035] It should be noted that in Figure 2 In the environment shown, the server that collects multiple configuration files 120 and processes the multiple configuration files 120 to obtain the configuration file 210 may be a single server or a server cluster. In addition, the server that collects multiple configuration files 120 and processes the multiple configuration files 120 to obtain the configuration file 210 may be a different server from the server that subsequently issues the program installation package 230.

[0036] Furthermore, the first configuration file mentioned in the subsequent embodiments may be the configuration file 120, and the second configuration file mentioned may be the newly generated configuration file 210. The hotspot compilation unit in the newly generated configuration file 210 may be a hotspot compilation unit compiled by the server 200, or may be a hotspot compilation unit that has not been compiled yet. In the case where the hotspot compilation unit in the newly generated configuration file 210 is a hotspot compilation unit that has not been compiled yet, the electronic device that receives the newly generated configuration file 210 may compile it before running the target application, or may compile it when installing the target application.

[0037] The content of this application will be introduced below in conjunction with specific embodiments.

[0038] See also Figure 3 The present application provides a method for precompiling an application program, which is applied to a server and includes:

[0039] Step S110: Acquire multiple first configuration files corresponding to the target application, wherein the multiple first configuration files are used to record hotspot compilation units of the target application installed in their respective electronic devices, wherein the hotspot compilation units are compilation units that allow advance compilation before the target application runs.

[0040] It should be noted that multiple applications can be run in an electronic device. And each application can be configured with a corresponding configuration file during the running process. The configuration file is used to record the hotspot compilation unit of the corresponding application during the running process. Exemplarily, application A, application B and application C are installed in the electronic device. Then application A can correspond to a corresponding configuration file a, and application B can correspond to a corresponding configuration file b, and application C can correspond to a corresponding configuration file c. Then in this case, the hotspot compilation unit of application A is recorded in configuration file a, the hotspot compilation unit of application B is recorded in configuration file b, and the hotspot compilation unit of application C is recorded in configuration file c. Among them, the applications installed for different electronic devices can be different or the same. For example, application A, application B and application C can be installed on multiple electronic devices.

[0041] It can be understood that the target application is the application to which the configuration file belongs that will perform subsequent steps of processing. In the embodiment of the present application, the server can determine the target application in a variety of ways.

[0042] As a method, the server can use applications with a large number of installations as target applications. Optionally, the electronic device can periodically upload application installation information to the server, and the application installation information includes applications currently installed by the electronic device. Then the server can collect statistics on application installation information regularly uploaded by multiple electronic devices, and if it is detected that the installation volume of a certain application is greater than the installation threshold, the application with the installation volume greater than the installation threshold can be used as the target application.

[0043] For example, there are 100 electronic devices that have uploaded application installation information to the server, and 90 of them have application A installed. If the installation threshold is 80, the server can use application A as the target application. In this way, the server can optimize the operating efficiency of applications with a large number of installations in a timely manner.

[0044] As another way, the electronic device can determine the target application based on the installation volume and the size of the corresponding configuration file. It should be noted that different applications have different configuration files of different sizes due to their own functions or operating frequencies, and the electronic device needs to consume certain resources and time to compile the hotspot compilation units in the configuration file in advance before the application runs. For applications with smaller configuration files, it can be determined that their operating frequency may be lower, and the server can not process the configuration files belonging to these applications with lower operating frequencies. Correspondingly, in this way, the application installation information reported by the electronic device can include the size of the configuration file to which each application belongs in addition to the installed applications. When the server detects that the size of the configuration file to which the same application belongs in multiple electronic devices is greater than the specified threshold, the same application can be used as the target application.

[0045] For example, there are 100 electronic devices that have uploaded application installation information to the server, and 90 of them have application A installed. Then, each of the 90 electronic devices has a configuration file for application A installed (that is, it can be understood that there are 90 configuration files). If the server recognizes that 80 of its 90 configuration files are less than 1kb, then when the installation threshold is 80, the specified threshold is 10kb, and the threshold number is 50, the server will not use application A as the target application. However, if the server recognizes that 60 of the 90 configuration files (greater than the threshold number 50) are 11-12kb in size (greater than the specified threshold 10kb), then it can be determined that application A is the target application.

[0046] As another way, the server can also determine the target application based on the configuration information. In this way, which applications are target applications can be determined by manual configuration. Exemplarily, the server can use the applications involved in the application installation information reported by multiple electronic devices as candidate applications, and the operator can select one or more applications from the candidate applications as selected applications. Correspondingly, the server stores the selected applications in a configuration file. In this case, the server can use the applications configured in the configuration file as target applications.

[0047] After determining the target application based on the above method, the server can further use the writing information file of the target application as the first configuration file. In the embodiment of the present application, the multiple first configuration files corresponding to the target application can be understood as the configuration files of the same target application installed in multiple electronic devices.

[0048] Step S120: Acquire multiple target hotspot compiling units based on the multiple hotspot compiling units recorded in the multiple first configuration files, wherein the multiple target hotspot compiling units include hotspot compiling units belonging to target functional modules in the target application.

[0049] It should be noted that even if the configuration files belong to the same application, because the same application is running on different electronic devices, the multiple hotspot compilation units included in each of the multiple first configuration files may also be different. It is understandable that an application usually includes multiple functions, and different functions are implemented by different functional modules. For example, application A may include a camera function, an instant messaging function, and a picture editing function. Then the camera function is implemented by the camera module, the instant messaging function is implemented by the instant messaging module, and the picture editing function is implemented by the picture editing module.

[0050] However, the hotspot compilation units in the configuration files to which the application A running on different electronic devices belongs may be different due to the user's usage habits. For example, if electronic device A, electronic device B, and electronic device C are each installed with application A. The user of electronic device A likes to use the camera function, the user of electronic device B likes to use the instant messaging function, and the user of electronic device C likes to use the picture editing function. Then in this case, in electronic device A, the configuration file to which application A belongs contains more hotspot compilation units about the camera function module. In electronic device B, the configuration file to which application A belongs contains more hotspot compilation units about the instant messaging function module. In electronic device C, the configuration file to which application A belongs contains more hotspot compilation units about the picture editing function module.

[0051] Then, after the server obtains multiple first configuration files corresponding to the target application, it can read the compilation information units from the multiple first configuration files respectively to obtain multiple hotspot compilation units. Exemplarily, the multiple first configuration files obtained by the server include configuration file A, configuration file B and configuration file C. Among them, configuration file A includes hotspot compilation unit a1, hotspot compilation unit a2 and hotspot compilation unit a3. Configuration file B includes hotspot compilation unit b1, hotspot compilation unit b2, hotspot compilation unit b3 and hotspot compilation unit b4. Configuration file C includes hotspot compilation unit c1, hotspot compilation unit c2 and hotspot compilation unit c3. Then in this case, the multiple hotspot compilation units obtained include hotspot compilation unit a1, hotspot compilation unit a2, hotspot compilation unit a3, hotspot compilation unit b1, hotspot compilation unit b2, hotspot compilation unit b3, hotspot compilation unit b4, hotspot compilation unit c1, hotspot compilation unit c2 and hotspot compilation unit c3. In addition, fewer hotspot compilation units may also be included.

[0052] It should be noted that, in the embodiment of the present application, the target hotspot compilation unit obtained is a hotspot compilation unit belonging to a specified functional module. In the embodiment of the present application, the server can determine the target hotspot compilation unit in a variety of ways.

[0053] As a method, the server can sequentially calculate the probability that any two hotspot compilation units among the multiple hotspot compilation units obtained based on the multiple first configuration files appear in the same configuration file, obtain multiple calculated probabilities, and then convert the calculated probabilities into a probability model, so as to take the hotspot compilation units that appear together with a higher probability as a set, and obtain multiple sets of hotspot compilation units. It should be noted that the hotspot compilation units that appear together with a higher probability can represent the hotspot compilation units belonging to the same functional module. In this case, the hotspot compilation units in the same set represent the hotspot compilation units belonging to the same functional module, and the functional module corresponding to each set is the specified functional module. Optionally, among the multiple sets obtained, only the sets in which the number of included hotspot compilation units is greater than the specified number are retained, and each set represents the functional module with a higher frequency of use. Therefore, based on the joint probability of the hotspot compilation units, the hotspot compilation units belonging to the functional modules with higher video frequencies are obtained, so as to facilitate the unified compilation of the hotspot compilation units belonging to the functional modules with higher usage frequencies in the subsequent implementation. At the same time, it is also possible to estimate the hotspot compilation units belonging to the same functional module based on the correlation between any two hotspot compilation units (in one method, the greater the joint probability, the higher the correlation, and if the correlation is higher than a specified correlation threshold, it is determined to belong to the same functional module).

[0054] As another way, each function of the application will correspond to an operation interface, and the operation interface will correspond to an interface identifier. In this case, when the electronic device generates a configuration file belonging to a certain application, it can also generate a corresponding function module frequency file. The function module frequency file is used to record the usage frequency of each function module of the application to which it belongs. In this case, when the server obtains multiple first configuration files corresponding to the target application, it can also simultaneously obtain multiple function module frequency files corresponding to the target application, and then calculate which function modules in the target application are the function modules with high overall usage frequency based on the multiple function module frequency files, and then use the function modules with high usage frequency as designated function modules, so that the target hotspot compilation unit belonging to the function module with high usage frequency can be obtained from the multiple hotspot compilation units obtained based on the multiple first configuration files.

[0055] Step S130: Generate a second configuration file including the plurality of target hotspot compilation units.

[0056] Step S140: pre-compile the plurality of target hotspot compilation units based on the second configuration file.

[0057] The present application provides a method for pre-compiling an application program, which obtains a first configuration file corresponding to a target application program installed in each of a plurality of electronic devices, so as to obtain a plurality of first configuration files for recording hotspot compilation units of the target application program installed in each of the electronic devices, obtains a plurality of target hotspot compilation units belonging to a target function module in the target application program from the plurality of hotspot compilation units included in the plurality of first configuration files, and generates a second configuration file including the plurality of target hotspot compilation units. Thus, the hotspot compilation unit associated with the target function module in the target application program can be compiled in advance before the target function module is run before the target application program is run, so that the operating efficiency of the target function module can be improved, and the efficiency of optimizing the operating efficiency of the target function module is also improved at the same time.

[0058] See also Figure 4 The present application provides a method for precompiling an application program, which is applied to a server and includes:

[0059] Step S210: Acquire multiple first configuration files corresponding to the target application, wherein the multiple first configuration files are used to record hotspot compilation units of the target application installed in their respective electronic devices, wherein the hotspot compilation units are compilation units that allow advance compilation before the target application runs.

[0060] Step S220: Calculate a joint probability between any two hotspot coding units among the multiple hotspot coding units included in the multiple first configuration files, where the joint probability represents a probability that the any two hotspot coding units appear in the same first configuration file.

[0061] As a method, the server may first obtain the number of times t that any two coding units appear in the same profile file, and then divide the number t by N to obtain the joint probability of the occurrence of any two coding units, where N is the number of multiple hotspot coding units included in the multiple first profiles.

[0062] Step S230: obtaining a plurality of target hotspot compilation units based on the joint probability calculation, wherein the plurality of target hotspot compilation units include hotspot compilation units belonging to target functional modules in the target application.

[0063] As a way, Figure 5 As shown, the step of obtaining multiple target hotspot compilation units based on the joint probability calculation includes:

[0064] Step S231: Generate a joint probability matrix based on the multiple hotspot coding units included in the multiple first configuration files.

[0065] For example, see Figure 6 , if the multiple hot coding units included in the multiple first configuration files include hot coding units such as Unit_a, Unit_b, Unit_c, Unit_d, Unit_e, Unit_m, Unit_o, and Unit_p, then the generated joint probability matrix can be as follows Figure 6 As shown. The area where any two hotspot coding units intersect each other is the joint probability of the any two hotspot coding units. For example, the intersection area 99 is the joint probability between Unit_a and Unit_p, and the intersection area 98 is the joint probability between Unit_d and Unit_p.

[0066] For example, in Figure 6 In the probability matrix shown, each intersection area can correspond to a position coordinate, so that the server can obtain the joint probability corresponding to each intersection area. Among them, i can be used as the horizontal coordinate and j as the vertical coordinate. In this case, if the coordinates of any two compilation units are (i, j) and (j, i), the number of times the corresponding two compilation units (i, j) appear in the same first configuration file is n i,j , then the server can obtain the joint probability of the occurrence of any two compilation units as

[0067] Step S232: converting the joint probability matrix into a probability graph model, wherein each vertex in the probability graph model represents a hotspot coding unit, and the edges between adjacent hotspot coding units represent the joint probability that the adjacent hotspot coding units appear in the same configuration file.

[0068] For example, see Figure 7 , Figure 7 A probabilistic graph model is exemplarily shown in . In this model, there are nodes a, b, c, d, e, m, o and p. Each node guarantees a hotspot compilation unit, for example, node a represents the hotspot compilation unit Unit_a, node b represents the hotspot compilation unit Unit_b, node c represents the hotspot compilation unit Unit_c, node d represents the hotspot compilation unit Unit_d, node e represents the hotspot compilation unit Unit_e, node m represents the hotspot compilation unit Unit_m, node p represents the hotspot compilation unit Unit_p, and node o represents the hotspot compilation unit Unit_o.

[0069] Step S233: Obtain multiple complete subgraphs by performing a complete subgraph query on the probabilistic graph model, wherein the nodes of each complete subgraph represent hot compilation units in the same functional module belonging to the target application, and the functional modules corresponding to the multiple complete subgraphs are target functional modules.

[0070] Among them, optionally, the step of obtaining multiple complete subgraphs by performing a complete subgraph query on the probability graph model includes: performing a complete subgraph query to obtain the maximum complete subgraph in the probability graph model corresponding to the current search process, wherein the probability graph model corresponding to the first search process is the probability graph model obtained by converting the joint probability matrix; removing the maximum complete subgraph from the probability graph model corresponding to the current search process, and obtaining the probability graph model corresponding to the next search process, so as to obtain multiple complete subgraphs.

[0071] In this way, before performing the complete subgraph query, the method further includes: removing the edges whose joint probabilities are less than the target probability threshold in the probability graph model obtained by the joint probability matrix conversion, and obtaining the probability graph model to be queried; the probability graph model corresponding to the first search process is the probability graph model to be queried. Optionally, the target probability threshold ranges from 0.1 to 0.9.

[0072] For example, based on Figure 7 The probabilistic graph model shown can be queried to obtain the complete subgraph U1 = {a, b, d, n}, the complete subgraph U2 = {b, m}, and the complete subgraph U3 = {p, e}.

[0073] Step S234: taking the hotspot coding units represented by all the nodes of the multiple complete subgraphs as target hotspot coding units, to obtain multiple target hotspot coding units.

[0074] Based on the complete subgraph determined above, the target hotspot compilation units obtained include Unit_a, Unit_b, Unit_c, Unit_d, Unit_e, Unit_m, and Unit_p.

[0075] Optionally, the step of taking the hotspot compilation units represented by all nodes of the multiple complete subgraphs as target hotspot compilation units to obtain multiple target hotspot compilation units includes: obtaining a target complete subgraph from the multiple complete subgraphs, the target complete subgraph being a complete subgraph including a number of nodes that is not less than the number of target nodes; taking the hotspot compilation units represented by all nodes of the target complete subgraph as target hotspot compilation units to obtain multiple target hotspot compilation units.

[0076] It should be noted that the target number of nodes can be any value in the range of 1 to 100.

[0077] Step S240: Generate a second configuration file including the plurality of target hotspot compilation units.

[0078] Step S250: pre-compile the plurality of target hotspot compilation units based on the second configuration file.

[0079] The present application provides a method for pre-compiling an application program, which obtains a first configuration file corresponding to a target application program installed in each of a plurality of electronic devices, so as to obtain a plurality of first configuration files for recording hotspot compilation units of the target application program installed in each of the electronic devices, obtains a plurality of target hotspot compilation units belonging to a target function module in the target application program from the plurality of hotspot compilation units included in the plurality of first configuration files, and generates a second configuration file including the plurality of target hotspot compilation units. Thus, the hotspot compilation unit associated with the target function module in the target application program can be compiled in advance before the target function module is run before the target application program is run, so that the operating efficiency of the target function module can be improved, and the efficiency of optimizing the operating efficiency of the target function module is also improved at the same time.

[0080] Furthermore, in an embodiment of the present application, the joint probability between any two hotspot compilation units among the multiple hotspot compilation units included in the multiple first configuration files is calculated, and the joint probability matrix is ​​converted into a probability graph model. Then, the maximum complete subgraph is queried for the probability graph model to obtain multiple complete subgraphs to obtain target hotspot compilation units to which multiple specified functional modules belong, and then multiple target hotspot compilation units are obtained, thereby achieving the acquisition of target hotspot compilation units belonging to the same functional module by probability estimation.

[0081] See also Figure 8 The present application provides a method for precompiling an application program, which is applied to a server and includes:

[0082] Step S310: Obtain installation rates of multiple candidate application programs, where the installation rates are the ratio of the number of electronic devices on which the candidate application programs are installed to the number of all electronic devices.

[0083] For example, there are 100 electronic devices that have uploaded application installation information to the server (then the electronic devices that have uploaded application installation information here are all electronic devices), and 90 of them have application A installed. Then the application A installed in these 90 electronic devices each has a configuration file (that is, it can be understood that there are 90 configuration files), so the installation rate here is 90 / 100=0.9.

[0084] Step S320: Obtain a storage space occupancy parameter of a configuration file of each of the candidate applications, wherein the storage space occupancy parameter is the number of candidate applications whose corresponding configuration files occupy a storage space greater than a specified storage space occupancy value in the electronic device on which the candidate applications are installed.

[0085] Step S330: select the candidate application whose corresponding installation rate and storage space occupation parameter meet the specified conditions as the target application.

[0086] Step S340: Acquire multiple first configuration files corresponding to the target application, wherein the multiple first configuration files are used to record the hotspot compilation units of the target application installed in the electronic devices to which they belong, and the hotspot compilation units are compilation units that allow advance compilation before the target application runs.

[0087] Step S350: Acquire multiple target hotspot compiling units based on the multiple hotspot compiling units recorded in the multiple first configuration files, wherein the multiple target hotspot compiling units include hotspot compiling units belonging to target functional modules in the target application.

[0088] Step S360: Generate a second configuration file including the plurality of target hotspot compilation units, so as to be used for pre-compiling the plurality of target hotspot compilation units before the target functional module runs.

[0089] Step S370: Send the second configuration file to the electronic device on which the target application is installed.

[0090] The present application provides a method for pre-compiling an application program, which obtains a first configuration file corresponding to a target application program installed in each of a plurality of electronic devices, so as to obtain a plurality of first configuration files for recording hotspot compilation units of the target application program installed in each of the electronic devices, obtains a plurality of target hotspot compilation units belonging to a target function module in the target application program from the plurality of hotspot compilation units included in the plurality of first configuration files, and generates a second configuration file including the plurality of target hotspot compilation units. Thus, the hotspot compilation unit associated with the target function module in the target application program can be compiled in advance before the target function module is run before the target application program is run, so that the operating efficiency of the target function module can be improved, and the efficiency of optimizing the operating efficiency of the target function module is also improved at the same time.

[0091] Furthermore, in this embodiment, it is possible to determine which applications can be used as target applications based on the installation rate of the applications and the size of the configuration files corresponding to the applications, thereby improving the reliability of the confirmation of the target applications.

[0092] See also Fig. 9 The present application provides a method for precompiling an application program, which is applied to an electronic device, and the method comprises:

[0093] Step S410: Obtain a second configuration file, where the second configuration file is generated by the server based on the method provided in the above embodiment.

[0094] Exemplarily, the electronic device may be a smart phone or a tablet computer.

[0095] Furthermore, the electronic device can obtain the second configuration file in a variety of ways. As one way, the electronic device can download the second configuration file while downloading the installation package of the aforementioned target application, and then obtain the second configuration file during the process of locally installing the target application. As another way, the second configuration file can be obtained by periodically receiving an updated configuration file pushed by a server after installing the target application.

[0096] Step S420: When it is detected that the electronic device meets a specified condition, the second configuration file is run to compile the hotspot compilation unit in the second configuration file.

[0097] The specified condition may have specific content according to different ways in which the electronic device obtains the second configuration file.

[0098] Optionally, if the electronic device downloads the second configuration file while downloading the installation package of the aforementioned target application, then the corresponding specified condition is detecting that the electronic device is installing the installation package of the target application.

[0099] Optionally, if the electronic device is in a state where it periodically receives an updated configuration file pushed by a server, the specified condition may be when the electronic device is in a charging state or the screen is off, or other state where the user is less likely to use the electronic device, thereby avoiding the user occupying the processing resources of the electronic device due to the running process of the second configuration file while using the electronic device.

[0100] The present application provides a method for pre-compiling an application, which enables an electronic device installed with the target application to compile the multiple target hotspot compilation units in advance before the target application runs based on the functional modules after receiving the second configuration file, so that the operating efficiency of the target functional modules can be optimized more quickly.

[0101] It should be noted that in the embodiment of the present application, the number of the plurality of first configuration files and the number of the plurality of thermal convenience units obtained from the plurality of first configuration files can be determined according to actual conditions, and the numbers in the above embodiment are only exemplary. Moreover, the various thresholds or threshold values ​​in the above embodiment are also exemplary and can be changed according to actual needs.

[0102] See also Fig.10 The present application provides an application pre-compilation device 500, the device 500 comprising:

[0103] A file acquisition unit 510 is used to acquire a plurality of first configuration files corresponding to a target application, wherein the plurality of first configuration files are used to record hotspot compilation units of the target application installed in the respective electronic devices, wherein the hotspot compilation units are compilation units that allow compilation to be performed in advance before the target application is run;

[0104] A compilation unit processing unit 520, configured to obtain a plurality of target hotspot compilation units based on the plurality of hotspot compilation units recorded in the plurality of first configuration files, wherein the plurality of target hotspot compilation units include hotspot compilation units belonging to a target functional module in the target application program;

[0105] The file generating unit 530 is used to generate a second configuration file including the plurality of target hotspot compiling units, so as to be used to compile the plurality of target hotspot compiling units in advance before the target function module runs.

[0106] The pre-compilation unit 531 is used to pre-compile the multiple target hotspot compilation units based on the second configuration file.

[0107] As a method, the compilation unit processing unit 520 is specifically used to calculate the joint probability between any two hotspot compilation units among the multiple hotspot compilation units included in the multiple first configuration files, and the joint probability represents the probability that the any two hotspot compilation units appear in the same first configuration file; multiple target hotspot compilation units are calculated based on the joint probability.

[0108] Among them, optionally, the compilation unit processing unit 520 is specifically used to generate a joint probability matrix based on the multiple hotspot compilation units included in the multiple first configuration files; convert the joint probability matrix into a probability graph model, wherein each vertex in the probability graph model represents a hotspot compilation unit, and the edges between adjacent hotspot compilation units represent the joint probability that the adjacent hotspot compilation units appear in the same configuration file; obtain multiple complete subgraphs by performing a complete subgraph query on the probability graph model, wherein the nodes of each complete subgraph represent hotspot compilation units in the same functional module belonging to the target application, and the functional modules corresponding to the multiple complete subgraphs are target functional modules; take the hotspot compilation units represented by all nodes of the multiple complete subgraphs as target hotspot compilation units, and obtain multiple target hotspot compilation units.

[0109] The compilation unit processing unit 520 is specifically used to perform a complete subgraph query, obtain the maximum complete subgraph in the probability graph model corresponding to the current search process, wherein the probability graph model corresponding to the first search process is the probability graph model obtained by converting the joint probability matrix; remove the maximum complete subgraph from the probability graph model corresponding to the current search process, and obtain the probability graph model corresponding to the next search process to obtain multiple complete subgraphs.

[0110] As a way, Fig.11 As shown, the device 500 also includes: a model optimization unit 540, which is used to remove the edges whose joint probabilities represented are less than the target probability threshold in the probability graph model obtained by the joint probability matrix transformation, and obtain the probability graph model to be queried. In this way, the probability graph model corresponding to the first search process is the probability graph model to be queried.

[0111] As a method, the compilation unit processing unit 520 is specifically used to obtain a target complete subgraph from the multiple complete subgraphs, where the target complete subgraph is a complete subgraph whose number of nodes is not less than the number of target nodes; and use the hotspot compilation units represented by all nodes of the target complete subgraph as target hotspot compilation units to obtain multiple target hotspot compilation units.

[0112] like Fig.12 As shown, the device 500 further includes:

[0113] The target application determination unit 550 is used to obtain the installation rate of multiple candidate applications, where the installation rate is the ratio of the number of electronic devices on which the candidate applications are installed to the number of all electronic devices; obtain the storage space occupancy parameter of the configuration file of each of the candidate applications, where the storage space occupancy parameter is the number of candidate applications in the electronic devices on which the candidate applications are installed, the storage space occupied by the corresponding configuration files is greater than the specified storage space occupancy value; and select the candidate applications whose corresponding installation rates and storage space occupancy parameters meet the specified conditions as target applications.

[0114] The file distribution unit 560 is configured to send the second configuration file to the electronic device on which the target application is installed.

[0115] It should be noted that how to encode the audio data according to the audio encoding type in this application can adopt existing technologies, and this application will not go into details.

[0116] The following will be combined Fig.13 An electronic device provided by the present application is described.

[0117] See also Fig.13 Based on the above-mentioned image processing method and apparatus, the embodiment of the present application also provides another electronic device 200 that can execute the above-mentioned application pre-compilation method. The electronic device 200 includes one or more (only one is shown in the figure) processors 102, a memory 104 and a network module 106 that are coupled to each other. Among them, the memory 104 stores a program that can execute the content of the above-mentioned embodiment, and the processor 102 can execute the program stored in the memory 104.

[0118] Among them, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.

[0119] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the terminal 100 during use.

[0120] The network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices, such as communicating with a wireless access point. The network module 106 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption / decryption chip, a user identity module (SIM) card, a memory, etc. The network module 106 may also be used as a network adapter for the electronic device 200 to directly access the network through a line connection. The network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.

[0121] Please refer to Fig.14 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 800 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0122] The computer readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 that performs any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 810 can be compressed, for example, in an appropriate form.

[0123] The present application provides a method, device, electronic device and server for pre-compiling an application program, which obtains a first configuration file corresponding to a target application program installed in each of multiple electronic devices, so as to obtain a plurality of first configuration files for recording hotspot compilation units of the target application program installed in each of the electronic devices, obtains a plurality of target hotspot compilation units belonging to a target function module in the target application program from the plurality of hotspot compilation units included in the plurality of first configuration files, and generates a second configuration file including the plurality of target hotspot compilation units. Thus, through this method, the hotspot compilation unit associated with the target function module in the target application program can be compiled in advance before the target function module is run, so that the operating efficiency of the target function module can be improved, and the efficiency of optimizing the operating efficiency of the target function module is also improved at the same time.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for precompiling an application, characterized in that: The method comprises: Acquire a plurality of first configuration files corresponding to a target application, wherein the first configuration files are used to record hotspot compilation units of the target application; Calculating a joint probability between any two hotspot coding units among the multiple hotspot coding units included in the multiple first configuration files, where the joint probability represents a probability that the any two hotspot coding units appear in the same first configuration file; Generate a joint probability matrix based on a plurality of hotspot coding units included in the plurality of first configuration files; Converting the joint probability matrix into a probability graph model, wherein each vertex in the probability graph model represents a hotspot compilation unit, and the edges between adjacent hotspot compilation units represent the joint probability that adjacent hotspot compilation units appear in the same configuration file; A plurality of complete subgraphs are obtained by performing a complete subgraph query on the probabilistic graph model, wherein the nodes of each complete subgraph represent hot compilation units in the same functional module of the target application, and the functional modules corresponding to the plurality of complete subgraphs are target functional modules; Taking the hotspot compilation units represented by all nodes of the multiple complete subgraphs as target hotspot compilation units, obtaining multiple target hotspot compilation units, wherein the multiple target hotspot compilation units include hotspot compilation units associated with target functional modules in the target application; Generate a second configuration file including the plurality of target hotspot compilation units; The plurality of target hotspot compilation units are pre-compiled based on the second configuration file.

2. The method according to claim 1, characterized in that The step of obtaining a plurality of complete subgraphs by performing a complete subgraph query on the probabilistic graph model comprises: Perform a complete subgraph query to obtain the maximum complete subgraph in the probability graph model corresponding to the current search process, wherein the probability graph model corresponding to the first search process is the probability graph model obtained by transforming the joint probability matrix; The maximum complete subgraph is removed from the corresponding probability graph model in the current search process to obtain the corresponding probability graph model in the next search process, so as to obtain multiple complete subgraphs.

3. The method according to claim 2, characterized in that Before performing the complete subgraph query, the following steps are also included: Remove the edges whose joint probabilities are less than the target probability threshold from the probability graph model obtained by the transformation of the joint probability matrix, to obtain the probability graph model to be queried; The probability graph model corresponding to the first search process is the probability graph model to be queried.

4. The method according to any one of claims 1 to 3, characterized in that: The step of taking the hotspot compilation units represented by all nodes of the multiple complete subgraphs as target hotspot compilation units to obtain multiple target hotspot compilation units comprises: Acquire a target complete subgraph from the multiple complete subgraphs, wherein the target complete subgraph is a complete subgraph including a number of nodes that is not less than the number of target nodes; The hotspot coding units represented by all the nodes of the target complete subgraph are used as target hotspot coding units to obtain a plurality of target hotspot coding units.

5. The method according to claim 1, characterized in that The method further comprises: Acquire installation rates of multiple to-be-selected applications, where the installation rates are ratios of the number of electronic devices on which the to-be-selected applications are installed to the number of all electronic devices; Obtaining a storage space occupancy parameter of a configuration file of each of the candidate applications, wherein the storage space occupancy parameter is the number of the candidate applications whose corresponding configuration files occupy a storage space greater than a specified storage space occupancy value in the electronic device on which the candidate applications are installed; The candidate application programs whose corresponding installation rates and storage space occupation parameters meet the specified conditions are selected as target applications.

6. The method according to claim 1, characterized in that After the step of generating a second configuration file including the plurality of target hotspot compilation units, the method further includes: The second configuration file is sent to the electronic device on which the target application is installed.

7. A method for precompiling an application, characterized in that: Applied to electronic equipment, the method comprises: Obtain a second configuration file, where the second configuration file is generated by the server based on the method described in any one of claims 1 to 5; When it is detected that the electronic device meets a specified condition, the second configuration file is run to compile the hotspot compilation unit in the second configuration file.

8. A device for precompiling an application, characterized in that: The device comprises: A file acquisition unit, used to acquire a plurality of first configuration files corresponding to a target application, wherein the plurality of first configuration files are used to record hotspot compilation units of the target application installed in the electronic devices to which they belong, wherein the hotspot compilation units are compilation units that allow compilation to be performed in advance before the target application is run; A compilation unit processing unit, used to calculate the joint probability between any two hot compilation units among the multiple hot compilation units included in the multiple first configuration files, wherein the joint probability represents the probability that the any two hot compilation units appear in the same first configuration file; based on the multiple hot compilation units included in the multiple first configuration files, a joint probability matrix is ​​generated; the joint probability matrix is ​​converted into a probability graph model, wherein each vertex in the probability graph model represents a hot compilation unit, and the edges between adjacent hot compilation units represent the joint probability that adjacent hot compilation units appear in the same configuration file; multiple complete subgraphs are obtained by performing a complete subgraph query on the probability graph model, wherein the nodes of each complete subgraph represent the hot compilation units in the same functional module belonging to the target application, and the functional modules corresponding to the multiple complete subgraphs are target functional modules; the hot compilation units represented by all the nodes of the multiple complete subgraphs are used as target hot compilation units to obtain multiple target hot compilation units, wherein the multiple target hot compilation units include the hot compilation units belonging to the target functional module in the target application; A file generating unit, configured to generate a second configuration file including the plurality of target hotspot compiling units; A pre-compilation unit is used to pre-compile the multiple target hotspot compilation units based on the second configuration file.

9. A device for precompiling an application, characterized in that: Running on an electronic device, the device comprises: A file acquisition unit, configured to acquire a second configuration file, where the second configuration file is processed by the device according to claim 8 running in the server; The file processing unit is used to run the second configuration file to compile the hotspot compilation unit in the second configuration file when it is detected that the electronic device meets the specified condition.

10. An electronic device, characterized in that: including one or more processors, video codecs, and memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method of any one of claims 1 to 6 or the method of claim 7.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is run, the method according to any one of claims 1 to 6 or the method according to claim 7 is executed.

Citation Information

Patent Citations

  • Method and device for pre-encrypting program

    CN106775893A