Disclosure of Invention
The invention provides a terminal running speed optimization method and a terminal running speed optimization system based on edge calculation, which can improve data coding compression efficiency.
In a first aspect, the present application provides a method for optimizing a terminal operation speed based on edge calculation, including:
obtaining data to be cached of a current edge node in edge calculation;
determining repeated combination characters in the data to be cached;
Encoding a first character in the combined characters, and advancing the first character in a character list to obtain an updated character list;
And advancing other characters after the first character in the combined characters in the updated character list, and encoding the advanced characters by using the updated character list.
In an alternative embodiment, a combination of a plurality of characters that repeatedly appear more frequently than a preset frequency is used as the combined character.
In an alternative embodiment, advancing the other characters after the first character in the combined character in the character list includes:
Calculating the probability that other characters after the first character in the combined characters are continuously advanced after the first character is advanced;
And advancing other characters after the first character in the combined characters in the character list based on the probability.
In an alternative embodiment, the number of characters in the combined character is 2.
In an alternative embodiment, calculating the probability that other characters after the first character in the combined characters are continuously advanced after the first character is advanced includes:
Based on the probability that character A is followed by the ith characterThe frequency difference between the combined character of the ith character positioned behind the character A relative to the combined characters of the ith character positioned behind other characters except the character A, and the frequency average value of all characters before the ith character in the character list calculate the probability of being continuously advanced after the character A is advanced; wherein character A is the first character in the combined characters;
Wherein a frequency difference between a combined character of which the i-th character is located after the character A with respect to a combined character of which the i-th character is located after other characters than the character A is based on a probability that the i-th character is preceded by the character AAnd the probability/>, that there is a ith character before the ith characterAnd determining that the ith character is data except the character A in the data to be cached, and the ith character is the first character in the combined characters.
In an alternative embodiment, after character a advances, the probability that the ith character is continuously advanced is calculated by:
wherein,Representing the probability of character A being advanced and then the ith character being advanced continuously,/>Representing the frequency difference between the combination character of the i-th character located after character A relative to the combination character of the i-th character located after other characters than character A,/>Representing the number of combined characters preceding the ith character as the ith character,/>, of the ith characterRepresenting the frequency average of all characters preceding the ith character in the character list,/>Representing the normalization function.
In an alternative embodiment, advancing other characters after the first character in the combined character in the character list based on the probability includes:
If the character A is taken as the combined character of the first character, after the character A is advanced, the probability that the ith character is continuously advanced is larger than a preset value, after the character A is advanced, the ith character is advanced in the updated character list, and the advanced character is encoded by utilizing the updated character list.
In an alternative embodiment, the method further comprises:
Based on the frequency of the combined character formed by taking the first character as character A and the other characters as the ith character, the ratio of the frequency of the combined character formed by taking the first character as character A to the frequency of the combined character formed by taking the first character as character A obtains the probability that the ith character exists behind the character AProbability/>, that character a is followed by the ith characterCharacterizing the probability that the ith character is continuously advanced after character a has advanced;
Based on the frequency of the combined character formed by taking the first character as the ith character and the other characters as the ith character, the ratio of the frequency of the combined character formed by taking the second character as the ith character to the frequency of the combined character formed by taking the second character as the ith character, the probability that the ith character exists before the ith character is obtainedProbability/>, that there is a ith character before the ith characterCharacterizing the probability that the ith character is continuously advanced after the ith character is advanced;
based on the ratio of the frequency of the combined character formed by taking the first character as the character A and the other characters as the ith character and the frequency of the combined character formed by taking the second character as the ith character, the probability that the character A exists before the ith character is obtained。
In a second aspect, the present application further provides a terminal operation speed optimization system based on edge calculation, including:
the acquisition module is used for acquiring data to be cached of the current edge node in the edge calculation;
the combined character determining module is used for determining repeated combined characters in the data to be cached;
The coding module is used for coding a first character in the combined characters, and advancing the first character in the character list to obtain an updated character list; and advancing other characters after the first character in the combined characters in the updated character list, and encoding the advanced characters by using the updated character list.
In an alternative embodiment, the encoding module is further configured to: calculating the probability that other characters after the first character in the combined characters are continuously advanced after the first character is advanced; and advancing other characters after the first character in the combined characters in the character list based on the probability, and encoding the advanced characters by using the updated character list.
The application has the beneficial effects that the terminal operation speed optimization method based on edge calculation, which is different from the prior art, comprises the following steps: obtaining data to be cached of a current edge node in edge calculation; determining repeated combination characters in the data to be cached; encoding a first character in the combined characters, and advancing the first character in a character list to obtain an updated character list; and advancing other characters after the first character in the combined characters in the updated character list, and encoding the advanced characters by using the updated character list. According to the method, the characters are continuously moved forward according to the combined characters, namely, the characters in the character list are moved forward in advance, so that a smaller index value has higher coding performance, and the data coding compression efficiency is improved. The probability that other characters are successively advanced after the character is advanced is determined. Wherein the maximum likelihood of index value reduction, i.e. the maximum likelihood of improving data compression efficiency, is obtained in consideration of the frequency of combining characters. And the influence of the continuous forward movement of the characters on the index values of other characters is considered, so that the reduction of the data compression rate caused by the increase of the index values of other characters due to the continuous forward movement of the characters is avoided.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the MTF coding of the buffer data of the edge node in the edge calculation, the higher the frequency of continuous occurrence of characters, the earlier the index value of the characters in the character list, and the higher the compression efficiency. The present application uses the repeated occurrence of the combined character to continuously advance the character list to improve the compression efficiency. The present application will be described in detail with reference to the accompanying drawings and examples.
Referring to fig. 1, fig. 1 is a flowchart of a first embodiment of a terminal operation speed optimization method based on edge calculation according to the present invention, which specifically includes:
step S11: and obtaining data to be cached of the current edge node in the edge calculation.
Specifically, in edge computation, an edge node caches some frequently accessed data, and one edge node determines data to be cached according to the user request frequency, and at this time, the corresponding data to be cached is the data to be coded subsequently.
Step S12: and determining repeated combination characters in the data to be cached.
Assuming that the character to be cached is "abcabad", the combined character in which the repeated occurrence is ab. Specifically, a first character a and a second character b, a fourth character a and a fifth character b.
In one embodiment, a combination of a plurality of characters, which repeatedly appear more frequently than a preset frequency, is used as the combined character.
Specifically, for the data to be cached, a large number of repeated characters exist, and the common data has fixed character expression, so that a large number of repeated combined characters exist in the data to be cached, so that the data to be cached has a certain distribution relation, but in the MTF coding process, after one character is coded, the character is advanced to reduce the index value of the next coding, and at the moment, the current character is advanced to change the index value corresponding to the character of the next bit or a few bits of the character obviously. Therefore, the invention needs to adjust the forward movement of the list characters according to the character relation in the data to be cached so as to further reduce the character index value.
The repeated combination character is determined first before the list advancement is adjusted by the repeated combination character occurrence in the data to be buffered. In the data to be cached, determining all two characters (consistent in front-to-back relation) appearing adjacently, and obtaining the appearance frequencyAt this point/>The two characters (of empirical values) are called combined characters. It will be appreciated that the number of characters in the combined character is 2.
Step S13: and encoding the first character in the combined characters, and advancing the first character in the character list to obtain an updated character list.
Step S14: and advancing other characters after the first character in the combined characters in the updated character list, and encoding the advanced characters by using the updated character list.
In the MTF coding process, the current character is coded by utilizing the character list updated last time, then the coded character is moved to the forefront of the character list, then the next character is coded by utilizing the updated character list, at the moment, the character coding is always carried out before the corresponding character position is moved forward, and because the combined characters exist in the data to be cached, the relative positions of the combined characters are relatively fixed, at the moment, the characters in the character list can be moved forward in advance by utilizing the position relation of the combined characters, so that the corresponding index value of the characters is reduced, and the data is efficiently compressed. The above-described step S13 and step S14 will be described below by way of example.
The advancing of the character is mainly based on the combined character in the data to be cached, namely, the combined character ab, after the character a in the data to be cached is coded, the character a is advanced in the character list, and then the character b is continued to be advanced in the character list, so that the index value of the character b is reduced.
Illustrating: the data to be cached is known as abcabad, and the initial character list is dcba.
Conventional encoding gave an encoding result of 4443324, as shown in table 1 below:
TABLE 1
The method of the application uses ab as a combined character, after finishing the coding of the character a, and after a plurality of characters a move forward in a character list, continuing to move forward the character b, and then coding the character b, thus obtaining a coding result of 4143124. As shown in table 2 below:
TABLE 2
In the above process, the coding result 4143124 of the combined character continuously advancing in the character list is significantly smaller than the conventional coding result 4443324, i.e. the compression efficiency of MTF coding is effectively increased.
Referring to fig. 2, fig. 2 is a flow chart of a second embodiment of the terminal operation speed optimization method based on edge calculation according to the present invention, which specifically includes:
Step S21: and obtaining data to be cached of the current edge node in the edge calculation.
Step S22: and determining repeated combination characters in the data to be cached.
Step S23: and encoding the first character in the combined characters, and advancing the first character in the character list to obtain an updated character list.
In this embodiment, step S21, step S22 and step S23 are the same as step S11, step S12 and step S13 in the embodiment shown in fig. 1, and are not described here again.
Step S24: and calculating the probability that other characters after the first character in the combined characters are continuously advanced after the first character is advanced.
In the data to be buffered, the same character may form a different combination character with other different characters, so the same character has a different combination of consecutive advances. For example, data "abcacdadabacadc" to be buffered, where ab constitutes a combined character, ac constitutes a combined character, and da constitutes a combined character, then there are a plurality of combinations that are successively advanced for a first character, e.g., character a, in the combined character, so the present application needs to calculate the probability that the other characters, e.g., b, c, after the first character, e.g., character a, in the combined character are successively advanced after the first character is advanced.
The known character continuous advancing process mainly uses the previous character to encode and advance, and then proceeds advancing to the next character, so the basis for causing the character continuous advancing is the previous character in the character combination, at this time, the characters existing behind the same character A may be different in different combined characters, so at this time, it is first required to judge the probability that the next character is continuously advanced after the same character A appears. The higher the frequency of the known combined character is, the higher the probability of the corresponding character continuously appearing, so the higher the probability of being continuously advanced, and accordingly, the first character is taken as character A, and the other characters are combined characters formed by the ith characterFrequency/>Frequency/>, of combined character with first character being character aRatio of/>Obtaining the probability/>, of the ith character existing behind the character AProbability/>, that character a is followed by the ith characterThe probability that the ith character is continuously advanced after character a has advanced is characterized. I.e./>,/>The larger the value of the probability that the ith character exists behind the character A, the larger the probability that the ith character is continuously advanced after the character A is advanced, and the description is that/>It is also understood that character a is in a combined character, followed by the probability that the ith character, reflected when the ith character, is continuously advanced after character a has advanced. Wherein character A is the first character in the combined character.
The ith character may be located after the different characters in the different combined characters at the same time, so it has a plurality of probabilities of being successively advanced with respect to the previous different characters. In one embodiment, the frequency of the combined character ui composed of the first character as the ith character and the other characters as the ith character is based onFrequency/>, of combined character with the second character being the ith characterThe ratio of (2) yields the probability/>, that the ith character is preceded by the ith character, of the presence of the ith characterProbability/>, that there is a ith character before the ith characterThe probability that the ith character is continuously advanced after the ith character is advanced is characterized. Wherein/>,/>The larger the value of the probability indicating that the ith character is present before the ith character, the larger the probability that the ith character is successively advanced after the ith character is advanced.
Based on the ratio of the frequency of the combined character formed by taking the first character as the character A and the other characters as the ith character and the frequency of the combined character formed by taking the second character as the ith character, the probability that the character A exists before the ith character is obtainedProbability/>, that character a exists before the ith characterAnd characterizing the probability that the ith character is continuously advanced after the character A is advanced when the ith character is reflected when the ith character is the character A in the combined character, wherein the ith character is the first character in the combined character.
According to the above steps, the probability that the character is continuously advanced is determined. For a character, when the character advances in the encoding process, a plurality of different characters may be simultaneously and continuously advanced, at this time, in the actual encoding process, different probability values obtained in the above process are needed first, when a single character advances, the possibility that different characters are continuously advanced is determined, and then the final character which is continuously advanced is determined.
Knowing the probability that the ith character is continuously advanced after character a advances as character a advancesThe larger the probability that thereafter the ith character is successively advanced, the larger the probability that then corresponds to the successively advanced probability/>, based on the ith character, which was preceded by other characters, e.g., the (other than character a) th characterThe larger the i-th character is, the smaller the probability that the character a is successively advanced after it. Meanwhile, in the actual encoding process, the continuous forward movement of the combined characters can cause the index values of other characters to be increased, so that the index values of other characters are increased, namely the encoding compression efficiency is influenced. The probability that the ith character is continuously advanced after the character A appears and advances in the actual code is determined according to the probability.
In a particular embodiment, the probability of the ith character being present after character A is based onThe frequency difference between the combined character of the i-th character located behind the character A relative to the combined characters of the i-th character located behind the other characters except the character A, and the frequency average value of all characters before the i-th character in the character list calculate the probability that the i-th character is continuously advanced after the character A is advanced. Wherein the frequency difference between the combined character of the i-th character located after the character A relative to the combined character of the i-th character located after the other characters except the character A is based on the probability/>, reflected when the character A is preceded by the i-th character, that the i-th character is continuously advanced after the character A is advancedAnd the probability/>, that there is a ith character before the ith characterAnd determining that the u-th character is data except the character A in the data to be cached.
In one embodiment, after the character a is advanced, the probability that the ith character is continuously advanced is calculated by:
wherein,Representing the probability of character A being advanced and then the ith character being advanced continuously,/>Representing the frequency difference between the combination character of the i-th character located after character A relative to the combination character of the i-th character located after other characters than character A,/>Representing the number of combined characters preceding the ith character as the ith character,/>, of the ith characterRepresenting the frequency average of all characters preceding the ith character in the character list,/>Representing the normalization function.
Wherein the method comprises the steps ofRepresenting the probability that character A is present before the ith character, in particular,/>The probability of the ith character being continuously advanced after character A advancement, reflected when the ith character is preceded by character A, in the combined characters,/>Representing the probability that the ith character is continuously advanced after the ith character is advanced. /(I)The larger the value of the difference representing the probability that the ith character is successively advanced after character a relative to the probability that the ith character is successively advanced after the u-th character, the greater the probability that the ith character is successively advanced after character a. /(I)Representing normalization function, avoid/>Is negative.The combined character representing that the i-th character is located after character a is located at the other with respect to the i-th characterThe difference in frequency of the combined characters following the individual characters reflects the probability that the i-th character is successively advanced following character a, the greater the value of which, the greater the probability that the i-th character is successively advanced after occurrence of character a. /(I)Representing the probability that the ith character is successively advanced after character A based on the reflection of character A,/>The larger the average value of the frequencies of all characters before the ith character in the character list is, the larger the probability that the continuous advancing of the ith character causes the index value of other characters to become larger, so the smaller the probability that the ith character is continuously advanced behind the character a.
Step S25: and advancing other characters after the first character in the combined characters in the character list based on the probability, and encoding the advanced characters by using the updated character list.
By using the method, the probability that other characters are continuously advanced after the first character in the combined characters is advanced can be determined. Wherein the maximum likelihood of index value reduction, i.e., the maximum likelihood of improving data compression efficiency, is obtained in consideration of the frequency of the combined characters; meanwhile, the influence of the continuous forward movement of the characters on the index values of other characters is considered, and the reduction of the data compression rate caused by the increase of the index values of other characters due to the continuous forward movement of the characters is avoided.
Further, if the character a is taken as the combined character of the first character, after the character a is advanced, the probability that the ith character is continuously advanced is greater than a preset value, after the character a is advanced, the ith character is advanced in the updated character list, and the advanced character is encoded by using the updated character list.
Obtaining the probability of continuous advancing of a plurality of characters after advancing of the character A for the character A, and obtaining the maximum value of the probabilityThen normalizing the maximum value corresponding to all continuous characters,/>Normalized result of (2) is/>Finally atIn this case, it is determined that character A is advanced and then character B is successively advanced, wherein/>(Empirical values). All characters that are consecutively advanced are determined at the same time.
According to the steps, all continuous forward characters are determined, at the moment, the data cached by the edge node in the edge calculation based on the continuous forward movement of the characters are subjected to MTF coding, the corresponding coding result is compressed data, the compressed data are cached in the edge node, so that more common data at the edge are cached, the need of transmitting the data from terminal equipment every time is avoided, and the running speed of the terminal is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an embodiment of a terminal operation speed optimization system based on edge calculation according to the present invention, which specifically includes: the device comprises an acquisition module 31, a combined character determination module 32 and a coding module 33.
The acquiring module 31 is configured to acquire data to be cached of a current edge node in edge calculation. The combined character determining module 32 determines the combined character that repeatedly appears in the data to be cached. The encoding module 33 encodes the first character in the combined characters, and advances the first character in the character list to obtain an updated character list; and advancing other characters after the first character in the combined characters in the updated character list, and encoding the advanced characters by using the updated character list.
In an embodiment, the encoding module 33 is further configured to: calculating the probability that other characters after the first character in the combined characters are continuously advanced after the first character is advanced; and advancing other characters after the first character in the combined characters in the character list based on the probability, and encoding the advanced characters by using the updated character list.
The foregoing is only the embodiments of the present application, and therefore, the patent scope of the application is not limited thereto, and all equivalent structures or equivalent processes using the descriptions of the present application and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the application.