Specific embodiment
Types of applications on mobile terminals, due to a large number of services Quick thread, causes opening using cold-start phase at present
Dynamic performance is undesirable, and then influences the usage experience of user.And in order to improve user to the usage experience of application, traditional optimization
Scheme can optimize UI layout or Optimized code structure, with this come promoted using cold start-up starting performance, reduce application it is cold
Time required for starting.However this traditional prioritization scheme produces little effect, such as may only only reduce 10ms using cold
Time required for starting, and can also consume a large amount of time and efforts of developer.
In view of the above-mentioned problems, this specification is accounted for from another angle, measured by tool, discovery application cold start-up rank
Expend that (magnetic disc i/o reads from disk the data of certain section of sector or to magnetic by instructing in magnetic disc i/o the section plenty of time
Data are written in disk section sector, instructing is usually that notice disk starts sector position, then provides needs from this initial fan
The contiguous sector number of area backward, while providing corresponding operation: it reads or writes, disk receives this instruction, will be according to instruction
Requirement, read data perhaps write data single reading according to or once to write data be exactly a magnetic disc i/o) on, the reason is that using
In cold-start phase, can there is a large amount of file read-write operations, more true magnetic disc i/o has occurred, if it is possible to it is less this
The number of a little magnetic disc i/os, has entire starting performance and is obviously improved, and then promotes the usage experience of overall applicability.
On mobile terminals, for example, the first floor system of android system is linux system, Linux file system exists
Caching mechanism (Page Cache, page cache memory, abbreviation page height is slow, is typically sized to 4K, in reading and writing of files, it
For the logic content of cache file, to accelerate the access to image on disk and data), data are read from disk every time
When, Linux file system default goes to read according to 16*4K size, and the data of reading are put into caching, if next time reads
In the buffer, then true magnetic disc i/o will not occur for the corresponding data of file, but directly read from caching, compare
In reading data from caching, data are read from disk and need to expend the more time.Assuming that the file that next time reads, in text
Part arrangement layout in, behind the file specifically read, then it by maximum probability specifically read file when just by simultaneously from
It reads corresponding data in disk to be placed into caching, to reduce primary true magnetic disc i/o.For example, for A, B two
A each 1K of file, if B comes behind A, when reading A file, the reading space of 16*4K can read from disk
It takes and reads B file corresponding data while A file corresponding data and be placed into caching, when reading B file in this way, Bu Huifa
Raw true magnetic disc i/o reads the corresponding data of B file directly from caching.
According to this thinking, if can measure using cold-start phase, required file when using cold start-up, by right
The adjustment of file layout will come together using file required when being cold-started, and using caching mechanism, can effectively reduce true
The number of real magnetic disc i/o.Because for generally apply included file, file layout substantially according to default a-z,
The sequence of 0-9 is ranked up, and irregular may be present in using file needed for cold-start phase and be applied in included file,
Such as required file is file A, file B, file C, size is respectively 1K, based on initial file layout, is added when using cold start-up
3 true magnetic disc i/os occur for file needed for carrying, if adjustment file layout, file A, file B, file C are come together,
1 true magnetic disc i/o occurs for file needed for loading when using cold start-up, it can be seen that is effectively reduced true magnetic disc i/o
Number, and then can be promoted using starting performance, reduce the time required for application is cold-started.
Based on above-mentioned analysis, this specification embodiment provides a kind of technical solution for adjusting file layout, for be optimized
Application, the corresponding file identification of required file, determines the first file identification list and second when determining application cold start-up
File identification list, wherein the first file identification list and the second file identification list can be according to the application cold start-up when institutes
It needs the corresponding file identification of file to obtain, the first file identification list and the second file identification list is integrated, root
According to integrated results, the corresponding current file layout of All Files that the application to be optimized includes is adjusted, it is subsequent to be somebody's turn to do
When using cold start-up next time, true magnetic disc i/o can be effectively reduced using caching mechanism based on file layout adjusted
Number is promoted and applies cold starting performance, reduces the time required for application is cold-started.For developer, due to not being related to
The optimization of application source code can save developer and optimize time and efforts spent by application source code.
Specifically, the technical solution that this specification embodiment provides is as follows:
Determine application to be optimized;For the application to be optimized, the application cold start-up when institute to be optimized is determined
Need the corresponding file identification of file;Determine the first file identification list and the second file identification list, first files-designated
Know list are as follows: be made of described to be optimized using the corresponding file identification of file required when being cold-started, second files-designated
Know list are as follows: be made of the corresponding file identification of remaining file in addition to required file that the application to be optimized includes;
The first file identification list and the second file identification list are integrated;According to integrated results, to described to be optimized
It is adjusted using the current file layout for the All Files for including.
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
As shown in Figure 1, a kind of flow diagram of the file layout method of adjustment provided for this specification embodiment, the party
Method can specifically include following steps:
S101 determines application to be optimized;
In the present specification, game class application is installed simultaneously on mobile terminal, social category is applied, video playback class is answered
It, can be with when needing the cold-start phase to a certain kind application to optimize with the application of, instant messaging class, shopping class application etc.
Certain application is manually specified, or can determine application to be optimized by way of instruction, that is, is manually entered instruction, in instruction
The mark for carrying the application can determine application to be optimized by the mark carried in the instruction when receiving the instruction,
Such as determine that application to be optimized is Alipay.Specifically determine that the implementation of application to be optimized has many kinds, this explanation
This is no longer going to repeat them for book embodiment.
S102 determines that required file is corresponding when the application to be optimized is cold-started for the application to be optimized
File identification;
For application to be optimized identified in S101, determine that required file is corresponding when the application to be optimized is cold-started
File identification.It is more specifically to determine that the implementation using the corresponding file identification of file required when being cold-started to be optimized has
Kind, two of them implementation is illustrated in this specification:
One of which determines the implementation using the corresponding file identification of file required when being cold-started to be optimized are as follows:
Current file layout based on the All Files that the application to be optimized includes, when the acquisition application to be optimized is cold-started
Generated file loads log, the load record of the required file recorded in resolution file load log, with determine it is described to
Required file corresponding file identification when the application cold start-up of optimization.In order to facilitate the determining application cold start-up when institute to be optimized
Record text while file needed for needing the corresponding file identification of file, this specification to load in application cold start-up file load phase
Part loads log.When current file of the application based on All Files is laid out cold start-up, file load log can be generated accordingly,
Obtain generated file load log when application cold start-up, the load of the required file recorded in resolution file load log
Record, load record include at least load time of required file, the file name of required file and size, file directory,
Apply Names etc., it is therefrom available needed for file file name and size, i.e., needed for file file identification, it is possible thereby to
Determine required file corresponding file identification when application cold start-up to be optimized.
For example, including 10 files for application A, this current 10 file defaults are ranked up with the sequence of a-z, are based on
The current file of file is laid out, and file needed for loading using A cold start-up file load phase is 4 files, when being cold-started using A
Load document generates file and loads log, the load record of the file needed for parsing in file load log, therefrom available
The file name and size of this 4 files, such as A (1K), C (2K), D (1K), F (2K).
Another determines the implementation using the corresponding file identification of file required when being cold-started to be optimized are as follows:
The script compiled in advance is obtained, which is used to file behavior when statistics application is cold-started, and whether file behavior, that is, file occurs
Whether true magnetic disc i/o and file have hit caching, and the file that magnetic disc i/o and hit caching occurs is that application is cold
Required file when starting can be counted using this script using the corresponding listed files of file needed for cold-start phase, text
Part offset and be that true magnetic disc i/o occurs or has hit caching, according to the available each file of this document list
Corresponding file identification, it can determine required file corresponding file identification when the application cold start-up to be optimized.
For example, as shown in table 1 below, hit caching is 0, and it is 1 that true magnetic disc i/o, which has occurred,.
Table 1
Required file corresponding file identification when the application cold start-up to be optimized available by above-mentioned listed files.?
It determines when the application cold start-up to be optimized after the corresponding file identification of required file, it can be according to these file identifications to working as
Preceding document layout is adjusted.
S103 determines the first file identification list and the second file identification list, the first file identification list are as follows:
It is made of described to be optimized using the corresponding file identification of file required when being cold-started, the second file identification list are as follows:
It is made of the corresponding file identification of remaining file in addition to required file that the application to be optimized includes;
For the corresponding file identification of required file, Ke Yiyi when the application cold start-up to be optimized determined by S102
According to these file identifications, the first file identification list and the second file identification list are determined.
First file identification list, required file corresponding file identification group when being cold-started by the application to be optimized
At, and the corresponding file identification of the required file is ranked up to obtain.It preferably, can be to be optimized using cold according to this
The load time sequence of required file, is ranked up the corresponding file identification of required file, an available text when starting
Part identification list.
For example, the load time of required file is sequentially, corresponding to required file when being cold-started according to the application to be optimized
File identification be ranked up, an available file identification list, this file identification list may is that A, C, D, F, J,
K, it is meant that in file load time sequence, the load time sequence of file A makes number one, and the load time of file C is suitable
Sequence comes second, and so on.
Second file identification list, the remaining file in addition to required file for including by the application to be optimized are corresponding
File identification composition, and according to original default sort rule, to the application to be optimized include in addition to required file
The corresponding file identification of remaining file be ranked up to obtain, i.e., be ranked up using initial ordering rule, such as originally pressed
It is ranked up according to a-z, 0-9 default sort rule, then these corresponding file identifications of residue file are still defaulted according to a-z, 0-9
Ordering rule is ranked up to obtain the second file identification list.
For example, remaining file is to ask valence B, file E, file G, file H, file I in addition to required file, corresponding to
File identification are as follows: B, E, G, H, I, then these corresponding file identifications of residue file are still according to a-z, 0-9 default sort rule
The second file identification list being ranked up are as follows: B, E, G, H, I.
S104 integrates the first file identification list and the second file identification list;
First file identification list and the second file identification list are integrated, the list of third file identification, tool are generated
First file identification list can be punctured into any position in the second file identification list by body, generate third file identification column
First file identification list is considered as an entirety by table, be punctured into head, tail portion, the middle part etc. of the second file identification list
Any position, it is possible thereby to generate a new file identification list.
For example, the first file identification list is: A, C, D, F, J, K, the second file identification list is: B, E, G, H, I, by
One file identification list is punctured into the second file identification list behind B, and the third file identification list of generation is: B, A, C, D,
F、J、K、E、G、H、I。
S105 carries out the current file layout for the All Files that the application to be optimized includes according to integrated results
Adjustment.
, can be according to the integrated results for integrated results obtained in S104, the institute for including to the application to be optimized
Documentary current file layout is adjusted, i.e., according to the integrated results, the All Files for including to the application to be optimized
Distributing order be adjusted.
For example, according to the integrated results, i.e. third file identification list: B, A, C, D, F, J, K, E, G, H, I, adjustment application
Including file A, file B, file C, file D, file E, file F, file G, file H, file I, file J, file K arrangement
Sequentially, file layout adjusted are as follows: file B, file A, file C, file D, file F, file J, file K, file E, file
G, file H, file I.
The file one that application (by taking android system as an example) for the application on mobile terminal, such as on mobile phone includes
As be all it is existing in a compressed format, if APK (Android Package, installation kit) file is zip format in fact, to reality
Now to the adjustment of file layout, need tool of compression to be called, by third file by tool of compression, such as 7-Zip tool of compression
Identification list imports the tool of compression, executes the compressing file function of the tool of compression, can be subsequent according to third file identification
List, changes the distributing order of All Files, to achieve the purpose that be adjusted file layout.
It can will be so arranged together using file required when being cold-started, less true disk can occur in this way
I/O when subsequent applications next time is cold-started, is based on file layout adjusted, cold since less true magnetic disc i/o occurs
Start starting performance to be promoted, effectively reduce the time of cold start-up consumption, wherein Contrast on effect is as shown in table 2 below:
Table 2
By the description of the above-mentioned technical solution provided this specification embodiment, for application to be optimized, determining should
Using the corresponding file identification of file required when being cold-started, the first file identification list and the second file identification list are determined,
The first file identification list and the second file identification list are integrated, according to integrated results, to described to be optimized
It is adjusted using the corresponding current file layout of the All Files for including, when subsequent this is cold-started using next time, based on adjustment
File layout afterwards can effectively reduce the number of true magnetic disc i/o using caching mechanism, promoted and apply cold starting performance, subtracted
Time required for few application is cold-started.For developer, due to not being related to the optimization of application source code, it can save open
Originator optimizes time and efforts spent by application source code.
Relative to above method embodiment, this specification embodiment also provides a kind of file layout adjustment device, referring to fig. 2
It is shown, the apparatus may include: using determining module 210, file identification determining module 220, identification list determining module 230,
Integrate module 240, file layout adjustment module 250.
Using determining module 210, for determining application to be optimized;
File identification determining module 220, for for the application to be optimized, determining described to be optimized open using cold
Required file corresponding file identification when dynamic;
Identification list determining module 230, it is described for determining the first file identification list and the second file identification list
First file identification list are as follows: it is made of described to be optimized using the corresponding file identification of file required when being cold-started, it is described
Second file identification list are as follows: the corresponding file of remaining file in addition to required file for including by the application to be optimized
Mark composition;
Module 240 is integrated, for integrating the first file identification list and the second file identification list;
File layout adjusts module 250, is used for the All Files for according to integrated results, including to the application to be optimized
Current file layout be adjusted.
According to a kind of specific embodiment that this specification provides, the file identification determining module 220 is specifically used for:
Current file layout based on the All Files that the application to be optimized includes, obtains the application to be optimized
Generated file loads log when cold start-up;
The load record of the required file recorded in resolution file load log, to be optimized is opened so that determination is described using cold
Required file corresponding file identification when dynamic.
According to a kind of specific embodiment that this specification provides, the module 240 of integrating is specifically used for:
The first file identification list is punctured into any position in the second file identification list.
According to this specification provide a kind of specific embodiment,
The first file identification list are as follows: the load time of required file when being cold-started according to the application to be optimized
Sequentially, the corresponding file identification of the required file is ranked up to obtain.
According to this specification provide a kind of specific embodiment,
The second file identification list are as follows: according to original default sort rule, include to the application to be optimized
The corresponding file identification of remaining file in addition to required file is ranked up to obtain.
The function of modules and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus
Realization process, details are not described herein.
By the description of the above-mentioned technical solution provided this specification embodiment, for application to be optimized, determining should
Using the corresponding file identification of file required when being cold-started, the first file identification list and the second file identification list are determined,
The first file identification list and the second file identification list are integrated, according to integrated results, to described to be optimized
It is adjusted using the corresponding current file layout of the All Files for including, when subsequent this is cold-started using next time, based on adjustment
File layout afterwards can effectively reduce the number of true magnetic disc i/o using caching mechanism, promoted and apply cold starting performance, subtracted
Time required for few application is cold-started.For developer, due to not being related to the optimization of application source code, it can save open
Originator optimizes time and efforts spent by application source code.
This specification embodiment also provides a kind of computer equipment, as shown in figure 3, the equipment may include: processor
310, memory 320, input/output interface 330, communication interface 340 and bus 350.Wherein processor 310, memory 320,
Input/output interface 330 and communication interface 340 pass through the communication connection between the realization of bus 350 inside equipment.
Processor 310 can use general CPU (Central Processing Unit, central processing unit), micro process
Device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one or
The modes such as multiple integrated circuits are realized, for executing relative program, to realize technical solution provided by this specification embodiment.
Memory 320 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 320 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 320, and execution is called by processor 310.
Input/output interface 330 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 340 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 350 includes an access, in various components (such as the processor 310, memory 320, input/output of equipment
Interface 330 and communication interface 340) between transmit information.
It should be noted that although above equipment illustrates only processor 310, memory 320, input/output interface
330, communication interface 340 and bus 350, but in the specific implementation process, which can also include realizing to operate normally
Necessary other assemblies.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising realizing in above equipment
Component necessary to this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
File layout method of adjustment above-mentioned is realized when sequence is executed by processor.This method includes at least:
A kind of file layout method of adjustment, this method comprises:
Determine application to be optimized;
For the application to be optimized, required file corresponding files-designated when the application cold start-up to be optimized is determined
Know;
Determine the first file identification list and the second file identification list, the first file identification list are as follows: by institute
State the corresponding file identification composition of required file when application cold start-up to be optimized, the second file identification list are as follows: by institute
State the corresponding file identification composition of the remaining file in addition to required file that application to be optimized includes;
The first file identification list and the second file identification list are integrated;
According to integrated results, the current file layout for the All Files that the application to be optimized includes is adjusted.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It is each to obtain computer equipment (can be personal computer, server or the network equipment etc.) execution this specification embodiment
Method described in certain parts of a embodiment or embodiment.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method
Part explanation.The apparatus embodiments described above are merely exemplary, wherein described be used as separate part description
Module may or may not be physically separated, can be each module when implementing this specification example scheme
Function realize in the same or multiple software and or hardware.Can also select according to the actual needs part therein or
Person's whole module achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not the case where making the creative labor
Under, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.