Preloading method, electronic device and medium
A preloading method, an electronic device and a medium are provided. The method includes: determining a stuttering coefficient based on historical stuttering information of an application; determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value; and preloading data in the application based on the target preloading parameter.
1 . A preloading method, comprising:
determining a stuttering coefficient based on historical stuttering information of an application;
determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value; and
preloading data in the application based on the target preloading parameter, wherein
the set threshold value comprises a first threshold value and a second threshold value, the first threshold value is greater than the second threshold value, and the target preloading parameter comprises a preloading time, a preloading size, and a preloading number, and
the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value comprises:
in response to the stuttering coefficient being smaller than the first threshold value and larger than the second threshold value, determining the target preloading parameter determined in a last operation as the target preloading parameter in a current operation.
2 . The method according to claim 1 , wherein the historical stuttering information comprises first stuttering information and second stuttering information, the first stuttering information comprises a stuttering number in a life cycle of the application, the second stuttering information comprises both a stuttering number and corresponding stuttering time durations in a set time period, and the set time period is a time period of a set time duration before a current moment.
3 . The method according to claim 2 , wherein the determining a stuttering coefficient based on historical stuttering information of an application, comprises:
determining a first coefficient based on a statistical value of the first stuttering information;
determining a second coefficient based on a weighted value of the second stuttering information; and
determining a weighted value of the first coefficient and the second coefficient as the stuttering coefficient.
4 . The method according to claim 3 , wherein the determining a second coefficient based on a weighted value of the second stuttering information, comprises:
based on the stuttering number in the second stuttering information, obtaining weighted sum of the corresponding stuttering time durations, wherein a weight coefficient of each stuttering time duration is determined based on a time stamp of the stuttering time duration;
determining a result of obtaining weighted sum as the second coefficient.
5 . The method according to claim 1 ,
wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value further comprises:
in response to the stuttering coefficient being greater than or equal to the first threshold value, determining a first preloading parameter predetermined as the target preloading parameter, and
in response to the stuttering coefficient being smaller than or equal to the second threshold value, determining a second preloading parameter as the target preloading parameter,
wherein the preloading time comprised in the first preloading parameter is later than the preloading time comprised in the second preloading parameter, the preloading size comprised in the first preloading parameter is greater than the preloading size comprised in the second preloading parameter, and the preloading number comprised in the first preloading parameter is greater than the preloading number comprised in the second preloading parameter.
6 . The method according to claim 1 , wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value, comprises:
in response to a stuttering number comprised in the historical stuttering information being smaller than a first number threshold value, determining a difference value between the stuttering coefficient and the second threshold value comprised in the set threshold value; and
adjusting a second preloading parameter corresponding to the second threshold value based on the difference value, and determining the target preloading parameter, wherein the preloading time comprised in the target preloading parameter is earlier than the preloading time comprised in the second preloading parameter, the preloading number comprised in the target preloading parameter is greater than the preloading number comprised in the second preloading parameter, and the preloading size comprised in the target preloading parameter is greater than the preloading size comprised in the second preloading parameter.
7 . The method according to claim 1 , wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold, comprises:
in response to a stuttering number comprised in the historical stuttering information being greater than a second number threshold value, determining a difference value between the stuttering coefficient and the first threshold value comprised in the set threshold value; and
adjusting a first preloading parameter corresponding to the first threshold value based on the difference value, and determining the target preloading parameter, wherein the preloading time comprised in the target preloading parameter is later than the preloading time comprised in the first preloading parameter, the preloading number comprised in the target preloading parameter is smaller than the preloading number comprised in the first preloading parameter, and the preloading size comprised in the target preloading parameter is smaller than the preloading size comprised in the first preloading parameter.
8 . An electronic device, comprising:
one or more processors;
a memory, configured to store one or more programs;
when the one or more programs are executed by the one or more processors, causing the one or more processors to implement a preloading method, wherein the preloading method comprises:
determining a stuttering coefficient based on historical stuttering information of an application;
determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value; and
preloading data in the application based on the target preloading parameter, wherein
the set threshold value comprises a first threshold value and a second threshold value, the first threshold value is greater than the second threshold value, and the target preloading parameter comprises a preloading time, a preloading size, and a preloading number, and
the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value comprises:
in response to the stuttering coefficient being smaller than the first threshold value and larger than the second threshold value, determining the target preloading parameter determined in a last operation as the target preloading parameter in a current operation.
9 . The electronic device according to claim 8 , wherein the historical stuttering information comprises first stuttering information and second stuttering information, the first stuttering information comprises a stuttering number in a life cycle of the application, the second stuttering information comprises both a stuttering number and corresponding stuttering time durations in a set time period, and the set time period is a time period of a set time duration before a current moment.
10 . The electronic device according to claim 9 , wherein the determining a stuttering coefficient based on historical stuttering information of an application, comprises:
determining a first coefficient based on a statistical value of the first stuttering information;
determining a second coefficient based on a weighted value of the second stuttering information; and
determining a weighted value of the first coefficient and the second coefficient as the stuttering coefficient.
11 . The electronic device according to claim 10 , wherein the determining a second coefficient based on a weighted value of the second stuttering information, comprises:
based on the stuttering number in the second stuttering information, obtaining weighted sum of the corresponding stuttering time durations, wherein a weight coefficient of each stuttering time duration is determined based on a time stamp of the stuttering time duration;
determining a result of obtaining weighted sum as the second coefficient.
12 . The electronic device according to claim 8 ,
wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value further comprises:
in response to the stuttering coefficient being greater than or equal to the first threshold value, determining a first preloading parameter predetermined as the target preloading parameter; and
in response to the stuttering coefficient being smaller than or equal to the second threshold value, determining a second preloading parameter as the target preloading parameter,
wherein the preloading time comprised in the first preloading parameter is later than the preloading time comprised in the second preloading parameter, the preloading size comprised in the first preloading parameter is greater than the preloading size comprised in the second preloading parameter, and the preloading number comprised in the first preloading parameter is greater than the preloading number comprised in the second preloading parameter.
13 . The electronic device according to claim 8 , wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value, comprises:
in response to a stuttering number comprised in the historical stuttering information being smaller than a first number threshold value, determining a difference value between the stuttering coefficient and the second threshold value comprised in the set threshold value; and
adjusting a second preloading parameter corresponding to the second threshold value based on the difference value, and determining the target preloading parameter, wherein the preloading time comprised in the target preloading parameter is earlier than the preloading time comprised in the second preloading parameter, the preloading number comprised in the target preloading parameter is greater than the preloading number comprised in the second preloading parameter, and the preloading size comprised in the target preloading parameter is greater than the preloading size comprised in the second preloading parameter.
14 . The electronic device according to claim 8 , wherein the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold, comprises:
in response to a stuttering number comprised in the historical stuttering information being greater than a second number threshold value, determining a difference value between the stuttering coefficient and the first threshold value comprised in the set threshold value; and
adjusting a first preloading parameter corresponding to the first threshold value based on the difference value, and determining the target preloading parameter, wherein the preloading time comprised in the target preloading parameter is later than the preloading time comprised in the first preloading parameter, the preloading number comprised in the target preloading parameter is smaller than the preloading number comprised in the first preloading parameter, and the preloading size comprised in the target preloading parameter is smaller than the preloading size comprised in the first preloading parameter.
15 . A non-transitory computer-readable medium, wherein the non-transitory computer-readable medium stores computer programs, when the computer programs are executed by a processor, implementing a preloading method, wherein the preloading method comprises:
determining a stuttering coefficient based on historical stuttering information of an application;
determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value; and
preloading data in the application based on the target preloading parameter, wherein
the set threshold value comprises a first threshold value and a second threshold value, the first threshold value is greater than the second threshold value, and the target preloading parameter comprises a preloading time, a preloading size and a preloading number, and
the determining a target preloading parameter based on a comparison result between the stuttering coefficient and a set threshold value comprises:
in response to the stuttering coefficient being smaller than the first threshold value and larger than the second threshold value, determining the target preloading parameter determined in a last operation as the target preloading parameter in a current operation.