CN111008048B - File loading method and device and readable storage medium - Google Patents
File loading method and device and readable storage medium Download PDFInfo
- Publication number
- CN111008048B CN111008048B CN201911169207.0A CN201911169207A CN111008048B CN 111008048 B CN111008048 B CN 111008048B CN 201911169207 A CN201911169207 A CN 201911169207A CN 111008048 B CN111008048 B CN 111008048B
- Authority
- CN
- China
- Prior art keywords
- resource
- file
- class
- target
- files
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 59
- 238000000034 method Methods 0.000 claims description 26
- 230000006835 compression Effects 0.000 claims description 9
- 238000007906 compression Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 description 4
- 238000005259 measurement Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a file loading method, a file loading device and a readable storage medium, wherein the file loading method comprises the following steps: acquiring a plurality of resource files of a target application, and classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource, wherein the first-class resource comprises at least one resource file in the plurality of resource files; classifying the first class resources based on a second preset rule to obtain at least one second class resource; compressing at least one second-class resource to obtain at least one resource file package; and when detecting an operation instruction for running the target application, loading at least one resource file package to run the target application. By adopting the file loading mode, the loading speed of the resource file can be improved.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for loading a file, and a readable storage medium.
Background
Along with the popularization of intelligent terminals, resource files of various applications on the intelligent terminals are more and more, and the more and more resource files tend to cause the loading speed of the applications to be slower. For example, in the small game industry, with the development of the small game industry, the quality requirements of users on the small games are also higher and higher, and along with that, the resource files supporting the small game running are also more and more. In the running mode of the H5 environment, the more and the larger the resource files of the small game are, the slower the loading speed of the small game is, so that the running of the small game is affected.
It can be seen that how to increase the loading speed of application resource files becomes a problem to be solved.
Disclosure of Invention
The embodiment of the invention provides a file loading method, a file loading device and a readable storage medium.
In a first aspect, an embodiment of the present invention provides a file loading method, where the method includes:
acquiring a plurality of resource files of a target application, and classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource, wherein the first-class resource comprises at least one resource file in the plurality of resource files;
classifying the first class resources based on a second preset rule to obtain at least one second class resource;
compressing the at least one second class resource to obtain at least one resource file package;
and when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application.
In a second aspect, an embodiment of the present invention provides a file loading device, including:
the file acquisition module is used for acquiring a plurality of resource files of the target application;
the file classification module is used for classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource, wherein the first-class resource comprises at least one resource file in the plurality of resource files;
the file classification module is further configured to classify the first class resource based on a second preset rule to obtain at least one second class resource;
the file compression module is used for compressing the at least one second type resource to obtain at least one resource file package;
and the loading module is used for loading the at least one resource file package when detecting an operation instruction for running the target application so as to run the target application.
In a third aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes an input device and an output device, and the terminal device further includes a processor, and is adapted to implement one or more instructions, where the one or more instructions are adapted to be loaded by the processor and execute the file loading method described in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium, where instructions are stored, when the computer readable storage medium runs on a computer, to cause the computer to perform the file loading method described in the first aspect.
In the embodiment of the present application, the terminal device may obtain at least one first class resource by obtaining a plurality of resource files of the target application, classifying the plurality of resource files based on a first preset rule, and classifying the first class resource based on a second preset rule to obtain at least one second class resource, and compressing the at least one second class resource to obtain at least one resource file packet, so that when detecting an operation instruction for running the target application, the terminal device may load the at least one resource file packet to run the target application. By adopting the file loading mode, the resource file of the target application is loaded by calling the resource file package instead of a mode of calling a single resource file, so that the loading speed of the resource file can be improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a file loading method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another method for loading files according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a file loading device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the application, the terminal equipment can classify the resource files primarily by arranging the resource files corresponding to the target application, classify the resource files secondarily after the primary classification, combine the resource files classified secondarily into one resource file, and further compress the combined resource files to obtain at least one resource file package. And when detecting an operation instruction for running the target application, the terminal equipment loads the at least one resource file package so as to run the target application. Compared with the problem that in the prior art, the loading speed of the resource file is slow due to the fact that the resource file is too large, the method is beneficial to improving the speed of loading the resource file.
The technical scheme of the application can be used in terminal equipment, and the terminal equipment comprises, but is not limited to, mobile phones, tablet computers, notebook computers, desktop computers and other terminals.
Please refer to fig. 1, which is a flowchart illustrating a file loading method according to an embodiment of the present invention, the file loading method includes the following steps:
s101: and acquiring a plurality of resource files of the target application, and classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource.
Wherein the first type of resource comprises at least one (one or more) resource file of the plurality of resource files, and the number of resource files in the first type of resource is less than the number of resource files of the target application. Alternatively, the first preset rule may be to classify a plurality of resource files of the target application based on at least one application checkpoint, or may be to classify a plurality of resource files of the target application based on at least one application scenario.
In one embodiment, the target application includes at least one application checkpoint, each application checkpoint corresponds to at least one resource file of the target application, and the terminal device detects the number of resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint. Further, the terminal device may classify the plurality of resource files of the target application based on the number of resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint.
Optionally, the terminal device may classify the resources of the plurality of application checkpoints in the at least one application checkpoint into the first class of resources when detecting that the number of the corresponding resource files of each application checkpoint of the target application is smaller than the first number threshold and/or when detecting that the data size of the resource files corresponding to each application checkpoint is smaller than the first data size threshold. And/or, the terminal device may classify the resources of the single application checkpoint in the at least one application checkpoint as the first class resources when detecting that the number of the corresponding resource files of each application checkpoint of the target application is greater than or equal to the first number threshold, and/or when detecting that the data amount of the corresponding resource files of each application checkpoint is greater than or equal to the first data amount threshold. The first quantity threshold and the first data quantity threshold are obtained through measurement and calculation of experimental data, and the later stage can be adjusted according to actual conditions.
Illustratively, the first number threshold is 5, the first data amount threshold is 500k, and the target application a includes 10 application checkpoints. The terminal equipment detects that the number of the resource files of each application checkpoint in the target application A is 3, and the number of the resource files of each application checkpoint is smaller than 400k. For the target application a, the resource file of the target application a may be classified into 2 first class resources, which is specifically shown in table 1:
TABLE 1
The target application B comprises 10 application checkpoints, the number of resource files of each application checkpoint in the target application B is 8, and the number of resource files of each application checkpoint is more than 800k. For the target application B, since the data amounts of the resource files of the application checkpoints are inconsistent, the classification may be performed based on the data amounts of the resource files of the application checkpoints (i.e., when the data amounts of the resource files of the application checkpoints are large, a single application checkpoint may be a class, and when the data amounts of the resource files of the application checkpoints are small, a plurality of application checkpoints may be a class), so as to classify the resource files of the target application B into 3 first class resources, which is specifically shown in table 2:
TABLE 2
In one embodiment, the target application includes at least one application scenario, each application scenario corresponds to at least one resource file of the target application, and the terminal device detects the number of resource files corresponding to each application scenario and/or detects the data amount of the resource files corresponding to each application scenario. Further, the terminal device may classify a plurality of resource files of the target application based on the number of resource files corresponding to each application scenario and/or the data amount of the resource files corresponding to each application scenario, to obtain a first type of resource.
Specifically, the terminal device may classify the resources of the multiple application scenes in at least one application scene into the first class of resources when detecting that the number of the corresponding resource files of each application scene of the target application is smaller than the second number threshold and/or when detecting that the data amount of the resource files corresponding to each application scene is smaller than the second data amount threshold. And/or, the terminal device may classify the resources of the single application scenario in the at least one application scenario into the first class resources when detecting that the number of the corresponding resource files of each application scenario of the target application is greater than or equal to the second number threshold, and/or when detecting that the data amount of the resource files corresponding to each application scenario is greater than or equal to the second data amount threshold. The second data quantity threshold value and the second data quantity threshold value are obtained through measurement and calculation of experimental data, and can be adjusted according to actual conditions in the later period.
For example, the second number threshold is 20, the second number threshold is 1024k, the target application a includes 10 application scenarios, the terminal device detects that the number of resource files of each application scenario in the target application a is 15, and the number of resource files of each application scenario is less than 600k. For the target application a, the resource file of the target application a may be classified into 2 first class resources: application scenario 1-application scenario 5, application scenario 6-application scenario 10.
As shown in table 3:
TABLE 3 Table 3
The target application B comprises 10 application scenes, the terminal equipment detects that the number of resource files of each application scene in the target application B is 25, the resource files of the application scenes 1-7 are all more than 800k and less than 1024k, and the resource files of the application scenes 8-10 are all more than 1024k. For the target application B, since the data amounts of the resource files of the application scenes are inconsistent, the classification may be performed based on the data amounts of the resource files of the application scenes (i.e., when the resource files of the application scenes are large, a single application scene may be a class, and when the resource files of the application scenes are small, a plurality of application scenes may be a class), so as to classify the resource files of the target application B into 4 first class resources, which is specifically shown in table 4:
TABLE 4 Table 4
S102: classifying the first class resources based on a second preset rule to obtain at least one second class resource.
Wherein the second class of resources includes one or more resource files of the first class of resources. Optionally, the second preset rule may be to classify the resource files in the first type resource based on file format types of the respective resource files in the first type resource.
Specifically, the terminal device may obtain association information of the resource file in the first type resource, where the association information includes a file format type, and further, the terminal device may classify the resource file in the first type resource based on the file format type, to obtain the second type resource. The file format type may be one or more of txt format type, json format type, csv format type, and dat format type.
Illustratively, the plurality of target files of the target application a are classified according to the number of application checkpoints, so as to obtain at least one first-class resource of the target application a, where a certain first-class resource A1 includes resource files of the application checkpoint 1-application checkpoint 5. The terminal device obtains the file format types of the resource files in the first category resource A1, as shown in table 5:
TABLE 5
Further, the terminal device classifies the first-class resources A1 based on the file format types of the resource files to obtain 4 second-class resources, as shown in table 6:
TABLE 6
Second class resource A11 | Second class resource A12 | Second class resource A13 | Second class resource A14 |
1.txt | 1.json | 1.csv | 1.dat |
2.txt | 2.json | 2.csv | 2.dat |
3.txt | 3.json | 3.csv | 3.dat |
4.txt | 4.json | 4.csv | 4.dat |
5.txt | 5.json | 5.csv | 5.dat |
S103: and compressing the at least one second-class resource to obtain at least one resource file package.
Specifically, the terminal device may respectively combine the resource files in each second-class resource to obtain at least one second-class resource combined file, where the second-class resource corresponds to the second-class resource combined file one by one, and obtain association information of the at least one second-class resource combined file, where the association information includes a file calling sequence. Further, the terminal device may compress the at least one second-class resource merge file according to a file call order of the at least one second-class resource merge file. The second-class resource merge file may further record resource merge information, where the resource merge information may include information of an initial resource file before merging and information of a second-class resource merge file after merging, for example, the resource file 1 and the resource file 2 are merged into a resource file 3, and the resource merge information includes information of the initial resource file before merging (i.e., the resource file 1 and the resource file 2) and information of the second-class resource merge file after merging (i.e., the resource file 3).
For example, as shown in table 2, the terminal device respectively merges the resource files in each second-class resource to obtain 4 second-class resource merged files: the second-class resource merge file a11.Txt, the second-class resource merge file a12.Json, the second-class resource merge file a13.Csv, and the second-class resource merge file a14.Dat. Further, the terminal equipment acquires the file calling sequence of the 4 second-class resource merging files, and sorts the 4 second-class resource merging files according to the file calling sequence: the calling sequence of the second-class resource merging file A11.Txt is the same as that of the second-class resource merging file A12.Json, and is better than that of the second-class resource merging file A13.Csv, and is better than that of the second-class resource merging file A14.Dat. According to the file calling sequence, the terminal equipment compresses the 4 second type resource combined files into 3 resource file packages: the resource file package comprising the second-class resource merge file a11.Txt and the second-class resource merge file a12.Json, the resource file package comprising the second-class resource merge file a13.Csv, and the resource file package comprising the second-class resource merge file a14.Dat.
S104: and when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application.
The terminal device may invoke an engine of the target application to load the resource file package. For example, the target application is an HTML5 (hereinafter abbreviated as H5) based game application, and a game development engine of the game application may be, for example, a LAYA engine. The terminal equipment can update the engine source code in advance to enable the engine source code to support loading of the combined data, so that speed increasing is realized. For example, the source code of the LAYA engine can be updated, and when an operation instruction of running (starting, opening and triggering and starting by a user touch instruction) of the terminal equipment is detected, the loading of the at least one resource file package can be realized, and the LAYA engine source code is called to analyze the resource file packages of different types to support the running of the target application, so that the loading speed of the resource file of the target application is improved.
Alternatively, the terminal device performing step S104 may be the same terminal device as the terminal device performing steps S101-S103, for example, a test terminal device corresponding to a developer. The terminal device (e.g., the second terminal device) that performs step S104 may also be different from the terminal device (e.g., the first terminal device) that performs steps S101-S103, for example, the second terminal device may be a terminal device of a client that installs a target application, and the first terminal device may be a terminal device corresponding to a developer, which is not limited in this embodiment of the present invention.
If the terminal device performing step S104 (i.e. the second terminal device hereinafter) and the terminal device performing steps S101-S103 (i.e. the first terminal device hereinafter) are different terminal devices, the first terminal device may send the aforementioned at least one resource file package to the server for the second terminal device to load the at least one resource file package from the server for this case.
For example, in one application scenario, the target application corresponds to a game application, the first terminal device corresponds to a developer, the second terminal device corresponds to a client that installs the game application, and the first terminal device installs a game development engine LAYA. The first terminal equipment packages an H5-based game application through LAYA, and initially classifies resource files used by the game application to obtain first-class resources. The first terminal device may further reclassify the first class of resources to obtain a second class of resources. And the first terminal equipment respectively merges the second-class resources to obtain a plurality of second-class resource merging files, and records merging information in the second-class resource merging files. The first terminal equipment compresses at least one second-class resource merging file to obtain at least one resource file package, and the resource file package is sent to the server. The second terminal device may request to the server side to load at least one resource file package of the game application when the game application is running. By adopting the text loading method, the speed of loading the resource file by the second terminal equipment is improved. It can be seen that in addition, the following advantages can be achieved by adopting the scheme: the method can effectively reduce the problems of overlarge network request quantity and network request data quantity, save a large amount of disk access time, reduce the pressure of a server and save network traffic.
In the embodiment of the application, the terminal equipment acquires a plurality of resource files of the target application, and classifies the plurality of resource files based on a first preset rule to obtain at least one first-class resource. Further, the terminal device may classify the first class resource based on a second preset rule to obtain at least one second class resource, and compress the at least one second class resource to obtain at least one resource file package. And when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application. By adopting the file loading mode, the loading speed of the resource file can be improved.
Fig. 2 is a flow chart of another file loading method according to an embodiment of the present invention, where the file loading method includes the following steps:
s201: and acquiring a plurality of resource files of the target application, and classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource.
S202: classifying the first class resources based on a second preset rule to obtain at least one second class resource.
S203: and compressing the at least one second-class resource to obtain at least one resource file package.
The specific implementation of steps S201 to S203 may be described in detail in the foregoing embodiment steps S101 to S103, and will not be described herein.
S204: and detecting the data quantity of the at least one resource file package, and if the data quantity of the resource file package meets the compression adjustment condition, carrying out compression adjustment on the at least one second-class resource according to the data quantity of the resource file package to obtain at least one resource file package.
In one embodiment, the terminal device detects the data volume of each resource file package, if any resource file package is greater than the third data volume threshold, the resource file package is determined to be a target resource file package, and the target second-class resource merging file corresponding to the target resource file package is queried, and the target resource file package is deleted. The terminal equipment splits the target second-class resource merging file to obtain at least two third-class resource files, and compresses at least one third-class resource file to obtain at least one resource file package. By adopting the mode, the condition that the resource loading fails due to the overlarge resource file package is avoided. The third data volume threshold is obtained through experimental data measurement and calculation, and can be adjusted according to actual conditions in the later period.
For example, the third data amount threshold is 4M, the terminal device detects the data amount of each resource file package, and if detecting that the data amount of the resource file package a11 is greater than 4M, the terminal device confirms the resource file package a11 as a target resource file package, and queries the target second-class resource merge file A1 corresponding to the resource file package a11 through the index. The terminal equipment splits the target second-class resource merging file A1 into 2 third-class resource files A1 'and A1', and compresses the third-class resource files A1 'and A1', respectively, to obtain resource file packages corresponding to the 2 third-class resource files.
In one embodiment, the terminal device detects the data volume of each resource file package, if it detects that the data volume of any one resource file package is smaller than the fourth data volume threshold, determines the resource file package as a target resource file package, and queries a target first-class resource corresponding to the target resource file package. The terminal equipment detects the data quantity of each resource file packet corresponding to the first-class resource, and further, the terminal equipment can compress at least two second-class resource merging files according to the data quantity of the resource file packet to obtain a resource file packet to replace an original resource file packet corresponding to the target first-class resource. The fourth data quantity threshold is obtained through experimental data measurement and calculation, and can be adjusted according to actual conditions in the later period.
For example, the fourth data amount threshold is 1M, the terminal device detects the data amount of each resource file packet, and if the detected data amount of the resource file packet a11 is less than 1M, the resource file packet a11 is confirmed as a target resource file packet, and the target first-class resource A1 corresponding to the resource file packet a11 is queried through the index. The terminal equipment detects that the resource file packet corresponding to the target first-class resource A1 is 900k of the data volume of the resource file packet A11, 1.2M of the data volume of the resource file packet A12 and 3.3M of the data volume of the resource file packet A13. Further, the terminal device may compress the second-class resource merge file a11 and the second-class resource merge file a12 into the same resource file package to replace the original resource file package a11 and the resource file package a12.
S205: and when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application.
The specific implementation of step S205 may be described in detail in the foregoing embodiment of step S104, which is not described herein.
In the embodiment of the application, the terminal equipment acquires a plurality of resource files of the target application, and classifies the plurality of resource files based on a first preset rule to obtain at least one first-class resource. Further, the terminal device may classify the first class resource based on a second preset rule to obtain at least one second class resource, and compress the at least one second class resource to obtain at least one resource file package. Furthermore, the terminal device may detect the data amount of the at least one resource file packet, and if the data amount of the resource file packet meets the compression adjustment condition, recompress the at least one second-class resource according to the data amount of the resource file packet, so as to obtain at least one resource file packet. And when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application. By adopting the file loading mode, the loading speed of the resource file can be improved.
Based on the description of the embodiment of the method, the embodiment of the invention also provides a file loading device. Referring to fig. 3, the file loading device includes the following modules:
a file acquisition module 30, configured to acquire a plurality of resource files of a target application;
the file classification module 31 is configured to classify the plurality of resource files based on a first preset rule, so as to obtain at least one first type of resource, where the first type of resource includes at least one resource file in the plurality of resource files;
the file classifying module 31 is further configured to classify the first class resource based on a second preset rule, so as to obtain at least one second class resource;
a file compression module 32, configured to compress the at least one second type resource to obtain at least one resource file package;
and the loading module 33 is configured to load the at least one resource file package to run the target application when an operation instruction for running the target application is detected.
In one embodiment, the target application includes at least one application checkpoint, each application checkpoint corresponds to at least one resource file of the target application, and the file classification module 31 is specifically further configured to, when classifying the plurality of resource files based on the first preset rule:
detecting the number of the resource files corresponding to each application checkpoint and/or the data quantity of the resource files corresponding to each application checkpoint;
and classifying the plurality of resource files based on the number of the resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint.
In one embodiment, the target application includes at least one application scenario, where each application scenario corresponds to at least one resource file of the target application, and the file classification module 31 is specifically further configured to, when classifying the plurality of resource files based on the first preset rule:
detecting the number of the resource files corresponding to each application scene and/or the data quantity of the resource files corresponding to each application scene;
and classifying the plurality of resource files based on the number of the resource files corresponding to each application scene and/or the data amount of the resource files corresponding to each application scene.
In one embodiment, the file classification module 31 is further specifically configured to, when classifying the first type of resources based on a second preset rule:
acquiring association information of resource files in the first type of resources, wherein the association information comprises file format types;
classifying resource files in the first class of resources based on the file format type.
In one embodiment, the file compression module 32 is specifically configured to, when compressing the at least one second class resource:
respectively merging resource files in each second-class resource to obtain at least one second-class resource merging file, wherein the second-class resources and the second-class resource merging files are in one-to-one correspondence;
acquiring association information of the at least one second-class resource merge file, wherein the association information comprises a file calling sequence;
and compressing at least one second-class resource merging file according to the file calling sequence of the at least one second-class resource merging file.
In one embodiment, the association information further includes a file data amount, and the file compression module 32 is specifically configured to, when compressing at least one of the second-class resource merge files according to a file calling order of the second-class resource merge files:
and compressing at least one merged second-class resource based on the file data volume of the second-class resource merged file and the file calling sequence of the at least one second-class resource merged file.
It should be noted that, the functions of each module of the file loading device described in the embodiment of the present invention may be specifically implemented according to the method in the embodiment of the method described in fig. 1 or fig. 2, and the specific implementation process may refer to the related description of the embodiment of the method in fig. 1 or fig. 2, which is not repeated herein.
Based on the description of the method embodiment and the device embodiment, the embodiment of the invention also provides a terminal device. Referring to fig. 4, the terminal device may include at least a processor 401, an input device 402, an output device 403, and a memory 404; wherein the processor 401, the input device 402, the output device 403, and the memory 404 may be connected by a bus or other connection. The memory 404 is used for storing a computer program comprising program instructions, and the processor 401 is used for executing the program instructions stored in the memory 404. The processor 401, or CPU (Central Processing Unit ), is a computing core of the terminal device as well as a control core, which is adapted to implement one or more instructions, in particular to load and execute one or more instructions to implement the corresponding method flows or corresponding functions in the above-described file loading method embodiments. Wherein the processor 401 is configured to invoke the program instructions to execute: acquiring a plurality of resource files of a target application through the input device 402, and classifying the plurality of resource files based on a first preset rule to obtain at least one first class resource, wherein the first class resource comprises at least one resource file in the plurality of resource files; classifying the first class resources based on a second preset rule to obtain at least one second class resource; compressing the at least one second class resource to obtain at least one resource file package; and when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application.
In one embodiment, the target application includes at least one application checkpoint, each application checkpoint corresponds to at least one resource file of the target application, and the processor 401 is further configured to detect a number of resource files corresponding to each application checkpoint and/or a data amount of the resource files corresponding to each application checkpoint; and classifying the plurality of resource files based on the number of the resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint.
In one embodiment, the target application includes at least one application scenario, each application scenario corresponds to at least one resource file of the target application, and the processor 401 is further configured to detect a number of resource files corresponding to each application scenario and/or a data amount of resource files corresponding to each application scenario; and classifying the plurality of resource files based on the number of the resource files corresponding to each application scene and/or the data amount of the resource files corresponding to each application scene.
In one embodiment, the processor 401 is further configured to obtain association information of resource files in the first type of resources, where the association information includes a file format type; classifying resource files in the first class of resources based on the file format type.
In one embodiment, the processor 401 is further configured to combine resource files in each second-class resource respectively to obtain at least one second-class resource combined file, where the second-class resources are in one-to-one correspondence with the second-class resource combined file; acquiring association information of the at least one second-class resource merge file, wherein the association information comprises a file calling sequence; and compressing at least one second-class resource merging file according to the file calling sequence of the at least one second-class resource merging file.
In one embodiment, the association information further includes a file data amount, and the processor 401 is further configured to compress at least one of the merged second-class resources based on the file data amount of the second-class resource merged file and a file calling order of the at least one second-class resource merged file.
It should be appreciated that in embodiments of the present invention, the processor 401 may be a central processing unit (Central Processing Unit, CPU), the processor 401 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete a hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 404 may include read only memory and random access memory and provide instructions and data to the processor 401. A portion of memory 404 may also include non-volatile random access memory. For example, memory 404 may also store information of device type. The input device 403 may include a touch pad, a fingerprint sensor (for collecting fingerprint information of a user), a microphone, a physical keyboard, etc., and the output device 403 may include a display (LCD, etc.), a speaker, etc.
In a specific implementation, the processor 401, the memory 404, the input device 402, and the output device 403 described in the embodiments of the present invention may execute the implementation described in the method embodiment of fig. 1 or fig. 2 provided in the embodiments of the present invention, and may also execute the implementation method of the file loading device described in the embodiments of the present invention, which is not described herein again.
In another embodiment of the present invention, a computer readable storage medium is provided, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, where the program instructions implement, when executed by a processor, the implementation manner described by the implementation manner of the method shown in fig. 1 or fig. 2 provided by the embodiment of the present invention, where the computer readable storage medium may be an internal storage unit of the terminal device, for example, a hard disk or a memory of the terminal device, where the internal storage unit is described by any one of the foregoing embodiments. The computer readable storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device. Further, the computer-readable storage medium may further include both an internal storage unit and an external storage device of the terminal device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the terminal device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the above-described embodiments of the methods.
The readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
Claims (10)
1. A method of loading a file, the method comprising:
acquiring a plurality of resource files of a target application, and classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource, wherein the first-class resource comprises at least one resource file in the plurality of resource files;
classifying the first class resources based on a second preset rule to obtain at least one second class resource; compressing the at least one second class resource to obtain at least one resource file package;
determining a target resource file package according to the data quantity of the at least one resource file package; if the data volume of the target resource file package is larger than a third data volume threshold, splitting a target second-class resource merging file corresponding to the target resource file package to obtain at least two third-class resource files, and compressing the third-class resource files to obtain at least one resource file package so as to update the target resource file package; if the data volume of the target resource file package is smaller than a fourth data volume threshold, inquiring the data volume of each resource file package corresponding to a target first-class resource file corresponding to the target resource file package, and compressing at least two second-class resources corresponding to the target first-class resource file according to the data volume of each resource file package corresponding to the target first-class resource file to obtain at least one resource file package so as to update the resource file package corresponding to the target first-class resource file;
and when detecting an operation instruction for running the target application, loading the at least one resource file package so as to run the target application.
2. The method of claim 1, wherein the target application includes at least one application checkpoint, each application checkpoint corresponding to at least one resource file of the target application, the classifying the plurality of resource files based on a first preset rule comprising:
detecting the number of the resource files corresponding to each application checkpoint and/or the data quantity of the resource files corresponding to each application checkpoint;
and classifying the plurality of resource files based on the number of the resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint.
3. The method of claim 1, wherein the target application includes at least one application scenario, each application scenario corresponding to at least one resource file of the target application, the classifying the plurality of resource files based on a first preset rule comprising:
detecting the number of the resource files corresponding to each application scene and/or the data quantity of the resource files corresponding to each application scene;
and classifying the plurality of resource files based on the number of the resource files corresponding to each application scene and/or the data amount of the resource files corresponding to each application scene.
4. A method according to any one of claims 1-3, wherein classifying the first category resources based on a second preset rule comprises:
acquiring association information of resource files in the first type of resources, wherein the association information comprises file format types;
classifying resource files in the first class of resources based on the file format type.
5. A method according to any of claims 1-3, wherein said compressing said at least one second class resource comprises:
respectively merging resource files in each second-class resource to obtain at least one second-class resource merging file, wherein the second-class resources and the second-class resource merging files are in one-to-one correspondence;
acquiring association information of the at least one second-class resource merge file, wherein the association information comprises a file calling sequence;
and compressing at least one second-class resource merging file according to the file calling sequence of the at least one second-class resource merging file.
6. The method of claim 5, wherein the association information further includes a file data amount, and the compressing at least one of the second-class resource merge files according to a file call order of the second-class resource merge files includes:
and compressing at least one merged second-class resource based on the file data volume of the second-class resource merged file and the file calling sequence of the at least one second-class resource merged file.
7. A file loading device, the file loading device comprising:
the file acquisition module is used for acquiring a plurality of resource files of the target application;
the file classification module is used for classifying the plurality of resource files based on a first preset rule to obtain at least one first-class resource, wherein the first-class resource comprises at least one resource file in the plurality of resource files;
the file classification module is further configured to classify the first class resource based on a second preset rule to obtain at least one second class resource;
the file compression module is used for compressing the at least one second type resource to obtain at least one resource file package;
the file compression module is further used for determining a target resource file package according to the data volume of the at least one resource file package; if the data volume of the target resource file package is larger than a third data volume threshold, splitting a target second-class resource merging file corresponding to the target resource file package to obtain at least two third-class resource files, and compressing the third-class resource files to obtain at least one resource file package so as to update the target resource file package; if the data volume of the target resource file package is smaller than a fourth data volume threshold, inquiring the data volume of each resource file package corresponding to a target first-class resource file corresponding to the target resource file package, and compressing at least two second-class resources corresponding to the target first-class resource file according to the data volume of each resource file package corresponding to the target first-class resource file to obtain at least one resource file package so as to update the resource file package corresponding to the target first-class resource file;
and the loading module is used for loading the at least one resource file package when detecting an operation instruction for running the target application so as to run the target application.
8. The apparatus of claim 7, wherein the target application includes at least one application checkpoint, each application checkpoint corresponding to at least one resource file of the target application, and wherein the file classification module, when classifying the plurality of resource files based on the first preset rule, is further specifically configured to:
detecting the number of the resource files corresponding to each application checkpoint and/or the data quantity of the resource files corresponding to each application checkpoint;
and classifying the plurality of resource files based on the number of the resource files corresponding to each application checkpoint and/or the data amount of the resource files corresponding to each application checkpoint.
9. A terminal device comprising a processor and a memory, the processor and the memory being interconnected, wherein the memory is adapted to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method according to any of claims 1-6.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911169207.0A CN111008048B (en) | 2019-11-22 | 2019-11-22 | File loading method and device and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911169207.0A CN111008048B (en) | 2019-11-22 | 2019-11-22 | File loading method and device and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111008048A CN111008048A (en) | 2020-04-14 |
CN111008048B true CN111008048B (en) | 2023-12-26 |
Family
ID=70113103
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911169207.0A Active CN111008048B (en) | 2019-11-22 | 2019-11-22 | File loading method and device and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111008048B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102984124A (en) * | 2012-10-31 | 2013-03-20 | 北京昆仑万维科技股份有限公司 | Method and system capable of fast embedding client-side game program to browser |
CN108319653A (en) * | 2017-12-29 | 2018-07-24 | 谷米科技有限公司 | Web page resources document handling method and device |
CN110113391A (en) * | 2019-04-17 | 2019-08-09 | 北京奇艺世纪科技有限公司 | A kind of client loading method, device and a kind of client operation method, device |
CN110134650A (en) * | 2019-04-28 | 2019-08-16 | 深圳市腾讯网域计算机网络有限公司 | A kind of file loading method, device, equipment and storage medium |
-
2019
- 2019-11-22 CN CN201911169207.0A patent/CN111008048B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102984124A (en) * | 2012-10-31 | 2013-03-20 | 北京昆仑万维科技股份有限公司 | Method and system capable of fast embedding client-side game program to browser |
CN108319653A (en) * | 2017-12-29 | 2018-07-24 | 谷米科技有限公司 | Web page resources document handling method and device |
CN110113391A (en) * | 2019-04-17 | 2019-08-09 | 北京奇艺世纪科技有限公司 | A kind of client loading method, device and a kind of client operation method, device |
CN110134650A (en) * | 2019-04-28 | 2019-08-16 | 深圳市腾讯网域计算机网络有限公司 | A kind of file loading method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111008048A (en) | 2020-04-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11605087B2 (en) | Method and apparatus for identifying identity information | |
CN111666497A (en) | Application program loading method and device, electronic equipment and readable storage medium | |
CN109271611B (en) | Data verification method and device and electronic equipment | |
CN111428162A (en) | Page screenshot method and device | |
CN107590248B (en) | Search method, search device, search terminal and computer-readable storage medium | |
US10915666B2 (en) | Terminal verification method, terminal device, and computer readable storage medium | |
CN103164492A (en) | File copying method between electronic devices and electronic devices | |
CN110888972A (en) | Sensitive content identification method and device based on Spark Streaming | |
US10915909B2 (en) | Terminal verification method, terminal device, and computer readable storage medium | |
CN111275071B (en) | Prediction model training method, prediction device and electronic equipment | |
CN111008048B (en) | File loading method and device and readable storage medium | |
CN110443072B (en) | Data signature method, data verification device and storage medium | |
CN111400630A (en) | Resource preloading method and related equipment | |
CN112257106B (en) | Data detection method and device | |
CN116610354A (en) | Parameter verification method, device, computer equipment and storage medium | |
CN113849524B (en) | Data processing method and device | |
CN113392010B (en) | Public assembly testing method and device, electronic equipment and storage medium | |
CN109542531B (en) | File layout adjustment method and device | |
CN113849195A (en) | Application program loading method and device, storage medium and terminal | |
CN113868479A (en) | Method and device for processing service data | |
CN110908958B (en) | File processing method, device, terminal and storage medium | |
CN113283978A (en) | Financial risk assessment method based on biological basis, behavior characteristics and business characteristics | |
CN110874723A (en) | Electronic red packet detection method, electronic red packet detection device and mobile terminal | |
CN111723229B (en) | Data comparison method, device, computer readable storage medium and electronic equipment | |
CN109446166B (en) | Method for detecting file directory, computer readable storage medium and terminal device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |