WO2021135988A1 - 热点代码处理方法、请求方法、装置及电子设备 - Google Patents

热点代码处理方法、请求方法、装置及电子设备 Download PDF

Info

Publication number
WO2021135988A1
WO2021135988A1 PCT/CN2020/137667 CN2020137667W WO2021135988A1 WO 2021135988 A1 WO2021135988 A1 WO 2021135988A1 CN 2020137667 W CN2020137667 W CN 2020137667W WO 2021135988 A1 WO2021135988 A1 WO 2021135988A1
Authority
WO
WIPO (PCT)
Prior art keywords
hotspot
code
target application
files
codes
Prior art date
Application number
PCT/CN2020/137667
Other languages
English (en)
French (fr)
Inventor
帅朝春
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2021135988A1 publication Critical patent/WO2021135988A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4441Reducing the execution time required by the program code
    • 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
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Definitions

  • This application relates to the field of data processing technology, and more specifically, to a hot code processing method, request method, device, electronic device, and storage medium.
  • the virtual machine compiles the hot code in the code of the application program into machine code related to the local platform.
  • This application proposes a hot code processing method, request method, device, electronic equipment and storage medium to improve the above problems.
  • an embodiment of the present application provides a hotspot code processing method.
  • the method includes: obtaining hotspot code files of a target application from multiple electronic devices, and obtaining multiple hotspot code files;
  • the hotspot code in the file generates multiple hotspot configuration files of different levels.
  • the hotspot configuration file of the non-highest level includes the first part of the hotspot code and the second part of the hotspot code, the first part of the hotspot code and the higher-level hotspot configuration file
  • the number of occurrences of the second part of the hotspot code in the plurality of hotspot code files is lower than or equal to the number of occurrences of the first part of the hotspot code in the plurality of hotspot code files;
  • an embodiment of the present application provides a hotspot code request method, the method includes: obtaining use information of a target application by a terminal device; and determining a dependency index on the target application according to the use information, wherein: The usage information indicates that the more the target application is used, the higher the degree of dependence indicated by the dependency index corresponding to the usage information is; and a request for obtaining the hot code of the target application is sent to the server, the obtaining request.
  • the dependency index is carried in the server for requesting the hotspot profile corresponding to the level of the dependency index, where the dependency index indicates that the higher the degree of dependency, the lower the level of the selected hotspot profile, which is not the highest level.
  • the hotspot configuration file includes the first part of the hotspot code and the second part of the hotspot code.
  • the first part of the hotspot code is the same as the hotspot code in the higher-level hotspot profile, and the second part of the hotspot code appears less frequently in multiple hotspot code files. Or equal to the number of occurrences of the first part of the hotspot code in the multiple hotspot code files.
  • an embodiment of the present application provides a hotspot code processing device, which includes: a first file acquisition module, configured to acquire hotspot code files of a target application from multiple terminal devices, and obtain multiple hotspot code files
  • the second file acquisition module is used to generate a plurality of hotspot configuration files of different levels according to the hotspot codes in the plurality of hotspot code files, wherein the hotspot configuration file of the non-highest level includes the first part of the hotspot code and the second part Hotspot code, the first part of the hotspot code is the same as the hotspot code in the one-level hotspot configuration file, the second part of the hotspot code in the multiple hotspot code files is less than or equal to the first part of the hotspot code in the multiple The number of occurrences in a hotspot code file; a request response module for receiving a request for obtaining the hotspot code of the target application, according to the obtaining request, from the multiple hotspot configuration files of different levels Select a
  • an embodiment of the present application provides a hotspot code request device, which includes: an information acquisition module for acquiring usage information of a target application by a terminal device; an index determination module for determining according to the usage information The dependency index on the target application program, wherein the usage information indicates that the more the target application program is used, the higher the degree of dependency indicated by the dependency index corresponding to the usage information; the request module is used to send to the server An acquisition request for the hotspot code of the target application, the acquisition request carries the dependency index, and is used to request from the server a hotspot configuration file corresponding to the dependency index, where the dependency index indicates the degree of dependency The higher the level, the lower the level of the selected hotspot profile.
  • the hotspot profile that is not the highest level includes the first part of the hotspot code and the second part of the hotspot code.
  • the first part of the hotspot code is the same as the hotspot code in the higher-level hotspot profile.
  • the number of occurrences of the second part of hot code in the multiple hot code files is lower than or equal to the number of occurrences of the first part of hot code in the multiple hot code files.
  • an embodiment of the present application provides an electronic device that includes one or more processors; a memory, which is electrically connected to the one or more processors; one or more programs, wherein the one 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 as described above.
  • an embodiment of the present application provides a computer-readable storage medium in which a program code is stored, wherein the above-mentioned method is executed when the program code is running.
  • Figure 1 shows a JIT architecture diagram provided by an embodiment of the present application.
  • Fig. 2 shows a schematic diagram of interaction between a server and a terminal device provided in an embodiment of the present application.
  • Fig. 3 shows another schematic diagram of interaction between a server and a terminal device provided by an embodiment of the present application.
  • Fig. 4 shows a flowchart of a hotspot code processing method provided by an embodiment of the present application.
  • Fig. 5 shows a flowchart of a hotspot code processing method provided by another embodiment of the present application.
  • Fig. 6 shows a flowchart of a hotspot code request method provided by an embodiment of the present application.
  • Fig. 7 shows a flowchart of a hotspot code request method provided by another embodiment of the present application.
  • Fig. 8 shows a functional module diagram of a hotspot code processing apparatus provided by an embodiment of the present application.
  • Fig. 9 shows a functional module diagram of a hotspot code request device provided by an embodiment of the present application.
  • Fig. 10 shows a structural block diagram of an electronic device proposed in an embodiment of the present application for executing the embodiment according to the present application.
  • FIG. 11 shows a storage medium provided by an embodiment of the present application for storing or carrying program code for implementing the hotspot code processing method according to the embodiment of the present application.
  • the code block In the virtual machine execution environment of the terminal device, if a code block runs frequently and the number of runs exceeds the set number of times, the code block is determined as a hot code, and the hot code is recorded and saved to the hot code File (profile).
  • the code block may be a set of codes, or a method in the code.
  • the hot code in the hot code file can be compiled by a just-in-time compiler (JIT, Just-In-Time Compiler) to obtain an odex file or be compiled by pre-compilation (AOT, Ahead-of-Time)
  • JIT Just-In-Time Compiler
  • AOT Ahead-of-Time
  • the hot code compiled odex file and the oat file contain binary machine code, which can be directly executed by the underlying processor (CPU, central processing unit).
  • CPU central processing unit
  • the oat file contains the machine code for the program to run, it can be directly run by the Android runtime (ART, Android-Running-Time).
  • the dex file if it is a cold code, it is executed by the java interpreter. If it is a hot code, it is compiled in real time by JIT and stored in the JIT code cache (JIT CODE CACHE). If you access the hotspot code again, you can execute the corresponding machine code directly from the cache.
  • the hotspot code is put into the hotspot code file, and when the terminal device enters the idle (IDLE) and charged state, the hotspot code in the hotspot code file is executed by the AOT process to compile and generate an oat file.
  • the code block Since the code block is run more than the set number of times, it is determined as the hot code. For the newly installed application, it needs to run in the terminal device for a period of time before the terminal device can determine the hot code according to the number of runs of the code in the application. .
  • the server can pre-collect hotspot codes in the application, and the terminal device can obtain the hotspot codes collected by the server. If the hotspot code file is not generated by running, the hotspot code of the application can be determined, and the hotspot code of the application can be determined. The hotspot code is compiled into odex files and oat files for direct execution at runtime to improve the operating efficiency of the application and thus the performance of the target application.
  • the number of hotspot codes given by the server to the terminal device may increase the compilation time of the hotspot code for the terminal device and affect the processing speed.
  • the embodiment of the present application proposes a hotspot code processing method, request method, device, electronic device, and storage medium.
  • the server 101 is connected to the terminal device 102 in a network.
  • the terminal device may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, an e-book, or a smart wearable device.
  • the server may obtain the hotspot code file from multiple terminal devices that have generated the hotspot code file of the target application, and then select the hotspot code from the obtained hotspot code file to generate a plurality of hotspot configuration files of different levels. Upon receiving the request for obtaining the hotspot code of the target application, a hotspot configuration file of one level is selected and returned. Any terminal device can also request the hotspot code from the server according to the usage of the target application.
  • the server that generates the hotspot configuration file and the server that returns the hotspot configuration file to the terminal device may be the same server or different servers.
  • the server 101 may generate a hotspot configuration file, and upon receiving the hotspot code acquisition request sent by the terminal device 102, return the hotspot configuration file to the terminal device 102.
  • the server 1011 can generate hotspot configuration files of different levels, and the server 1012 can receive the hotspot code sent by the terminal device 102.
  • Request and upon receiving the hotspot code acquisition request sent by the terminal device 102, the server 1011 requests the hotspot code of the target application.
  • the server 1011 receives the request for acquiring the hotspot code of the target application sent by the server 1012, it selects a hotspot configuration file of one level from the multiple hotspot configuration files of different levels and returns it to the server 1012.
  • the server 1012 then sends the obtained hotspot configuration file to the terminal device 102 requesting the hotspot code.
  • each terminal device 102 can be connected to the server 1012 and the server 1011 through a network, and Fig. 3 only shows part of the network connection diagram.
  • FIG. 4 shows a hot code processing method provided by an embodiment of the present application, and the method can be applied to a server.
  • the method may include:
  • Step S110 Obtain hot code files of the target application from multiple terminal devices, and obtain multiple hot code files.
  • the terminal device After the terminal device runs the application for a period of time, some code blocks have been run for a set number of times and are determined as hotspot codes. Therefore, the terminal device may store a hotspot code file including the hotspot code.
  • the server may obtain the hotspot code of the application program from the terminal device, where the server may obtain the hotspot code of the application program generated in the terminal device by obtaining the hotspot code file in the terminal device.
  • the specific hot codes of which applications can be obtained by the server are not limited in the embodiments of the present application, and the hot codes of one or more applications may be obtained according to requirements.
  • the embodiment of the present application takes the hot code of an application program as an example for description, and defines the application program as the target application program.
  • For the method of obtaining the hot code of various applications please refer to the method of obtaining the target application.
  • the server may obtain the hotspot code file of the target application from each terminal device, that is, the server may obtain multiple hotspot code files of the target application from multiple terminal devices.
  • Step S120 Generate a plurality of hotspot configuration files of different levels according to the hotspot codes in the plurality of hotspot code files, where the hotspot configuration files of non-highest level include the first part of the hotspot code and the second part of the hotspot code, the first part of the hotspot The code is the same as the hotspot code in the one-level hotspot configuration file, and the number of occurrences of the second part of the hotspot code in the multiple hotspot code files is lower than or equal to that of the first part of the hotspot code in the multiple hotspot code files The number of occurrences.
  • each hotspot code file includes one or more hotspot codes.
  • a hotspot code can be selected from the multiple hotspot code files to generate a hotspot configuration file.
  • the server may generate multiple hotspot configuration files according to the obtained hotspot code files, and the number of hotspot codes in each hotspot configuration file is different.
  • multiple hotspot configuration files correspond to different levels, and the number of hotspot codes included in the hotspot configuration files from high to low increases in order.
  • a hotspot profile with a higher level includes more occurrences of hotspot codes, and a hotspot profile with a lower level may include hotspot codes in a hotspot profile with a higher level. That is to say, the non-highest-level hotspot configuration file includes the first part of the hotspot code and the second part of the hotspot code.
  • the first part of the hotspot code is the same as the hotspot code in the higher-level hotspot profile, and the second part of the hotspot code is in the multiple
  • the number of occurrences in the hot code files is lower than or equal to the number of occurrences of the first part of the hot code files in the multiple hot code files.
  • Step S130 When receiving the request for obtaining the hotspot code of the target application, according to the obtaining request, select a hotspot configuration file of one level from the multiple hotspot configuration files of different levels to return.
  • the server When the server receives the hotspot code acquisition request for the target application, it can select a level of hotspot configuration file from the generated multiple hotspot configuration files of the target application and return it to the requester.
  • the server may obtain hotspot code files from multiple terminal devices, and select hotspot codes from the obtained hotspot code files to generate multiple hotspot configuration files of different levels, and select a hotspot configuration file of one level Return to the requester who requested the hotspot configuration file.
  • the hotspot code in the hotspot configuration file can be used to improve the operating efficiency of the application, thereby improving the performance of the application.
  • This application provides another embodiment, which includes a plurality of different levels of hotspot configuration file generation methods. Specifically, please refer to FIG. 5.
  • This embodiment includes:
  • Step S210 Obtain hotspot code files of the target application from multiple terminal devices, and obtain multiple hotspot code files.
  • the specific hotspot code files of the terminal devices that the server obtains are not limited in the embodiments of the present application.
  • the terminal devices from which the server can obtain the hotspot code files may include all or part of various terminal devices connected to the server network. If the target application is installed in the terminal device connected to the server network, the server can obtain the hotspot code file of the target application from the terminal device.
  • the server may initiate a hotspot code file acquisition request to the terminal device, and the hotspot code file acquisition request carries the program identifier of the target application that needs to be acquired.
  • the terminal device may return the hot code file of the target application corresponding to the program identifier to the server according to the hot code file obtaining request, and the server obtains the hot code file returned by the terminal device.
  • the server can update the hotspot code file of the target application at a set frequency, that is, the server can send the hotspot code file to all or part of the terminal devices installed with the target application at a preset time. Get the request, get the hot code file.
  • the server sends the hotspot code file acquisition request, if a terminal device is not connected to the server network, when the terminal device is connected to the server network, it can send the hotspot code file acquisition request to the terminal device.
  • the server and the terminal device may negotiate in advance, and the terminal device periodically sends the hot code file of the target application to the server, so that the server can obtain the hot code file of the target application sent in the terminal device.
  • the negotiation between the server and the terminal device can be a negotiation with the manufacturer of the terminal device to set up the sending of the hotspot code file on the terminal device; optionally, the negotiation between the server and the terminal device can also be It is the pre-negotiation between the server and the target application.
  • the client of the target application installed on the terminal device sends the hotspot code file to the server.
  • the server may establish a hotspot code database for each terminal device, which is associated with the application downloaded and used by the terminal device, and the server stores the hotspot code file obtained from the terminal device in the hotspot code database of the terminal device.
  • the hotspot code file obtained by the server in addition to the hotspot code of the target application, it can also include other information related to the target application, such as the unique identity information of the target application.
  • the unique identity information may include the target application’s unique identity information. The name, the version name of the target application, and the version number of the target application, etc., to accurately locate the identity of the hot code file.
  • applications with different identity information can be considered as different applications.
  • the program codes may be different, and the hotspot codes may be different.
  • applications with the same name and the same version are treated as the same application
  • applications with different names are treated as different applications
  • applications with the same name and different versions are treated as different applications, that is, The application with the same program code at the time of launch is regarded as the same application.
  • the target applications in multiple terminal devices are applications of the same version and the same name.
  • Step S220 Sort the different hotspot codes in the plurality of hotspot code files from high to low according to the number of appearances in the plurality of hotspot code files.
  • hotspot configuration files The more hotspot codes in a hotspot configuration file, the longer it takes to compile the hotspot code. Therefore, multiple hotspot configuration files of different levels can be generated. The number of hotspot codes in different levels of hotspot configuration files is different. The time required is different to meet the needs of different users.
  • the hotspot code As the popularity of the hotspot code is higher, it means that the hotspot code is more likely to be a frequently run code in the terminal device that obtains the hotspot configuration file.
  • the level of the hot code can be measured by the number of occurrences of the hot code in the various hot code files that are counted. The higher the number of occurrences, the more users using the function corresponding to the hot code, and the higher the popularity of the hot code.
  • the number of occurrences of the hotspot code in multiple hotspot code files is the number of hotspot code files that include the hotspot code. For example, if there are 5 hotspot code files in the obtained hotspot code files that all include a certain hotspot code c, it can be determined that the number of occurrences of the hotspot code c is 5.
  • the different hot codes in the obtained hot code files are sorted, and the sorting basis is the number of occurrences of the hot codes. The higher the number of occurrences of the hot codes, the higher the ranking of the hot codes.
  • the hot code files of the target application obtained by the server include A, B, C, D, and E.
  • Hotspot code file A includes hotspot codes c1, c2, c3, and c4;
  • hotspot code file B includes hotspot codes c1, c2, c4;
  • hotspot code file C includes hotspot codes c1 and c5;
  • hotspot code file D includes hotspot codes c1, c4 and c5.
  • the different hot codes in the multiple hot code files obtained by the server include c1, c2, c3, c4, and c5.
  • the number of hot code files including hot code c1 is 4; the number of hot code files including hot code c2 The number is 2; the number of hot code files including hot code c3 is 1; the number of hot code files including hot code c4 is 3; the number of hot code files including hot code c5 is 2.
  • the hotspot codes include c1, c2, c3, c4, and c5 in order of 4, 2, 1, 3, 2.
  • the hotspot codes are sorted from high to low as c1, c4, c2, c5, and c3, where The number of hotspot files corresponding to c5 and c2 is the same, and both are 2.
  • the ordering of c5 and c2 can be reversed.
  • the embodiment of the present application describes the ordering of c1, c4, c2, c5, and c3.
  • the server obtains the hotspot codes in each hotspot code file and sorts them according to the number of occurrences.
  • the hotspot code file includes the code identification of the hotspot code, and the code identification may be the hotspot code.
  • the serial number in the code of the target application indicates.
  • each hotspot code file For each hotspot code file, extract each code identifier in it and save it to the code identifier collection. From the code of the target application, find out all the code blocks to form a set of code blocks. According to the code identification of each hot spot code in the code identification set, the hot spot code is obtained from the code block set to form a hot spot set corresponding to the hot spot code file.
  • each hotspot code file According to the hotspot set corresponding to each hotspot code file, count the number of occurrences of each hotspot code in the obtained hotspot codes, sort from high to low according to the number of occurrences, and form a sorted hotspot code set for subsequent gradient division.
  • the hot code is the method method in the dex file of the target application
  • the code identifier of the hot code is represented as method id
  • the serial number in the method ids table of the dex file is used as the code identifier of the hot code. Extract each method id from each hot code file and save it in the hot_method_ids collection. Get the apk file of the target application, extract the dex file in it, and get all the methods set in it. According to the serial number of method id in hot_method_ids, find method in methods and record it as hot_methods. Therefore, the hot_methods corresponding to each hotspot code file can be obtained.
  • Step S230 Divide the sorted hotspot codes into multiple gradients in turn, each of the non-sorted top gradients includes all hotspot codes of the previous gradient and hotspot codes different from the previous gradient.
  • the sorted hot codes are divided into gradients.
  • each gradient includes the hot codes of the previous gradient and other hot codes.
  • the previous gradient is the gradient of the higher ranking of the included hotspot codes.
  • the hot codes included in the divided 3 gradients are respectively c1, c4; c1, c4, c2, c5; c1, c4, c2, c5 and c3.
  • the first gradient includes c1 and c4, which is the frontmost gradient;
  • the second gradient includes the hot spot code c1, c4, c2, and c5, the second gradient includes the hotspot codes c1 and c4 of the previous gradient, that is, the first gradient, and the hotspot codes c2 and c5 that are different from the previous gradient;
  • the third gradient includes the hotspot codes c1, c4 , C2, c5, and c3, the third gradient includes the previous gradient, that is, the hot spot codes c1, c4, c2, and c5 of the second gradient, and also includes the hot spot code c3 that is different from the previous gradient.
  • the number of hotspot codes divided by each gradient is not limited.
  • the gradient can be divided according to the amount of data to control the data amount of the hot profile corresponding to each gradient.
  • the corresponding relationship between the gradient and the amount of data may be set, the gradient is from high to bottom, and the corresponding data amount increases in sequence.
  • the higher the gradient the higher the level of the hotspot profile generated by the included hotspot code.
  • the number of gradients can be set.
  • the corresponding data amount can be all, which means that the last gradient includes all hotspot codes.
  • data volume control can also be performed, and the data volume corresponding to the last gradient can be a suitable data volume controlled so that the generated hotspot profile of the lowest level includes
  • the hotspot code covers as much as possible the code blocks that users will frequently run when using the target application, without being too large.
  • the specific value of the data amount corresponding to the last gradient is not specifically limited. For example, it may be to determine a range of usage duration, and obtain hotspots generated by the target application whose usage duration is within the usage duration range. Code file, and calculate the average data volume of the obtained hot code file, and round up or down as the data volume corresponding to the last gradient.
  • the use time range is 3 months, and 4 hot code files generated by the target application with the use time of 3 months are obtained.
  • the total data volume of the hotspot codes included in each gradient is less than or equal to the data volume corresponding to the gradient, and reaches the maximum data volume that the gradient can reach.
  • the amount of data can be a number of bytes, and the unit can be B, KB, MB, GB, etc.
  • the data amount of the hotspot codes can be sequentially accumulated according to the sorting from high to low.
  • the accumulated hotspot code is greater than the data amount corresponding to the current gradient, the accumulated hotspots are discarded The last one in the code, get the hot code included in the current gradient.
  • the sorted hotspot codes c1, c4, c2, c5, and c3 are divided into gradients. If the data amount corresponding to the first gradient is n1, if the total data amount of the hotspot codes c1 and c4 is less than n1, the hotspot The total data volume of codes c1, c4, and c2 is greater than n1, and the total data volume of c1 and c4 is less than or equal to n1, and reaches the maximum data volume of the first gradient, then divide c1 and c4 as the hot spots included in the first gradient Code.
  • the gradient can be divided according to the number of hotspot codes to control the number of hotspot codes in the hotspot configuration file corresponding to each gradient.
  • a corresponding relationship between gradients and quantities may be set, and the quantity corresponding to each gradient is the quantity of hotspot codes corresponding to the gradient.
  • the gradient is from high to bottom, and the corresponding number increases in turn.
  • the number of gradients may be set.
  • the corresponding number of hotspot codes may be all hotspot codes, which means that the last gradient includes all hotspot codes.
  • the number of hotspot codes can also be controlled, and the number corresponding to the last gradient can be an appropriate number controlled, so that the hotspots included in the generated lowest-level hotspot profile
  • the code covers as much as possible the code blocks that users will often run when using the target application, without being too large.
  • the specific value of the number of hotspot codes corresponding to the last gradient is not specifically limited. For example, it may be to determine a range of use duration, and obtain the target application generated by the use duration within the range of use duration. Calculate the average number of hot codes in the obtained hot code files, and round up or down as the number of hot codes corresponding to the last gradient.
  • the use time range is 3 months
  • 4 hot code files generated by the target application whose use time is 3 months are obtained.
  • the number of hot code files in the 4 hot code files are 5, 6, 5, including repetitions.
  • There are 16 hotspot codes in total, and the average number of hotspot codes is 16/4 4, and 4 is the number corresponding to the last gradient.
  • the number of hotspot codes included in each gradient is less than or equal to the number corresponding to the gradient.
  • the sorted hotspot codes c1, c4, c2, c5, and c3 are divided into gradients. If the number corresponding to the first gradient is 2, the number corresponding to the second gradient is 4, and the number corresponding to the third gradient is for all, the divided hotspot codes of the first gradient include c1 and c4, the hotspot codes of the second gradient include c1, c4, c2, and c5, and the hotspot codes of the third gradient include c1, c4, c2, c5, and c3.
  • Step S240 Generate a hotspot profile from the hotspot code of each gradient, where the higher the ranking of the gradient, the higher the level of the hotspot profile generated.
  • the hotspot configuration file of the non-highest level includes the first part of the hotspot code and the second part of the hotspot code, the first part of the hotspot code and the higher-level hotspot configuration
  • the hotspot codes in the files are the same, and the number of occurrences of the second part of hotspot codes in the plurality of hotspot code files is lower than or equal to the number of appearances of the first part of hotspot codes in the plurality of hotspot code files.
  • the hotspot code of the first gradient includes c1 and c4
  • the hotspot code of the second gradient includes c1, c4, c2, and c5
  • the hotspot code of the third gradient includes c1, c4, c2, c5, and c3.
  • Select hotspot codes c1 and c4 to generate a first-level hotspot configuration file select hotspot codes c1, c4, c2, and c5 to generate a second-level hotspot configuration file
  • select c1, c4, c2, c5, and c3 to generate a third-level hotspot configuration file Hotspot profile.
  • the level heights of the first level, the second level and the third level decrease in order.
  • each generated hotspot configuration file may only include the selected hotspot code, or may include other information, such as the unique identity information of the target application.
  • the way of generating the hotspot configuration file can be sorted by referring to the hotspot code from high to low, which will not be repeated here.
  • Step S250 When receiving a request for obtaining the hotspot code of the target application, according to the obtaining request, select a hotspot configuration file of one level from the multiple hotspot configuration files of different levels to return.
  • the server When the server receives the request for obtaining the hotspot code of the target application, it selects the hotspot configuration file according to the obtaining request and returns it to the requester.
  • the server can generate hotspot configuration files of different applications.
  • the server receives the hotspot code acquisition request, it can determine the hotspot configuration file of which application to return to the requester according to the unique identification information of the application carried in the hotspot code acquisition request.
  • the terminal device 102 requests the hotspot configuration file of the target application from the server 101 that generates the hotspot configuration file, and the server 101 may return the hotspot configuration file of the selected target application to the terminal equipment.
  • the terminal device when the terminal device installs the application program, the application program is not running in the terminal device, and no hotspot code is generated, which cannot improve the execution efficiency of the application program. Therefore, when the terminal device initiates an application installation request to the server, it may carry information requesting to obtain a hotspot configuration file in the installation request, indicating that the terminal device needs to obtain the hotspot configuration file of the application.
  • the server receives the installation request of the target terminal device for the target application, if the installation request carries the information requesting to obtain the hotspot configuration file, the installation package of the target application and the hotspot of the selected target application The configuration file is sent to the terminal device. If the installation request does not carry the information requesting to obtain the hotspot configuration file, it means that the terminal device does not need to obtain the hotspot configuration file of the target application, and then the installation package of the target application is sent to the terminal device.
  • the target terminal device may also directly initiate an acquisition request for the hotspot code of the target application to the server, indicating that the terminal device needs to acquire the hotspot configuration file of the application.
  • the server receives the target terminal device's request for obtaining the hotspot code of the target application, it selects the hotspot configuration file of the target application and sends it to the terminal device.
  • another server may also initiate an acquisition request for the hotspot code of the target application. That is, the server that generates the hotspot configuration file and the server that sends the hotspot configuration file to the target terminal device may be different servers.
  • the server 1011 generates the hotspot configuration file.
  • the terminal device 102 requests the server 1012 for the hotspot configuration file of the target application.
  • the hotspot configuration file is generated on the server 1011, and the server 1012 requests the server 1011 for the hotspot configuration file.
  • the server 1011 selects the hotspot configuration file of the target application and sends it to the server 1012, and the server 1012 sends the hotspot configuration file to the terminal device 102 after obtaining the hotspot configuration file from the server 1011.
  • the server described is the server 1011 or the server 1012 that generates the hotspot configuration file.
  • the server 1012 may be a software store.
  • the server 1012 may initiate an application to the server 1011 according to the information for obtaining the hotspot configuration file carried in the installation request. Request for obtaining the hot code of the application.
  • the server 1012 also returns the installation package of the target application to the target terminal device.
  • the hotspot code acquisition request may carry instruction information for selecting the hotspot configuration file
  • the server that generates the hotspot configuration file may select the hotspot configuration file according to the instruction information in the hotspot code acquisition request.
  • the instruction information may be determined by the target terminal device and sent to the server that generates the hotspot configuration file. For example, as shown in FIG. 2, the terminal device sends to the server 101, or as shown in FIG. 3, the terminal device sends to the server 1012, and the server 1012 sends the instruction information to the server 1011.
  • the indication information may be a dependency index on the target application. According to the corresponding relationship between the dependency index and the level, the hot profile of the level corresponding to the received dependency index is selected and returned, where the dependency index indicates that the higher the degree of dependency, the lower the level of the selected hot profile.
  • the higher the degree of dependence indicated by the dependence index the higher the degree of dependence on the target application by the user of the target terminal device, and the more frequently or longer the use of the target application by the user.
  • the higher the user's dependence on the target application the more functions of the target application may be involved, and the more codes corresponding to each function of the target application will be run. Therefore, the higher the degree of dependence on the target application, the more hot codes may be required, so that more codes can be pre-compiled, so that the performance of the target application is better and the usage is smoother.
  • the target application For users who have a low degree of dependence on the target application, they may mainly use the basic functions or core functions of the target application, and most of the functions may not be used.
  • the basic functions or core functions of the target application the corresponding hot code is usually more popular. Therefore, for users who have low dependence on the target application, they can obtain fewer but higher hot codes to satisfy users. The use of demand, and can reduce the compilation time.
  • the specific manifestation of the dependency index is not limited.
  • the server receives the dependency index, it can determine the level corresponding to the received dependency index according to the dependency index and the corresponding relationship between the dependency index and the level, so as to Return the hotspot configuration file corresponding to the level of the dependent indicator.
  • the dependency index is quantified by a percentile system and is represented by a value of 0-100. The larger the value, the higher the degree of dependence on the target application and the lower the corresponding level. The percentile system can be divided into multiple copies, corresponding to different levels.
  • the server includes 5 levels of hotspot configuration files, the dependency index 0-20 corresponds to the first level, 21-40 corresponds to the second level, 41-60 corresponds to the third level, 61-80 corresponds to the fourth level, and 81-100 corresponds to At the fifth level, if the server receives that the dependency index of the target terminal device on the target application is 55, within the interval of 41-60, it can be determined that the dependency index corresponds to the third level, and the third-level hotspots are configured The file is returned.
  • the indication information may be a target data volume, which means that the target terminal device obtains a hotspot profile whose data volume does not exceed the target data volume.
  • the server selects a hot profile with a data volume less than or equal to the target data volume from a plurality of hot profile profiles of different levels, and the selected hot profile has a data volume greater than other hot profile profiles with a data volume less than the target data volume.
  • the target terminal device may determine the value of the target data amount according to the remaining size of its own storage space. For example, if the remaining amount of storage space of the target terminal device is small and it is difficult to support the compilation and storage of a large hotspot configuration file, a hotspot configuration file with a small amount of data may be requested.
  • the target data amount can be set as an appropriate percentage of the remaining amount of storage space, and the percentage can be set by the user or related developers.
  • the target terminal device may also determine the target data amount according to the dependency index. For example, calculation can be performed according to a preset formula; or according to the corresponding relationship between the dependency index and the data volume, the data volume corresponding to the dependency index of the target terminal device on the target application program is determined as the target data volume.
  • the hotspot codes are sorted and divided into gradients according to the degree of heat, and different levels of hotspot configuration files including different numbers of hotspot codes and different degrees of heat are generated according to the gradient.
  • the target terminal device may generate a dependency index according to the usage information of the target application, so as to obtain a hotspot configuration file corresponding to the dependency index. See Figure 6, the method includes:
  • Step S310 Obtain the use information of the target application by the terminal device.
  • Step S320 Determine a dependency index on the target application program according to the usage information, where the usage information indicates that the more the target application program is used, the higher the degree of dependency indicated by the dependency index corresponding to the usage information is .
  • the terminal device can obtain its own use information of the target application, which indicates the use of the target application in the terminal device, and can measure the degree of dependence on the target application. If the usage information indicates that the target application is used more, it can be determined that the degree of dependence on the target application is higher. Therefore, the dependency index of the target application can be determined based on the usage information.
  • the terminal device is a target terminal device that needs to obtain a hotspot configuration file.
  • Step S330 Send an acquisition request for the hotspot code of the target application to the server, where the acquisition request carries the dependency index, and is used to request the server for the hotspot configuration file of the level corresponding to the dependency index.
  • the dependency index indicates that the higher the degree of dependency, the lower the level of the selected hotspot profile.
  • the non-highest-level hotspot profile includes the first part of the hotspot code and the second part of the hotspot code, the first part of the hotspot code and the higher-level hotspot configuration
  • the hotspot codes in the files are the same, and the number of occurrences of the second part of hotspot codes in the plurality of hotspot code files is lower than or equal to the number of appearances of the first part of hotspot codes in the plurality of hotspot code files.
  • the target terminal device sends a request for obtaining the hotspot code of the target application to a server connected to its network. As shown in Figure 2, the target terminal device can directly send the acquisition request to the server 101; as shown in Figure 3, the target terminal device can send the acquisition request to the server 1012, and the server 1012 sends the acquisition request carrying the dependent index to the server 101. Server 1011.
  • the target terminal device obtains the dependency index according to the usage information.
  • the lower the degree of dependence on the target application the higher the level of hotspot profile, the higher the hotspot code included, the less the hotspot code;
  • the higher the dependence of the application the lower the level of hotspot configuration files to obtain, and the more hotspot codes are included. Therefore, the target terminal device can obtain the hotspot configuration file corresponding to its actual use requirements, and smooth the number of hotspot codes, popularity, and compilation time.
  • Step S410 Obtain the use information of the target application by the terminal device.
  • Step S420 According to the correspondence between the usage information and the dependency index, select the dependency index corresponding to the usage information of the target application by the terminal device as the dependency index on the target application.
  • a correspondence relationship may be set between the usage information and the dependency index, and the dependency index corresponding to the current usage information of the target application by the terminal device may be determined according to the correspondence relationship.
  • the dependency index can be set to a default value, such as default It is the dependency index corresponding to the highest level.
  • the target terminal device downloads the target application for the first time, but the user account logged in by the target terminal device has used the target application and generated corresponding usage information .
  • the dependency index can be determined according to the usage information of the target application by the user account.
  • the dependent indicator can be set to a default value, such as the default corresponding to the highest level Dependent indicators.
  • the dependency index is determined according to the usage information.
  • the usage information may be generated using the target application on the target terminal device, or generated using the target application on the user account logged in the target terminal device. Understandably, if the usage information is generated on the target terminal device using the target application, the target terminal device can request the hotspot configuration file when the target application is downloaded again after the target application is uninstalled; it can also be when the application is upgraded To request the hotspot configuration file of the upgraded target application. When requesting the hotspot configuration file of the upgraded target application, the usage information before the upgrade is used as the usage information of the upgraded target application.
  • the more the number of times the target application is used, the higher the user's dependence on the target application, and the usage information may include the number of times the target application is used.
  • the determination of the number of uses may be that the user switches the target application from the background or from closed to the foreground as one use, or from closed to open as one use, which is not limited in this embodiment of the application.
  • a corresponding relationship between the number of uses and the dependency index may be set, which means that the higher the degree of dependency, the greater the corresponding number of uses.
  • the longer the use time of the target application program, the higher the user's reliance on the target application program, and the use information may include the duration of use of the target application program.
  • the determination of the use duration may be the running duration of the user's target application in the foreground, or the duration of the target application being opened, which is not limited in the embodiment of the present application.
  • the corresponding relationship between the usage time and the dependency index may be set, which means that the higher the dependency index, the more the corresponding usage time.
  • the representation form of the correspondence relationship is not limited, such as table correspondence and formula correspondence.
  • the correspondence can also be performed through a pre-trained algorithm model, that is, in the algorithm model, for different input usage information, corresponding dependency indicators can be output.
  • the usage information specifically includes.
  • it may also include the number of functions using the target application.
  • the higher the dependency index the more the corresponding number of functions.
  • the division of functions is not limited in the embodiments of this application, and can be preset by the developer. For example, in instant chat software, chatting through a chat box is a function for video chatting, voice chatting, voice-to-text input, View user dynamics and other settings for different functions.
  • the usage information of different dimensional responses may be selected to determine the dependent index, or may be combined with each other to determine the dependent index, which is not limited in the embodiment of the present application.
  • the higher the degree of dependency indicated by the dependency index the lower the level of the hotspot configuration file requested from the server, and the larger the amount of data.
  • the performance of the target terminal device may not be sufficient to support the operation of an excessively large hotspot configuration file, or an excessively large hotspot configuration file may affect the performance of the target terminal device. Therefore, in the embodiment of the present application, the dependency index determined according to the usage information can also be adjusted according to the performance parameters of the target terminal device.
  • the dependency index determined according to the usage information may not be changed.
  • the dependency index can be adjusted to a state with a lower degree of dependency to obtain a higher-level hotspot profile. For example, use points to express dependency indicators, such as a percentile system. Acquire the performance parameter of the target terminal device, and if the performance indicated by the performance parameter of the terminal device is less than a preset performance standard, reduce the dependency index by a preset value.
  • performance parameters representing different performances may have different adjustments to dependent indicators.
  • the performance parameter indicates that the worse the performance of the target terminal device, the lower the dependency index can be adjusted.
  • different performance parameters can be quantified, and dependent indicators can be quantified.
  • the quantified performance parameter may correspond to the adjusted value of the dependent index, and the quantized dependent index is lowered by the value corresponding to the adjusted value.
  • the remaining amount of storage space of the target terminal device is used to represent performance parameters
  • a storage amount is used to represent a preset performance standard
  • a percentage system is used to represent a dependency index. If the remaining storage space is greater than the preset performance standard, the dependent index may not be adjusted; if the remaining storage space is less than the preset performance standard, the less the remaining storage space, the larger the corresponding adjustment value, and the dependent index reduces the adjustment value.
  • different remaining amounts of storage space may correspond to corresponding adjustment values.
  • the performance parameter is expressed by the processor performance of the target terminal device, and the processor performance can be quantified by the processing speed of the processor, and a preset processing speed is used as the preset performance standard. Express the dependency index in a percentage system.
  • the processing speed of the processor is greater than the preset processing speed, and the dependent index may not be adjusted; if the processing speed of the processor is less than the preset processing speed, the smaller the processing speed of the processor, the larger the corresponding adjustment value, and the index will reduce the adjustment. value.
  • different processing speeds can correspond to corresponding adjustment values.
  • the specific performance parameters are not limited, and different performance parameters can be selectively used as the adjustment standards of the dependent indicators, and the dependent indicators can also be adjusted by comprehensive consideration.
  • Step S430 Send an acquisition request for the hotspot code of the target application to the server, where the acquisition request carries the dependency index, and is used to request the server for the hotspot configuration file of the level corresponding to the dependency index.
  • the terminal device may send the request for obtaining the hotspot code of the target application to the server when downloading the installation package of the target application.
  • the download can be the download during the update, or the download during the first installation or reinstallation.
  • the target terminal device may request the server 101 to download the installation package, and send a request for obtaining the hotspot code of the target application.
  • the target terminal device receives the returned hotspot configuration file from the server 101.
  • the target device terminal device may request the server 1012 to download the installation package, and send a request for obtaining the hotspot code of the target application.
  • the server 1012 obtains the hotspot configuration file from the server 1011, and the target terminal device receives the returned hotspot configuration file from the server 1012.
  • the target device terminal device may request the server 1012 to download the installation package, and send the server 1011 a request for obtaining the hotspot code of the target application.
  • the installation package is obtained from the server 1012, and the hotspot configuration file is obtained from the server 1011.
  • the target terminal device can receive the returned hotspot configuration file, and can compile the hotspot configuration file, for example, by AOT compilation, and the compiled file is stored.
  • the hotspot code can be compiled during the application installation process, and the hotspot configuration files of different levels have different compilation time.
  • the terminal device that sends the hotspot code acquisition request to the server is defined as the target terminal device.
  • the target terminal device can determine the dependency index on the target application according to the correspondence between the usage information and the dependency index. Therefore, the dependency index can be carried when sending the request for obtaining the hotspot code of the target application, so that the server returns a hotspot configuration file suitable for the dependency level corresponding to the dependency index.
  • the hotspot code in the obtained hotspot configuration file can be used as the hotspot code of the target application to improve the operating efficiency of the target application, thereby improving the performance of the target application.
  • the embodiment of the present application also provides a hotspot code processing device 500, which can be applied to a server.
  • the apparatus 500 includes: a first file obtaining module 510, which is used to obtain hot code files of a target application from a plurality of terminal devices to obtain multiple hot code files; and a second file obtaining module 520 to According to the hotspot codes in the plurality of hotspot code files, a plurality of hotspot configuration files of different levels are generated.
  • the hotspot configuration file of the non-highest level includes the first part of the hotspot code and the second part of the hotspot code, the first part of the hotspot code and the high
  • the hotspot codes in the first-level hotspot configuration files are the same, and the number of occurrences of the second part of hotspot codes in the plurality of hotspot code files is lower than or equal to the number of appearances of the first part of hotspot codes in the plurality of hotspot code files;
  • the request response module 530 is configured to, upon receiving a request for obtaining the hotspot code of the target application, according to the obtaining request, select a hotspot configuration file of one level from the multiple hotspot configuration files of different levels to return .
  • the second file acquisition module 520 may include a sorting unit, configured to sort the different hotspot codes in the multiple hotspot code files according to the number of appearances in the multiple hotspot code files from high to low. ; Gradient division unit, used to sequentially divide the sorted hot codes into multiple gradients, each of the non-sorted top gradients includes all the hot codes of the previous gradient and the hot codes different from the previous gradient; file generation unit , Used to generate a hotspot profile from the hotspot code of each gradient, where the higher the ranking of the gradient, the higher the level of the hot profile generated.
  • a sorting unit configured to sort the different hotspot codes in the multiple hotspot code files according to the number of appearances in the multiple hotspot code files from high to low.
  • Gradient division unit used to sequentially divide the sorted hot codes into multiple gradients, each of the non-sorted top gradients includes all the hot codes of the previous gradient and the hot codes different from the previous gradient
  • file generation unit Used to generate a hotspot profile from the hot
  • the gradient dividing unit may be configured to divide the total data amount of the hotspot codes included in each gradient to be less than or equal to the data amount corresponding to the gradient according to the correspondence between the gradient and the data amount.
  • the acquisition request may carry a dependency index on the target application.
  • the request response module 530 can be used to select the hotspot profile corresponding to the received dependency index to return according to the correspondence between the dependency index and the level, where the dependency index indicates that the higher the degree of dependency, the lower the level of the selected hotspot profile .
  • the apparatus 600 may include: an information acquiring module 610, configured to acquire usage information of a target application by a terminal device; an index determining module 620, configured to determine a dependency index on the target application according to the usage information , Wherein, the usage information indicates that the more the target application is used, the higher the degree of dependence indicated by the dependency index corresponding to the usage information is; the request module 630 is used to send the hotspot of the target application to the server Code acquisition request, the acquisition request carries the dependency index, and is used to request from the server a hotspot profile corresponding to the level of the dependency index, where the dependency index indicates the higher the degree of dependency, and the selected hotspot profile The lower the level, the non-highest-level hotspot profile includes the first part of the hotspot code and the second part of the hotspot code.
  • the first part of the hotspot code is the same as the hotspot code in the higher-level hotspot profile, and the second part of the hotspot code is described in The number of occurrences in the multiple hot code files is lower than or equal to the number of occurrences of the first part of the hot code files in the multiple hot code files.
  • the index determination module 620 is configured to select a dependency index corresponding to the usage information of the target application program by the terminal device as the dependency index on the target application program according to the corresponding relationship between the usage information and the dependency index.
  • the usage information may include the number of times the target application is used, or the duration of use of the target application.
  • the dependent index may be a score.
  • the device may further include an index adjustment module for obtaining performance parameters of the terminal device; if the performance indicated by the performance parameter of the terminal device is less than a preset performance standard, the dependency index is reduced by a preset value.
  • the request module 630 may be configured to send a request for obtaining the hotspot code of the target application to the server when downloading the installation package of the target application.
  • the terminal device can actively initiate a request for the hotspot configuration file, that is, the terminal device determines the dependency index to request a hotspot configuration file of an appropriate size, avoiding the uniform distribution of the hotspot configuration file, and giving it as much
  • the user has a small impact, and at the same time, it can bring a more reasonable and optimized experience to the user.
  • the coupling or direct coupling or communication connection between the displayed or discussed modules may be through some interfaces, and the indirect coupling or communication connection between the devices or modules may be electrical, Mechanical or other forms.
  • the functional modules in the various embodiments of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • FIG. 10 shows a structural block diagram of an electronic device 700 provided by an embodiment of the present application.
  • the electronic device can be a server or a terminal device.
  • the electronic device 700 in this application may include one or more of the following components: a processor 710, a memory 720, and one or more programs, where one or more programs may be stored in the memory 720 and configured to be composed of one or more Multiple processors 710 execute, and one or more programs are configured to execute the method described in the foregoing method embodiment.
  • the processor 710 may include one or more processing cores.
  • the processor 710 uses various interfaces and lines to connect various parts of the entire electronic device 700, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 720, and calling data stored in the memory 720.
  • Various functions and processing data of the electronic device 700 may adopt at least one 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).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 710 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 710, but may be implemented by a communication chip alone.
  • the memory 720 may include random access memory (RAM), or read-only memory (ROM).
  • the memory 720 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 720 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the memory 720 may store a device for processing hotspot codes and a device for requesting hotspot codes.
  • the device for processing hotspot codes may be the aforementioned device 500, and the device for requesting hotspot codes may be the aforementioned device 600.
  • the data storage area can also store data created by the electronic device 700 during use, and the like.
  • FIG. 11 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable storage medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 810 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

一种热点代码处理方法、请求方法、装置、电子设备及存储介质,可以从多个终端设备获取目标应用程序的热点代码文件,再从获得的多个热点代码文件中选择热点代码生成不同等级的热点配置文件。不同等级的热点配置文件包括的热点代码的数量不同,在接收到对目标应用程序的热点代码的获取请求时,可以选择其中一个等级的热点配置文件返回,从而使在目标应用程序使用时间较短未生成有足够的热点代码的情况下,也可以获取到数量合适的热点代码,提高目标应用程序的性能。

Description

热点代码处理方法、请求方法、装置及电子设备
相关申请的交叉引用
本申请要求于2019年12月31日提交的申请号为201911408512.0的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及数据处理技术领域,更具体地,涉及一种热点代码处理方法、请求方法、装置、电子设备及存储介质。
背景技术
在电子设备中,为了提高应用程序的执行效率以提高应用程序的性能,在运行时,虚拟机会将应用程序的代码中的热点代码编译成与本地平台相关的机器码。
发明内容
本申请提出了一种热点代码处理方法、请求方法、装置、电子设备及存储介质,以改善上述问题。
第一方面,本申请实施例提供了一种热点代码处理方法,该方法包括:从多个电子设备中获取目标应用程序的热点代码文件,获得多个热点代码文件;根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数;在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
第二方面,本申请实施例提供了一种热点代码请求方法,该方法包括:获取终端设备对目标应用程序的使用信息;根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高;向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
第三方面,本申请实施例提供了一种热点代码处理装置,该装置包括:第一文件获取模块,用于从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件;第二文件获取模块,用于 根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数;请求响应模块,用于在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
第四方面,本申请实施例提供了一种热点代码请求装置,该装置包括:信息获取模块,用于获取终端设备对目标应用程序的使用信息;指标确定模块,用于根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高;请求模块,用于向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
第五方面,本申请实施例提供了一种电子设备,该电子设备包括一个或多个处理器;存储器,与所述一个或多个处理器电连接;一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如上述的方法。
第六方面,本申请实施列提供一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本申请实施例提供的一种JIT架构图。
图2示出了本申请实施例提供的服务器与终端设备的一种交互示意图。
图3示出了本申请实施例提供的服务器与终端设备的另一种交互示意图。
图4示出了本申请一个实施例提供的热点代码处理方法的流程图。
图5示出了本申请另一个实施例提供的热点代码处理方法的流程图。
图6示出了本申请一实施例提供的热点代码请求方法的流程图。
图7示出了本申请另一实施例提供的热点代码请求方法的流程图。
图8示出了本申请一实施例提供的热点代码处理装置的功能模块图。
图9示出了本申请一实施例提供的热点代码请求装置的功能模块图。
图10示出了本申请实施例提出的用于执行根据本申请实施例的电子设备的结构框图。
图11示出了本申请实施例提供的用于保存或者携带实现根据本申请实施例的热点代码处理方法的程序代码的存储介质。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
在终端设备的虚拟机执行环境中,若某个代码块频繁运行,运行次数超过设定的次数,将该代码块确定为热点代码(hot code),将该热点代码记录下来并保存到热点代码文件(profile)。其中,可以理解的,该代码块可以是一个代码集合,或者是代码中的一个方法(method)。
为了提高热点代码的运行效率,可以将热点代码文件中的热点代码经由即时编译器(JIT,Just-In-Time Compiler)编译后获得odex文件或者经预编译(AOT,Ahead-of-Time)编译后得oat文件,热点代码编译后的odex文件以及oat文件中包含的是二进制机器码,可直接交由底层处理器(CPU,central processing unit)执行,当再次需要执行热点代码时,可以直接执行热点代码编译后的odex文件或者oat文件,提高了运行效率。
以如图1所示的安卓系统中的JIT架构为例,由于oat文件中包含的是程序运行的机器码,因此可以直接被安卓运行时(ART,Android-Running-Time)运行。而dex文件中,如果是非热点代码(cold code),是交由java解释器(Interpreter)执行,如果是热点代码,则交由JIT实时编译后存放到JIT代码缓存(JIT CODE CACHE)中,下次再次访问该热点代码,则可以直接从cache中执行对应的机器码。并且,将热点代码放入热点代码文件,当终端设备进入空闲(IDLE)且充电状态时,将热点代码文件中的该热点代码执行AOT过程进行编译生成oat文件。
由于代码块的运行次数超过设定的次数才确定为热点代码,则对于新安装的应用程序而言,需要在终端设备中运行一段时间,终端设备才能根据应用程序中代码的运行次数确定热点代码。
在一些实施例中,服务器可以预先搜集应用程序中的热点代码,终端设备可以获取到服务器搜集的热点代码,在未通过运行生成热点代码文件的情况下,可以确定应用程序的热点代码,可以将热点代码编译为odex文件以及oat文件,用于在运行时直接执行,提高应用程序的运行效率,从而目标应用程序的性能。
但是,通常的,若服务器给到终端设备的热点代码数量不合适,可能会增加终端设备对热点代码的编译时长,影响处理速度。
本申请实施例提出了一种热点代码处理方法、请求方法、装置、电子设备及存储介质,如图2所示,服务器101与终端设备102网络连接。该终端设备可以是智能手机、平板电脑、电子书、智能穿戴设备等能够运行应用程序的电子设备。
服务器可以从已经产生有目标应用程序的热点代码文件的多个终端设备中获取热点代码文件,再从获得的热点代码文件选择热点代码生成多个不同等级的热点配置文件。在接收到对目标应用程序的热点代码的获取请求时,选取一个等级的热点配置文件返回。任意一个终端设备也可以根据对目标应用程序的使用情况向服务器请求热点代码。
在本申请实施例中,生成热点配置文件的服务器与返回热点配置文件到终端设备的可以是同一个服务器或不同的服务器。当是同一个服务器时,如图2所示,服务器101可以生成热点配置文件,并且在接收到终端设备102发送的热点代码的获取请求时,向终端设备102返回热点配置文件。
当生成热点配置文件的服务器与返回热点配置文件到终端设备为不同的服务器,如图3所示,服务器1011可以生成不同等级的热点配置文件,服务器1012可以接收终端设备102发送的热点代码的获取请求,并且在接收到终端设备102发送的热点代码的获取请求时,向服务器1011请求目标应用程序的热点代码。服务器1011在接收到服务器1012发送的对目标应用程序的热点代码的获取请求时,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回给服务器1012。服务器1012再将获取到的热点配置文件发送给请求热点代码的终端设备102。在图3中,各个终端设备102都可以和服务 器1012以及服务器1011网络连接,图3中仅示出了部分网络连接示意。
下面将对本申请实施例进行详细的说明。
请参阅图4,示出了本申请实施例提供的一种热点代码处理方法,该方法可应用于服务器。具体的,该方法可以包括:
步骤S110:从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件。
终端设备在对应用程序运行一段时间后,有些代码块的运行次数达到设定的次数,被确定为热点代码,因此,在终端设备中,可以存储有包括热点代码的热点代码文件。
服务器可以从终端设备端获取应用程序的热点代码,其中,服务器可以通过获取终端设备中的热点代码文件的方式获取终端设备中产生的应用程序的热点代码。
在本申请实施例中,服务器具体可以获取哪些应用程序的热点代码在本申请实施例中并不限定,可以根据需求获取一种或多种应用程序的热点代码。本申请实施例以获取一种应用程序的热点代码为例进行说明,定义该应用程序为目标应用程序。获取各种应用程序的热点代码的方式可以参见该目标应用程序的获取方式。
服务器可以从每个终端设备中获取到目标应用程序的热点代码文件,即服务器可以从多个终端设备获取到目标应用程序的多个热点代码文件。
步骤S120:根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
服务器获取到的多个热点代码文件中,每个热点代码文件包括一个或多个热点代码。可以从该多个热点代码文件中选择热点代码生成热点配置文件。
服务器可以根据获得的热点代码文件生成多个热点配置文件,各个热点配置文件中热点代码的数量不同。
其中,多个热点配置文件分别对应不同的等级,等级由高到低的热点配置文件,包括的热点代码数量依次递增。等级越高的热点配置文件,包括的热点代码的出现次数越多,低等级的热点配置文件可以包括高等级的热点配置文件中的热点代码。也就是说,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
步骤S130:在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
当服务器接收到对目标应用程序的热点代码获取请求时,可以从生成的该目标应用程序的多个热点配置文件中,选择一个等级的热点配置文件返回给请求方。
在本申请实施例中,服务器可以从多个终端设备中获取热点代码文件,并从获取到的热点代码文件中选择热点代码生成多个不同等级的热点配置文件,并选择一个等级的热点配置文件返回给对热点配置文件进行请求的请求方。在有终端设备获取到服务器返回的热点配置文件时,可以通过该热点配置文件中的热点代码提升应用程序的运行效率,从而提高应用程序的性能。
本申请提供了另一实施例,包括多个不同等级的热点配置文件的生成方式。具体的,请参见图5,该实施例包括:
步骤S210:从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件。
服务器具体获取哪些终端设备的热点代码文件在本申请实施例中并不限定,其中,服务器可以获取热点代码文件的终端设备可以包括与服务器网络连接的各种终端设备中的全部或部分。若与服务器网络连接的终端设备中安装有目标应用程序,服务器则可以从该终端设备中获取目标应用程序的热点代码文件。
其中,在一种具体的实施方式中,服务器可以向终端设备发起热点代码文件获取请求,并在该热点代码文件获取请求中携带需要获取的目标应用程序的程序标识。终端设备可以根据该热点代码文件获取请求,向服务器返回程序标识对应的目标应用程序的热点代码文件,服务器获取到终端设备返回的热点代码文件。
在该实施方式中,服务器可以按照设置的频率更新目标应用程序的热点代码文件,也就是说,服务器可以每隔预设的时间,向安装有目标应用程序的全部或者部分终端设备发送热点代码文件获取请求,获取热点代码文件。服务器在发送热点代码文件获取请求时,若有终端设备未与服务器网络连接,则当该终端设备在与服务器网络连接时,可以向该终端设备发送热点代码文件获取请求。
在另一种实施方式中,服务器和终端设备可以预先协商,由终端设备定期将目标应用程序的热点代码文件发送到服务器,从而服务器可以获取到终端设备中发送的目标应用程序的热点代码文件。在该实施方式中,可选的,服务器与终端设备的协商,可以是与终端设备的厂商协商,在终端设备进行热点代码文件的发送设置;可选的,服务器与终端设备的协商,也可以是服务器与目标应用程序预先协商,当目标应用程序在终端设备安装,由目标应用程序安装于终端设备的客户端将热点代码文件发送到服务器。
可选的,服务器可以为每个终端设备建立一个热点代码数据库,与终端设备下载和使用的应用相关联,服务器将从终端设备获取到的热点代码文件存储在该终端设备的热点代码数据库中。
在服务器获取到的热点代码文件中,除了包括目标应用程序的热点代码,还可以包括其他与目标应用程序相关的信息,如目标应用程序的唯一身份信息,该唯一身份信息可以包括目标应用程序的名称、目标应用程序的版本名称以及目标应用程序的版本号等,以准确定位到热点代码文件的身份。
在本申请实施例中,不同身份信息的应用程序,可以认为是不同的应用程序。可选的,由于同一名称不同版本的应用程序,其程序代码可能有不同,可能产生的热点代码也不同。在本申请实施例中,将同一名称同一版本的应用程序作为相同应用程序进行处理,不同名称的应用程序作为不同的应用程序,相同名称不同版本的应用程序作为不同的应用程序,也就是说,将上线时程序代码相同的应用程序作为相同的应用程序。在多个终端设备中的目标应用程序,为同一版本同一名称的应用程序。
步骤S220:将所述多个热点代码文件中的各个不同热点代码按照在所述多个热点代码文件中的出现次数进行由高到低排序。
热点配置文件中热点代码数量越多,对该热点代码进行编译所需时间越长,因此,可以生成多个不同等级的热点配置文件,不同等级热点配置文件中热点代码的数量不同,在编译时所需时长不同,用于满足不同用户的需求。
由于热点代码的热度越高,代表该热点代码越可能是获取热点配置文件的终端设备中频繁运行的代码。等级越高的热点配置文件,热点代码的数量越少,但是,其包括的热点代码的热度可以越高,以使获取到高等级的热点配置文件的终端设备,虽然热点代码数量少,但是也能较好地改善使用性能。
其中,热点代码的高低,可以通过统计到的各个热点代码文件中,热点代码出现次数进行衡量,出现次数越高,表示使用该热点代码对应的功能的用户越多,热点代码热度越高。
在本申请实施例中,热点代码在多个热点代码文件中的出现次数,即包括该热点代码的热点代码文件数量。例如,若获取到的热点代码文件中,有5个热点代码文件都包括某热点代码c,则可以确定该 热点代码c的出现次数为5。
将获取到的热点代码文件中的不同热点代码进行排序,排序依据为热点代码的出现次数,热点代码的出现次数越高,该热点代码的排序越靠前。
例如,服务器获取到目标应用程序的热点代码文件包括A、B、C、D以及E。热点代码文件A中包括热点代码c1,c2,c3以及c4;热点代码文件B中包括热点代码c1,c2,c4;热点代码文件C中包括热点代码c1以及c5;热点代码文件D中包括热点代码c1,c4以及c5。
则服务器获取到的多个热点代码文件中的不同热点代码包括c1,c2,c3,c4以及c5,其中,包括热点代码c1的热点代码文件的数量为4;包括热点代码c2的热点代码文件的数量为2;包括热点代码c3的热点代码文件的数量为1;包括热点代码c4的热点代码文件的数量为3;包括热点代码c5的热点代码文件的数量为2。热点代码包括c1,c2,c3,c4,c5的出现次数依次为4,2,1,3,2,对热点代码进行出现次数由高到低排序为c1,c4,c2,c5以及c3,其中c5和c2对应的热点文件数量相同,都为2,c5和c2的排序可以颠倒,本申请实施例以c1,c4,c2,c5以及c3的排序进行说明。
在一种具体的实施方式中,服务器获取各个热点代码文件中的热点代码并根据出现次数进行排序的方式可以是,热点代码文件中包括的是热点代码的代码标识,该代码标识可以是热点代码在目标应用程序的代码中的序号表示。
对于每个热点代码文件,提取其中的每个代码标识,保存至代码标识集合中。从目标应用程序的代码中,找出所有的代码块,形成代码块集合。根据代码标识集合中各热点代码的代码标识,从代码块集合中获取热点代码,形成对应热点代码文件的热点集合。
根据各个热点代码文件对应的热点集合,统计获取到的热点代码中每个热点代码的出现次数,根据出现次数进行由高到低排序,形成排序后的热点代码集合,用于后续梯度划分。
例如,热点代码是目标应用程序的dex文件中的方法method,热点代码的代码标识表示为method id,dex文件的method ids表中的序号作为热点代码的代码标识。从每个热点代码文件中提取每个method id,保存在hot_method_ids集合。获取目标应用程序的apk文件,提取其中的dex文件,获取其中所有的methods集合。根据hot_method_ids中method id的序号,在methods中查找method,记为hot_methods。因此,可以获取到各个热点代码文件对应的hot_methods。
从多个hot_methods中统计每个method的出现次数,根据出现次数进行由高到低的排序,记为sorted_methods,用于后续梯度划分。
步骤S230:将排序后的热点代码依次划分为多个梯度,非排序最靠前的每个梯度包括前一梯度的所有热点代码以及与前一梯度不同的热点代码。
对排序后的热点代码进行梯度划分,在具有前一梯度的情况下,每一梯度都包括前一梯度的热点代码以及其他热点代码。其中,该前一梯度为包括的热点代码排序越靠前的梯度。
例如,在上述举例说明的排序c1,c4,c2,c5以及c3中,若划分为3个梯度,分别在c4处、c5处以及c3处划分,则划分的3个梯度包括的热点代码分别为c1,c4;c1,c4,c2,c5;c1,c4,c2,c5以及c3。从热度由高到低排序,依次定义为第一梯度、第二梯度、第三梯度,依次类推,则第一梯度包括c1以及c4,为最靠前的梯度;第二梯度包括热点代码c1,c4,c2以及c5,第二梯度包括了其前一梯度,即第一梯度,的热点代码c1以及c4,以及与前一梯度不同的热点代码c2以及c5;第三梯度包括热点代码c1,c4,c2,c5以及c3,第三梯度包括了其前一梯度,即第二梯度的热点代码c1,c4,c2以及c5,还包括与前一梯度不同的热点代码c3。
在本申请实施例中,各个梯度划分多少热点代码并不限定。
在一种实施方式,数据量越大,需要编译的时间越长,因此,可以根据数据量划分梯度,以控制各 个梯度对应的热点配置文件的数据量。
在该实施方式中,可以设置有梯度与数据量的对应关系,梯度由高到底,对应的数据量依次递增,梯度越高,包括的热点代码生成的热点配置文件等级越高。
可选的,可以设置有梯度的数量,对于最后一个梯度,其对应的数据量可以为所有,表示最后一个梯度包括所有的热点代码。
可选的,对于最后一个梯度生成的热点配置文件,也可以进行数据量控制,则最后一个梯度对应的数据量可以是控制的一个合适的数据量,使生成的最低等级的热点配置文件包括的热点代码尽可能覆盖到用户在使用目标应用程序时会经常运行到的代码块,又不至于过大。在本申请实施例中,最后一个梯度对应的数据量的具体数值并不做具体限定,例如,可以是,确定一个使用时长范围,获取使用时长在该使用时长范围内的目标应用程序产生的热点代码文件,并计算获得的热点代码文件的平均数据量,向上取整或向下取整作为最后一个梯度对应的数据量。例如,使用时长范围为3个月,获取使用时长为3个月的目标应用程序产生的热点代码文件4个,该4个热点代码文件中总共有不同的热点代码1200kb,热点代码文件的平均数据量为1200kb/4=300kb,以300kb作为最后一个梯度对应的数据量。
根据梯度与数据量的对应关系,划分每个梯度包括的热点代码的总数据量小于或等于所述梯度对应的数据量,且达到该梯度可达到的最大数据量。其中,数据量可以是一个字节数,单位可以是B,KB,MB,GB等。
在该实施方式中,可以从排序后的热点代码中,根据排序由高到低依次累计热点代码的数据量,当累计到热点代码的数据量大于当前梯度对应的数据量时,舍弃累计的热点代码中的最后一个,得到当前梯度包括的热点代码。
例如在前述举例说明中,对排序的热点代码c1,c4,c2,c5以及c3进行梯度划分,若第一梯度对应的数据量为n1,若热点代码c1和c4的总数据量小于n1,热点代码c1,c4以及c2的总数据量大于n1,c1和c4的总的数据量小于或等于n1,且达到第一梯度可达到的最大数据量,则划分c1,c4为第一梯度包括的热点代码。
在一种实施方式,热点配置文件中热点代码数量越多,需要编译的时间越长,因此,可以根据热点代码数量划分梯度,以控制各个梯度对应的热点配置文件中热点代码的数量。
在该实施方式中,可以设置有梯度与数量的对应关系,每个梯度对应的数量为该梯度对应的热点代码的数量。梯度由高到底,对应的数量依次递增。
可选的,可以设置有梯度的数量,对于最后一个梯度,其对应的热点代码数量可以为所有热点代码,表示最后一个梯度包括所有的热点代码。
可选的,对于最后一个梯度生成的热点配置文件,也可以进行热点代码数量控制,则最后一个梯度对应的数量可以是控制的一个合适的数量,使生成的最低等级的热点配置文件包括的热点代码尽可能覆盖到用户在使用目标应用程序时会经常运行到的代码块,又不至于过大。在本申请实施例中,最后一个梯度对应的热点代码的数量的具体数值并不做具体限定,例如,可以是,确定一个使用时长范围,获取使用时长在该使用时长范围内的目标应用程序产生的热点代码文件,并计算获得的热点代码文件中热点代码的平均数量,向上取整或向下取整作为最后一个梯度对应的热点代码的数量。例如,使用时长范围为3个月,获取使用时长为3个月的目标应用程序产生的热点代码文件4个,该4个热点代码文件中热点代码的数量分别为5,6,5,包括重复的热点代码,总共有热点代码16个,平均热点代码数量为16/4=4,以4作为最后一个梯度对应的数量。
根据梯度与数量的对应关系,划分每个梯度包括的热点代码的数量小于或等于该梯度对应的数量。
例如在前述举例说明中,对排序的热点代码c1,c4,c2,c5以及c3进行梯度划分,若第一梯度对 应的数量为2,第二梯度对应的数量为4,第三梯度对应的数量为所有,则划分的第一梯度的热点代码包括c1以及c4,第二梯度的热点代码包括c1,c4,c2以及c5,第三梯度的热点代码包括c1,c4,c2,c5以及c3。
步骤S240:将每个梯度的热点代码生成一个热点配置文件,其中,梯度的排序越靠前,对应生成的热点配置文件等级越高。
生成多个不同等级的热点配置文件时,每个梯度包括的热点代码生成一个热点配置文件。因此,在本申请实施例中生成的多个不同等级的热点配置文件中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
例如在前述举例说明中,如第一梯度的热点代码包括c1以及c4,第二梯度的热点代码包括c1,c4,c2以及c5,第三梯度的热点代码包括c1,c4,c2,c5以及c3,则选择热点代码c1以及c4生成第一等级的热点配置文件,选择热点代码c1,c4,c2以及c5生成第二等级的热点配置文件,选择c1,c4,c2,c5以及c3生成第三等级的热点配置文件。第一等级、第二等级以及第三等级的等级高度依次递减。
可选的,在本申请实施例中,生成的各热点配置文件可以仅包括选择的热点代码,也可以包括其他信息,如目标应用程序的唯一身份信息。
当然,在本申请实施例中,也可以按照在多个热点代码的出现次数进行由低到高进行排序。在多个热点代码的出现次数进行由低到高进行排序时,生成热点配置文件的方式可以参照热点代码由高到低进行排序,在此不做赘述。
步骤S250:在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
服务器接收到对所述目标应用程序的热点代码的获取请求时,根据获取请求选择热点配置文件返回给请求方。
可以理解的,在本申请实施例中,服务器可以生成不同应用程序的热点配置文件。服务器在接收到热点代码获取请求时,可以根据热点代码获取请求携带的应用程序唯一身份信息,确定将哪一应用程序的热点配置文件返回到请求方。
在一些实施方式中,若如图2所示,终端设备102向生成热点配置文件的服务器101请求目标应用程序的热点配置文件,服务器101可以将选择该目标应用程序的热点配置文件返回到该终端设备。
可选的,终端设备在安装应用程序时,该应用程序未在终端设备中运行,未生成有热点代码,不能很好地提高应用程序的执行效率。因此,终端设备在向服务器发起应用程序的安装请求时,可以在安装请求中携带请求获取热点配置文件的信息,表示终端设备需要获取该应用程序的热点配置文件。服务器在接收到目标终端设备对所述目标应用程序的安装请求时,若所述安装请求中携带有请求获取热点配置文件的信息,则将目标应用程序的安装包以及选择的目标应用程序的热点配置文件发送给所述终端设备。若所述安装请求中未携带有请求获取热点配置文件的信息,表示终端设备不需要获取目标应用程序的热点配置文件,则将所述目标应用程序的安装包发送给所述终端设备。
可选的,目标终端设备也可以向服务器直接发起对目标应用程序的热点代码的获取请求,表示终端设备需要获取该应用程序的热点配置文件。服务器在接收到目标终端设备对所述目标应用程序的热点代码的获取请求时,选择目标应用程序的热点配置文件发送给所述终端设备。
在一些实施方式中,如图3所示,也可以是其他服务器发起对所述目标应用程序的热点代码的获取请求。即生成热点配置文件的服务器与将热点配置文件发送到目标终端设备的可以为不同的服务器。如 图3所示,生成热点配置文件的为服务器1011,终端设备102向服务器1012请求目标应用程序的热点配置文件,热点配置文件在服务器1011生成,服务器1012向服务器1011请求获取热点配置文件。服务器1011选择目标应用程序的热点配置文件发送到服务器1012,服务器1012在从服务器1011获取到热点配置文件后发送给终端设备102。在本申请实施例中,若无特殊说明,描述的服务器为生成热点配置文件的服务器1011或服务器1012。
可选的,服务器1012可以是软件商店,可以接收到目标终端设备102发起应用程序的安装请求时,根据在安装请求中携带的获取热点配置文件的信息,服务器1012向服务器1011发起对所述目标应用程序的热点代码的获取请求。服务器1012还将目标应用程序的安装包返回给目标终端设备。
在本申请实施例中,在热点代码的获取请求中,可以携带有选择热点配置文件的指示信息,生成热点配置文件的服务器可以根据热点代码的获取请求中的指示信息选择热点配置文件。在本申请实施例中,该指示信息可以是由目标终端设备确定,并发送到生成热点配置文件的服务器。例如图2所示,由终端设备发送到服务器101,或者如图3所示,由终端设备发送到服务器1012,服务器1012将该指示信息发送到服务器1011。
在一种实施方式中,该指示信息可以是对所述目标应用程序的依赖指标。根据依赖指标与等级的对应关系,选择接收到的依赖指标对应的等级的热点配置文件返回,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低。
在该实施方式中,依赖指标表示的依赖程度越高,说明对目标终端设备的用户对该目标应用程序的依赖程度越高,用户对该目标应用程序的使用越频繁或者使用时间越长。
而用户对目标应用程序的依赖程度越高,则可能涉及到目标应用程序的功能越多,对目标应用程序的各个功能对应的代码运行越多。因此,对目标应用程序依赖程度越高,可以需要越多的热点代码,以使越多的代码可以被预先编译,使目标应用程序的性能更好,使用更流畅。
而对于对目标应用程序依赖程度低的用户,可能主要使用目标应用程序的基本功能或者核心功能,大多数功能可能并不会使用。而对于目标应用程序的基本功能或者核心功能,其对应的热点代码通常热度更高,因此,对于对目标应用程序依赖程度低的用户,可以获取较少但热度较高的热点代码,既满足用户的使用需求,又能降低编译时间。
在本申请实施例中,依赖指标的具体表现形式并不限定,在服务器接收到依赖指标时,能根据该依赖指标以及依赖指标与等级的对应关系,确定接收到的依赖指标对应的等级,从而将该依赖指标对应等级的热点配置文件返回。例如,依赖指标通过百分制量化,用数值0-100表示,数值越大,表示对目标应用程序的依赖程度越高,对应的等级越低。则可以将百分制划分为多份,分别对应不同等级。如服务器中包括5个等级的热点配置文件,依赖指标0-20对应第一等级,21-40对应第二等级,41-60对应第三等级,61-80对应第四等级,81-100对应第五等级,若服务器接收到目标终端设备对所述目标应用程序的依赖指标为55,在41-60的区间内,可以确定该依赖指标对应的为第三等级,将第三等级的热点配置文件返回。
在另一种实施方式中,该指示信息可以是目标数据量,表示目标终端设备获取数据量不超过该目标数据量的热点配置文件。服务器从多个不同等级的热点配置文件中选择数据量小于或等于该目标数据量的热点配置文件,选择的热点配置文件的数据量,大于其他数据量小于该目标数据量的热点配置文件。
在该实施方式中,目标终端设备可以根据自身存储空间剩余大小确定该目标数据量的值。例如,若目标终端设备的存储空间剩余量较小,难以支持较大的热点配置文件的编译和存储,可以请求一个数据量较小的热点配置文件。例如,可以将目标数据量设置为存储空间剩余量的一个合适的百分比,该百分比可以由用户或者相关开发人员设置。
在该实施方式中,目标终端设备也可以根据依赖指标确定目标数据量。例如可以根据预设公式进行计算;或者根据依赖指标与数据量的对应关系,确定目标终端设备对目标应用程序的依赖指标对应的数据量,作为目标数据量。
在本申请实施例中,将热点代码按照热度排序并划分梯度,根据梯度生成包括热点代码数量不同以及热度不同的不同等级热点配置文件。根据对热点配置文件的获取请求中的指示信息,从不同等级的热点配置文件选择一个等级的热点配置文件返回,以使请求热点配置文件的目标终端设备可以获取到平衡需求以及编译时间的热点配置文件。
本申请还提供了一实施例。在该实施例中,目标终端设备可以根据对目标应用程序的使用信息生成依赖指标,以获取到与依赖指标相对应的热点配置文件。请参见图6,该方法包括:
步骤S310:获取终端设备对目标应用程序的使用信息。
步骤S320:根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高。
终端设备可以获取自身对目标应用程序的使用信息,该使用信息表示了在终端设备对目标应用程序的使用情况,可以衡量对目标应用程序的依赖程度。若使用信息表示对目标应用程序的使用越多,则可以确定对目标应用程序的依赖程度越高。因此,可以根据使用信息确定目标应用程序的依赖指标。该终端设备为需要获取热点配置文件的目标终端设备。
步骤S330:向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件。其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
目标终端设备向与其网络连接的服务器发送对目标应用程序的热点代码的获取请求。如图2所示,目标终端设备可以直接将该获取请求发送到服务器101;如图3所示,目标终端设备可以将该获取请求发送到服务器1012,服务器1012再发送携带依赖指标的获取请求到服务器1011。
本申请实施例中,目标终端设备根据使用信息获取依赖指标,对目标应用程序的依赖程度越低,获取等级越高的热点配置文件,包括的热点代码热度越高,热点代码越少;对目标应用程序的依赖程度越高,获取等级越低的热点配置文件,包括的热点代码越多。从而,目标终端设备可以获取到对应自身实际使用需求的热点配置文件,平滑热点代码数量、热度以及编译时间。
本申请还提供了一实施例。在该实施例中,包括对依赖指标的确定。请参见图7,该方法包括:
步骤S410:获取终端设备对目标应用程序的使用信息。
步骤S420:根据使用信息与依赖指标的对应关系,选择终端设备对目标应用程序的使用信息对应的依赖指标,作为对所述目标应用程序的依赖指标。
在本申请实施例中,使用信息和依赖指标之间可以设置有对应关系,可以根据该对应关系,确定终端设备对目标应用程序的当前的使用信息所对应的依赖指标。
可选的,在本申请实施例中,若该终端设备是首次下载该目标应用程序,并未对该目标应用程序的使用,未生成有使用信息,则依赖指标可以设置为默认值,如默认为对应最高等级的依赖指标。
可选的,在本申请实施例中,也可以是,若目标终端设备是首次下载该目标应用程序,但是该目标终端设备登录的用户帐号对该目标应用程序进行过使用并生成对应的使用信息,则可以根据该用户帐号对该目标应用程序的使用信息确定依赖指标。
可选的,若目标终端设备是首次下载该目标应用程序,目标终端设备登录的用户帐号也未生成有对目标应用程序的使用信息,则依赖指标可以设置为默认值,如默认为对应最高等级的依赖指标。
在本申请实施例中,根据使用信息确定依赖指标,该使用信息可以是在该目标终端设备使用目标应用程序生成的,也可以是在该目标终端设备登录的用户账号使用目标应用程序生成的。可以理解的,若使用信息是在目标终端设备使用目标应用程序生成,目标终端设备可以是在卸载了目标应用程序后,重新下载目标应用程序时请求热点配置文件;也可以是在升级应用程序时,请求升级后的目标应用程序的热点配置文件。在请求升级后的目标应用程序的热点配置文件时,以升级前的使用信息作为升级后的目标应用程序的使用信息。
在一种实施方式中,对目标应用程序的使用次数越多,表明用户对目标应用程序的依赖程度越高,使用信息可以包括对目标应用程序的使用次数。其中,该使用次数的确定,可以是,用户将目标应用程序由后台或者由关闭切换到前台作为一次使用,或者是,由关闭到开启作为一次使用,在本申请实施例中并不限定。
在该实施方式中,可以设置有使用次数和依赖指标的对应关系,表示依赖程度越高的依赖指标,对应的使用次数越多。
在一种实施方式,对目标应用程序的使用时间越长,表明用户对目标应用程序的依赖程度越高,使用信息可以包括对目标应用程序的使用时长。其中,该使用时长的确定,可以是,用户目标应用程序在前台的运行时长,或者是,目标应用程序开启的时长,在本申请实施例中并不限定。
在该实施方式中,可以设置有使用时长和依赖指标的对应关系,表示依赖程度越高的依赖指标,对应的使用时长越多。该对应关系的表示形式并不限定,例如表格对应,公式对应。或者,也可以通过预先训练的算法模型进行对应,即在该算法模型中,对于输入的不同使用信息,可以输出相应的依赖指标。
在本申请实施例中,使用信息具体包括哪些并不限定,例如,还可以包括使用目标应用程序的功能数量,使用目标应用程序的功能越多,表示对目标应用程序的依赖程度越高。在功能数量与依赖指标的对应关系中,表示越高依赖程度的依赖指标,对应的功能数量越多。其中,功能的划分在本申请实施例中并不限定,可以由开发人员预先设置,例如在即时聊天软件中,通过聊天框聊天是一种功能,进行视频聊天、语音聊天、语音转文字输入、查看用户动态等设置为不同的功能。
在本申请实施例中,不同维度反应的使用信息,可以择一选择确定依赖指标,也可以彼此结合确定依赖指标,在本申请实施例中并不限定。
可选的,在本申请实施例中,依赖指标表示的依赖程度越高,从服务器请求到的热点配置文件的等级越低,数据量越大。但是,目标终端设备的性能可能不足以支持过大的热点配置文件的运行,或者过大的热点配置文件会影响目标终端设备的性能。因此,在本申请实施例中,还可以根据目标终端设备的性能参数,对根据使用信息确定的依赖指标进行调节。
其中,若性能参数所表示的性能较好,如大于或等于预设性能标准,则可以不更改根据使用信息确定的依赖指标。
若性能参数所表示的性能较差,如小于或等于预设性能标准,则可以将依赖指标调整到对应依赖程度更低的状态,以获取等级更高的热点配置文件。例如,以分值表示依赖指标,如百分制表示。获取目标终端设备的性能参数,若所述终端设备的性能参数所表示的性能小于预设性能标准,将所述依赖指标减小预设值。
可选的,表示不同性能的性能参数,对依赖指标的调整可以有不同。其中,性能参数表示目标终端设备性能越差,可以将依赖指标往依赖程度越低的方向调整。
具体的,可以将不同性能参数进行量化,将依赖指标量化。量化后的性能参数可以对应有依赖指标 的调整值,量化后的依赖指标调低该调整值对应的值。
例如,以目标终端设备的存储空间剩余量表示性能参数,以一个存储量表示预设性能标准,以百分制表示依赖指标。存储空间剩余量大于预设性能标准,可以不对依赖指标进行调整;若存储空间剩余量小于预设性能标准,存储空间剩余量越少,对应的调整值越大,依赖指标降低该调整值。其中,不同的存储空间剩余量可以对应有相应的调整值。
又如,以目标终端设备的处理器性能表示性能参数,可以通过处理器的处理速度对处理器性能进行量化,以一个预设处理速度作为预设性能标准。以百分制表示依赖指标。处理器的处理速度大于预设处理速度,可以不对依赖指标进行调整;若处理器的处理速度小于预设处理速度,处理器的处理速度越小,对应的调整值越大,依赖指标降低该调整值。其中,不同的处理速度可以对应有相应的调整值。
在本申请实施例中,性能参数具体包括哪些并不限定,不同的性能参数可以选择性地作为依赖指标的调整标准,也可以综合考量对依赖指标进行调整。
步骤S430:向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件。
在本申请实施例中,终端设备可以在下载目标应用程序的安装包时,向所述向服务器发送对所述目标应用程序的热点代码的获取请求。该下载可以是更新时的下载,也可以是首次安装或者重新安装时的下载。
在一种实施方式中,如图2所示,目标终端设备可以向服务器101请求下载安装包,并发送对所述目标应用程序的热点代码的获取请求。目标终端设备从服务器101接收返回的热点配置文件。
在一种实施方式中,如图3所示,目标设备终端设备可以向服务器1012请求下载安装包,并发送对所述目标应用程序的热点代码的获取请求。服务器1012从服务器1011获取热点配置文件,目标终端设备从服务器1012接收返回的热点配置文件。
在一种实施方式中,如图3所示,目标设备终端设备可以向服务器1012请求下载安装包,并向服务器1011发送对所述目标应用程序的热点代码的获取请求。从服务器1012获取安装包,从服务器1011获取热点配置文件。
目标终端设备可以接收到返回的热点配置文件,可以对热点配置文件进行编译,例如通过AOT编译,将编译后的文件存储。
可选的,可以在应用程序安装过程中进行热点代码的编译,不同等级的热点配置文件,编译时长不同。
本申请实施例中,定义向服务器发送热点代码获取请求的终端设备为目标终端设备。目标终端设备可以根据使用信息和依赖指标的对应关系,确定对目标应用程序的依赖指标。从而,可以在发送对目标应用程序的热点代码的获取请求时携带依赖指标,以使服务器返回适合该依赖指标对应的依赖程度的热点配置文件。在目标终端设备中安装该目标应用程序时,可以使用获得的热点配置文件中的热点代码作为该目标应用程序的热点代码,提高目标应用程序的运行效率,从而提高了目标应用程序的性能。
本申请实施例还提供了一种热点代码处理装置500,可以应用于服务器。请参见图8,该装置500包括:第一文件获取模块510,用于从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件;第二文件获取模块520,用于根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数;请求响应模块530,用于在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个 不同等级的热点配置文件中选择一个等级的热点配置文件返回。
可选的,第二文件获取模块520可以包括排序单元,用于将所述多个热点代码文件中的各个不同热点代码按照在所述多个热点代码文件中的出现次数进行由高到低排序;梯度划分单元,用于将排序后的热点代码依次划分为多个梯度,非排序最靠前的每个梯度包括前一梯度的所有热点代码以及与前一梯度不同的热点代码;文件生成单元,用于将每个梯度的热点代码生成一个热点配置文件,其中,梯度的排序越靠前,对应生成的热点配置文件等级越高。
可选的,梯度划分单元可以用于根据梯度与数据量的对应关系,划分每个梯度包括的热点代码的总数据量小于或等于所述梯度对应的数据量。
可选的,获取请求中可以携带有对所述目标应用程序的依赖指标。请求响应模块530可以用于根据依赖指标与等级的对应关系,选择接收到的依赖指标对应的等级的热点配置文件返回,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低。
本申请实施例还提供了一种热点代码请求装置600,可以应用于终端设备。请参见图9,装置600可以包括:信息获取模块610,用于获取终端设备对目标应用程序的使用信息;指标确定模块620,用于根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高;请求模块630,用于向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
可选的,指标确定模块620用于根据使用信息与依赖指标的对应关系,选择终端设备对目标应用程序的使用信息对应的依赖指标,作为对所述目标应用程序的依赖指标。
可选的,所述使用信息可以包括对所述目标应用程序的使用次数,或对所述目标应用程序的使用时长。
可选的,依赖指标可以为分值。该装置还可以包括指标调整模块,用于获取所述终端设备的性能参数;若所述终端设备的性能参数所表示的性能小于预设性能标准,将所述依赖指标减小预设值。
可选的,请求模块630可以用于在下载所述目标应用程序的安装包时,向所述向服务器发送对所述目标应用程序的热点代码的获取请求。
在本申请实施例中,可以由终端设备主动发起请求热点配置文件的方式,即由终端设备确定依赖指标,以请求合适大小的热点配置文件,避免了热点配置文件千篇一律的分发,在尽可能给用户造成小的影响同时,又尽可能给用户带来更合理的优化体验。
需要说明的是,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。另外,方法实施例中的各种实施方式,都可以对应有相应的模块,在本申请实施例中不再一一赘述。
在本申请所提供的几个实施例中,所显示或讨论的模块相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参考图10,其示出了本申请实施例提供的一种电子设备700的结构框图。该电子设备可以是服务 器,也可以是终端设备。
本申请中的电子设备700可以包括一个或多个如下部件:处理器710、存储器720,以及一个或多个程序,其中一个或多个程序可以被存储在存储器720中并被配置为由一个或多个处理器710执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
处理器710可以包括一个或者多个处理核。处理器710利用各种接口和线路连接整个电子设备700内的各个部分,通过运行或执行存储在存储器720内的指令、程序、代码集或指令集,以及调用存储在存储器720内的数据,执行电子设备700的各种功能和处理数据。可选地,处理器710可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器710可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器710中,单独通过一块通信芯片进行实现。
存储器720可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。存储器720可用于存储指令、程序、代码、代码集或指令集。存储器720可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。例如,存储器720中可以存储有处理热点代码的装置和请求热点代码的装置。其中,该处理热点代码的装置可以为前述的装置500,该请求热点代码的装置可以为前述的装置600。存储数据区还可以存储电子设备700在使用中所创建的数据等。
请参考图11,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种热点代码处理方法,其特征在于,所述方法包括:
    从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件;
    根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数;
    在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,包括:
    将所述多个热点代码文件中的各个不同热点代码按照在所述多个热点代码文件中的出现次数进行由高到低排序;
    将排序后的热点代码依次划分为多个梯度,非排序最靠前的每个梯度包括前一梯度的所有热点代码以及与前一梯度不同的热点代码;
    将每个梯度的热点代码生成一个热点配置文件,其中,梯度的排序越靠前,对应生成的热点配置文件等级越高。
  3. 根据权利要求2所述的方法,其特征在于,所述将排序后的热点代码依次划分为多个梯度,包括:
    根据梯度与数据量的对应关系,划分每个梯度包括的热点代码的总数据量小于或等于所述梯度对应的数据量。
  4. 根据权利要求2所述的方法,其特征在于,所述将排序后的热点代码依次划分为多个梯度,包括:
    根据梯度与数量的对应关系,划分每个梯度包括的热点代码的数量小于或等于所述梯度对应的数量。
  5. 根据权利要求2所述的方法,其特征在于,所述热点代码文件中包括热点代码的代码标识;
    所述将所述多个热点代码文件中的各个不同热点代码按照在所述多个热点代码文件中的出现次数进行由高到低排序,包括:
    根据代码标识集合中各热点代码的代码标识,从代码块集合中获取热点代码,形成对应所述多个热点代码文件的热点集合,其中,所述代码标识集合为所述多个热点代码文件的热点代码的代码标识的集合,所述代码块集合为所述目标应用程序的代码中所有的代码块的集合;
    根据所述热点集合,统计获取到的热点代码中每个热点代码出现的出现次数,将所述 多个热点代码文件中的各个不同热点代码按照所述出现次数进行由高到低排序。
  6. 根据权利要求1-5任一所述的方法,其特征在于,所述获取请求中携带有对所述目标应用程序的依赖指标;
    所述根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回,包括:
    根据依赖指标与等级的对应关系,选择接收到的依赖指标对应的等级的热点配置文件返回,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低。
  7. 根据权利要求6所述的方法,其特征在于,所述获取请求中携带有目标数据量;
    所述根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回,包括:
    根据所述目标数据量,从所述多个不同等级的热点配置文件中选择数据量小于或等于所述目标数据量的热点配置文件返回,其中,选择的热点配置文件的数据量大于其他数据量小于所述目标数据量的热点配置文件。
  8. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    根据所述依赖指标与数据量的对应关系,选择与接收到的依赖指标对应的数量作为所述目标数据量。
  9. 根据权利要求1所述的方法,其特征在于,所述从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件,包括:
    向所述多个终端设备发送热点代码文件获取请求,其中,所述热点代码文件获取请求中携带需要获取的目标应用程序的程序标识;
    根据所述热点代码文件获取请求中的程序标识,从所述多个终端设备中获取与所述程序标识对应的目标应用程序的热点代码文件,获得多个热点代码文件。
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述方法还包括:
    按照预设更新频率更新所述多个终端设备中的目标应用程序的热点代码,其中,所述多个终端设备中的目标应用程序为同一版本同一名称的应用程序。
  11. 一种热点代码请求方法,其特征在于,所述方法包括:
    获取终端设备对目标应用程序的使用信息;
    根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高;
    向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
  12. 根据权利要求11所述的方法,其特征在于,根据所述使用信息确定对所述目标应用程序的依赖指标,包括:
    根据使用信息与依赖指标的对应关系,选择终端设备对目标应用程序的使用信息对应的依赖指标,作为对所述目标应用程序的依赖指标。
  13. 根据权利要求11或12所述的方法,其特征在于,所述使用信息包括对所述目标应用程序的使用次数、对所述目标应用程序的使用时长以及使用所述目标应用程序的功能数量中的至少一种。
  14. 根据权利要求11所述的方法,其特征在于,所述依赖指标为分值,所述向服务器发送对所述目标应用程序的热点代码的获取请求之前,所述方法还包括:
    获取所述终端设备的性能参数;
    若所述终端设备的性能参数所表示的性能小于预设性能标准,将所述依赖指标减小预设值。
  15. 根据权利要求14所述的方法,其特征在于,所述性能参数包括多种表示不同性能的性能参数,所述多种表示不同性能的性能参数对应不同的依赖指标的调整值。
  16. 根据权利要求11所述的方法,其特征在于,在下载所述目标应用程序的安装包时,向所述服务器发送对所述目标应用程序的热点代码的获取请求。
  17. 一种热点代码处理装置,其特征在于,所述装置包括:
    第一文件获取模块,用于从多个终端设备中获取目标应用程序的热点代码文件,获得多个热点代码文件;
    第二文件获取模块,用于根据所述多个热点代码文件中的热点代码,生成多个不同等级的热点配置文件,其中,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等级的热点配置文件中的热点代码相同,第二部分热点代码在所述多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数;
    请求响应模块,用于在接收到对所述目标应用程序的热点代码的获取请求时,根据所述获取请求,从所述多个不同等级的热点配置文件中选择一个等级的热点配置文件返回。
  18. 一种热点代码请求装置,其特征在于,所述装置包括:
    信息获取模块,用于获取终端设备对目标应用程序的使用信息;
    指标确定模块,用于根据所述使用信息确定对所述目标应用程序的依赖指标,其中,所述使用信息表示对所述目标应用程序使用越多,对应所述使用信息的依赖指标表示的依赖程度越高;
    请求模块,用于向服务器发送对所述目标应用程序的热点代码的获取请求,所述获取请求中携带所述依赖指标,用于向所述服务器请求所述依赖指标对应的等级的热点配置文件,其中,依赖指标表示依赖程度越高,选择的热点配置文件的等级越低,非最高等级的热点配置文件包括第一部分热点代码以及第二部分热点代码,第一部分热点代码与高一等 级的热点配置文件中的热点代码相同,第二部分热点代码在多个热点代码文件中的出现次数低于或等于第一部分热点代码在所述多个热点代码文件中的出现次数。
  19. 一种电子设备,其特征在于,所述电子设备包括:
    一个或多个处理器;
    存储器,与所述一个或多个处理器电连接;
    一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1至16任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1至16任一项所述的方法。
PCT/CN2020/137667 2019-12-31 2020-12-18 热点代码处理方法、请求方法、装置及电子设备 WO2021135988A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911408512.0A CN113126995A (zh) 2019-12-31 2019-12-31 热点代码处理方法、请求方法、装置及电子设备
CN201911408512.0 2019-12-31

Publications (1)

Publication Number Publication Date
WO2021135988A1 true WO2021135988A1 (zh) 2021-07-08

Family

ID=76687335

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/137667 WO2021135988A1 (zh) 2019-12-31 2020-12-18 热点代码处理方法、请求方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN113126995A (zh)
WO (1) WO2021135988A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589729A (zh) * 2015-12-28 2016-05-18 北京锐安科技有限公司 一种基于嵌入式虚拟机的动态编译的方法及装置
CN106502876A (zh) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 一种热点函数确定的方法及相关设备
CN106775893A (zh) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 对程序预编译的方法及装置
US20190171423A1 (en) * 2017-02-06 2019-06-06 International Business Machines Corporation Reconstructing a High Level Compilable Program from an Instruction Trace
CN109960507A (zh) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 编译优化方法、装置、存储介质、智能终端及服务器
CN110609689A (zh) * 2019-08-23 2019-12-24 北京安云世纪科技有限公司 一种应用的安装运行方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589729A (zh) * 2015-12-28 2016-05-18 北京锐安科技有限公司 一种基于嵌入式虚拟机的动态编译的方法及装置
CN106502876A (zh) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 一种热点函数确定的方法及相关设备
CN106775893A (zh) * 2016-12-30 2017-05-31 北京小米移动软件有限公司 对程序预编译的方法及装置
US20190171423A1 (en) * 2017-02-06 2019-06-06 International Business Machines Corporation Reconstructing a High Level Compilable Program from an Instruction Trace
CN109960507A (zh) * 2017-12-14 2019-07-02 广东欧珀移动通信有限公司 编译优化方法、装置、存储介质、智能终端及服务器
CN110609689A (zh) * 2019-08-23 2019-12-24 北京安云世纪科技有限公司 一种应用的安装运行方法及装置

Also Published As

Publication number Publication date
CN113126995A (zh) 2021-07-16

Similar Documents

Publication Publication Date Title
CN110941424B (zh) 编译参数优化方法、装置及电子设备
US11818224B2 (en) On demand resources
CN111078318B (zh) 配置文件的处理方法、装置、系统及存储介质
KR102600025B1 (ko) 프리캐싱을 위해 클라이언트 머신들 간에 셰이더들을 분배하는 것
CN111061484A (zh) 代码编译方法、装置、服务器、用户终端及可读介质
WO2010052829A1 (ja) 資源割付方法、プログラム、及び資源割付装置
WO2021135947A1 (zh) 热点代码处理方法、装置、电子设备及存储介质
CN107832100A (zh) 一种apk插件的加载方法及其终端
WO2016196338A1 (en) On demand resources
WO2021115177A1 (zh) 应用安装方法、装置、终端设备、服务器及存储介质
CN110888658B (zh) 应用程序中功能模块的动态化方法、装置及存储介质
CN105511962A (zh) 渲染方法和装置
CN111078585B (zh) 一种内存缓存管理方法、系统、存储介质及电子设备
CN105187514B (zh) 云端应用程序的管理方法及其系统
WO2021135988A1 (zh) 热点代码处理方法、请求方法、装置及电子设备
EP3748493B1 (en) Method and device for downloading installation-free application
EP4258169A1 (en) Model training method, apparatus, storage medium, and device
CN111314446B (zh) 一种资源更新方法、装置、服务器及存储介质
WO2021136012A1 (zh) 热点代码处理方法、装置、服务器及存储介质
CN112540768A (zh) 文件处理方法、装置、服务器、电子设备及存储介质
WO2021121188A1 (zh) 配置文件的处理方法、装置、系统及存储介质
CN117311909B (zh) 虚拟场景的资源处理方法、装置、设备及存储介质
CN112217853B (zh) 一种资源访问方法和装置
KR100738326B1 (ko) 무선 환경에서 사용 패턴 분석을 이용한 선인출 기반의소프트웨어 스트리밍 서비스 시스템 및 그 방법과, 그를이용한 무선 단말기에서의 소프트웨어 스트리밍 방법
KR20210126411A (ko) 개인화된 선호도 학습을 통한 무선 데이터 캐싱 방법 및 장치

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

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

Country of ref document: EP

Kind code of ref document: A1