• R/O
  • SSH

fcf-framework-core: Commit

Main functions and classes of the FCF framework


Commit MetaInfo

Révision8d18f17989f6997898bfaa2fdeb862227c1238b2 (tree)
l'heure2022-12-05 12:04:58
Auteurvmarkin
Commitervmarkin

Message de Log

rename getApproximateSize to getApproximateMSize

Change Summary

Modification

diff -r e0ec250feb5f -r 8d18f17989f6 fcf.js
--- a/fcf.js Mon Dec 05 06:03:19 2022 +0300
+++ b/fcf.js Mon Dec 05 06:04:58 2022 +0300
@@ -869,26 +869,26 @@
869869 }
870870 }
871871
872- /// @fn fcf.getApproximateSize(a_value)
872+ /// @fn fcf.getApproximateMSize(a_value)
873873 /// @brief A very approximate estimate of the memory occupied by an object in bytes.
874874 /// @details The error can reach up to 10 times.
875875 /// Used to protect algorithms from memory overflows
876876 /// @param mixed a_value - Checked value
877877 /// @result number - The amount of memory used by the object
878- fcf.getApproximateSize = (a_value) => {
878+ fcf.getApproximateMSize = (a_value) => {
879879 if (typeof a_value == "string"){
880880 return 30 * a_value.length;
881881 } else if (Array.isArray(a_value)) {
882882 let s = 30;
883883 for(let i = 0; i < a_value.length; ++i) {
884- s += fcf.getApproximateSize(a_value[i]);
884+ s += fcf.getApproximateMSize(a_value[i]);
885885 }
886886 return s;
887887 } else if (typeof a_value == "object" && a_value !== null) {
888888 let s = 30;
889889 for(let k in a_value){
890- s += fcf.getApproximateSize(k);
891- s += fcf.getApproximateSize(a_value[k]);
890+ s += fcf.getApproximateMSize(k);
891+ s += fcf.getApproximateMSize(a_value[k]);
892892 }
893893 return s;
894894 } else {
@@ -1930,7 +1930,7 @@
19301930 this._msize -= rec.s;
19311931 this._cachem.delete(a_key);
19321932 }
1933- let s = fcf.getApproximateSize(a_key) + fcf.getApproximateSize(a_value);
1933+ let s = fcf.getApproximateMSize(a_key) + fcf.getApproximateMSize(a_value);
19341934 this._cachem.set(a_key, { v: a_value, s: s });
19351935 this._msize += s;
19361936 this._clear();
Afficher sur ancien navigateur de dépôt.