当前位置: 首页 > news >正文

Javascript的ES6 class写法和ES5闭包写法性能对比

看到很多闭包写法的函数, 
一直怀疑它对性能是否有影响.
还有就是备受推崇的React Hooks函数式写法中出现大量的闭包和临时函数,
我很担心这样会影响性能.

于是, 做了一个实验来做对比.
这个实验很简单, 用md5计算一百万次.

计算过程将结果再放回参数, 这样避免结果没被引用被优化, 影响对比结果.
其中test.js采用闭包写法, test2.js采用class写法.
最终的对比结果如下图所示.
闭包的写法略差于class写法, 大概20%
因此对性能要求比较高的话, 还是推荐class写法.  


下面是闭包写法test.js的代码

function md5 (string) {function rotateLeft(lValue, iShiftBits) {return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));}function addUnsigned(lX, lY) {let lX8 = lX & 0x80000000;let lY8 = lY & 0x80000000;let lX4 = lX & 0x40000000;let lY4 = lY & 0x40000000;let lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);if (lX4 & lY4) {return lResult ^ 0x80000000 ^ lX8 ^ lY8;}if (lX4 | lY4) {if (lResult & 0x40000000) {return lResult ^ 0xc0000000 ^ lX8 ^ lY8;} else {return lResult ^ 0x40000000 ^ lX8 ^ lY8;}} else {return lResult ^ lX8 ^ lY8;}}function F(x, y, z) {return (x & y) | (~x & z);}function G(x, y, z) {return (x & z) | (y & ~z);}function H(x, y, z) {return x ^ y ^ z;}function I(x, y, z) {return y ^ (x | ~z);}function FF(a, b, c, d, x, s, ac) {a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));return addUnsigned(rotateLeft(a, s), b);}function GG(a, b, c, d, x, s, ac) {a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));return addUnsigned(rotateLeft(a, s), b);}function HH(a, b, c, d, x, s, ac) {a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));return addUnsigned(rotateLeft(a, s), b);}function II(a, b, c, d, x, s, ac) {a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));return addUnsigned(rotateLeft(a, s), b);}function convertToWordArray(string) {let lWordCount;let lMessageLength = string.length;let lNumberOfWordsTempOne = lMessageLength + 8;let lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;let lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;let lWordArray = Array(lNumberOfWords - 1);let lBytePosition = 0;let lByteCount = 0;while (lByteCount < lMessageLength) {lWordCount = (lByteCount - (lByteCount % 4)) / 4;lBytePosition = (lByteCount % 4) * 8;lWordArray[lWordCount] =lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition);lByteCount++;}lWordCount = (lByteCount - (lByteCount % 4)) / 4;lBytePosition = (lByteCount % 4) * 8;lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);lWordArray[lNumberOfWords - 2] = lMessageLength << 3;lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;return lWordArray;}function wordToHex(lValue) {let WordToHexValue = "";let WordToHexValueTemp = "";let lByte;for (let lCount = 0; lCount <= 3; lCount++) {lByte = (lValue >>> (lCount * 8)) & 255;WordToHexValueTemp = "0" + lByte.toString(16);WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);}return WordToHexValue;}function uTF8Encode(string) {string = string.replace(/\x0d\x0a/g, "\x0a");let output = "";for (let n = 0; n < string.length; n++) {let c = string.charCodeAt(n);if (c < 128) {output += String.fromCharCode(c);} else if (c > 127 && c < 2048) {output += String.fromCharCode((c >> 6) | 192);output += String.fromCharCode((c & 63) | 128);} else {output += String.fromCharCode((c >> 12) | 224);output += String.fromCharCode(((c >> 6) & 63) | 128);output += String.fromCharCode((c & 63) | 128);}}return output;}function res(string) {let x = [];let AA, BB, CC, DD;let S11 = 7;let S12 = 12;let S13 = 17;let S14 = 22;let S21 = 5;let S22 = 9;let S23 = 14;let S24 = 20;let S31 = 4;let S32 = 11;let S33 = 16;let S34 = 23;let S41 = 6;let S42 = 10;let S43 = 15;let S44 = 21;string = uTF8Encode(string);x = convertToWordArray(string);let a = 0x67452301;let b = 0xefcdab89;let c = 0x98badcfe;let d = 0x10325476;for (let k = 0; k < x.length; k += 16) {AA = a;BB = b;CC = c;DD = d;a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);c = FF(c, d, a, b, x[k + 2], S13, 0x242070db);b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613);b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501);a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8);d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122);d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193);c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e);b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821);a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340);c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681);c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05);a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);a = II(a, b, c, d, x[k + 0], S41, 0xf4292244);d = II(d, a, b, c, x[k + 7], S42, 0x432aff97);c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7);b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039);a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3);d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d);b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1);a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);c = II(c, d, a, b, x[k + 6], S43, 0xa3014314);b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82);d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235);c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391);a = addUnsigned(a, AA);b = addUnsigned(b, BB);c = addUnsigned(c, CC);d = addUnsigned(d, DD);}let tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);return tempValue.toLowerCase();}return res(string);
}function testMd5() {let startTick = Date.now() / 1000;let result = "测试文本字符串测试文本字符串测试文本字符串";for (let i = 0; i< 1e6; ++i) {result = md5(result+i);}console.log(result);let endTick = Date.now() / 1000; console.log(endTick - startTick);
}testMd5();

 下面是类写法test2.js的代码.

class Md5Class {rotateLeft(lValue, iShiftBits) {return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));}addUnsigned(lX, lY) {let lX8 = lX & 0x80000000;let lY8 = lY & 0x80000000;let lX4 = lX & 0x40000000;let lY4 = lY & 0x40000000;let lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);if (lX4 & lY4) {return lResult ^ 0x80000000 ^ lX8 ^ lY8;}if (lX4 | lY4) {if (lResult & 0x40000000) {return lResult ^ 0xc0000000 ^ lX8 ^ lY8;} else {return lResult ^ 0x40000000 ^ lX8 ^ lY8;}} else {return lResult ^ lX8 ^ lY8;}}F(x, y, z) {return (x & y) | (~x & z);}G(x, y, z) {return (x & z) | (y & ~z);}H(x, y, z) {return x ^ y ^ z;}I(x, y, z) {return y ^ (x | ~z);}FF(a, b, c, d, x, s, ac) {a = this.addUnsigned(a, this.addUnsigned(this.addUnsigned(this.F(b, c, d), x), ac));return this.addUnsigned(this.rotateLeft(a, s), b);}GG(a, b, c, d, x, s, ac) {a = this.addUnsigned(a, this.addUnsigned(this.addUnsigned(this.G(b, c, d), x), ac));return this.addUnsigned(this.rotateLeft(a, s), b);}HH(a, b, c, d, x, s, ac) {a = this.addUnsigned(a, this.addUnsigned(this.addUnsigned(this.H(b, c, d), x), ac));return this.addUnsigned(this.rotateLeft(a, s), b);}II(a, b, c, d, x, s, ac) {a = this.addUnsigned(a, this.addUnsigned(this.addUnsigned(this.I(b, c, d), x), ac));return this.addUnsigned(this.rotateLeft(a, s), b);}convertToWordArray(string) {let lWordCount;let lMessageLength = string.length;let lNumberOfWordsTempOne = lMessageLength + 8;let lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;let lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;let lWordArray = Array(lNumberOfWords - 1);let lBytePosition = 0;let lByteCount = 0;while (lByteCount < lMessageLength) {lWordCount = (lByteCount - (lByteCount % 4)) / 4;lBytePosition = (lByteCount % 4) * 8;lWordArray[lWordCount] =lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition);lByteCount++;}lWordCount = (lByteCount - (lByteCount % 4)) / 4;lBytePosition = (lByteCount % 4) * 8;lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);lWordArray[lNumberOfWords - 2] = lMessageLength << 3;lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;return lWordArray;}wordToHex(lValue) {let WordToHexValue = "";let WordToHexValueTemp = "";let lByte;for (let lCount = 0; lCount <= 3; lCount++) {lByte = (lValue >>> (lCount * 8)) & 255;WordToHexValueTemp = "0" + lByte.toString(16);WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);}return WordToHexValue;}uTF8Encode(string) {string = string.replace(/\x0d\x0a/g, "\x0a");let output = "";for (let n = 0; n < string.length; n++) {let c = string.charCodeAt(n);if (c < 128) {output += String.fromCharCode(c);} else if (c > 127 && c < 2048) {output += String.fromCharCode((c >> 6) | 192);output += String.fromCharCode((c & 63) | 128);} else {output += String.fromCharCode((c >> 12) | 224);output += String.fromCharCode(((c >> 6) & 63) | 128);output += String.fromCharCode((c & 63) | 128);}}return output;}res(string) {let x = [];let AA, BB, CC, DD;let S11 = 7;let S12 = 12;let S13 = 17;let S14 = 22;let S21 = 5;let S22 = 9;let S23 = 14;let S24 = 20;let S31 = 4;let S32 = 11;let S33 = 16;let S34 = 23;let S41 = 6;let S42 = 10;let S43 = 15;let S44 = 21;string = this.uTF8Encode(string);x = this.convertToWordArray(string);let a = 0x67452301;let b = 0xefcdab89;let c = 0x98badcfe;let d = 0x10325476;for (let k = 0; k < x.length; k += 16) {AA = a;BB = b;CC = c;DD = d;a = this.FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);d = this.FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);c = this.FF(c, d, a, b, x[k + 2], S13, 0x242070db);b = this.FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);a = this.FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);d = this.FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);c = this.FF(c, d, a, b, x[k + 6], S13, 0xa8304613);b = this.FF(b, c, d, a, x[k + 7], S14, 0xfd469501);a = this.FF(a, b, c, d, x[k + 8], S11, 0x698098d8);d = this.FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);c = this.FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);b = this.FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);a = this.FF(a, b, c, d, x[k + 12], S11, 0x6b901122);d = this.FF(d, a, b, c, x[k + 13], S12, 0xfd987193);c = this.FF(c, d, a, b, x[k + 14], S13, 0xa679438e);b = this.FF(b, c, d, a, x[k + 15], S14, 0x49b40821);a = this.GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);d = this.GG(d, a, b, c, x[k + 6], S22, 0xc040b340);c = this.GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);b = this.GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);a = this.GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);d = this.GG(d, a, b, c, x[k + 10], S22, 0x2441453);c = this.GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);b = this.GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);a = this.GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);d = this.GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);c = this.GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);b = this.GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);a = this.GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);d = this.GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);c = this.GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);b = this.GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);a = this.HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);d = this.HH(d, a, b, c, x[k + 8], S32, 0x8771f681);c = this.HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);b = this.HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);a = this.HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);d = this.HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);c = this.HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);b = this.HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);a = this.HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);d = this.HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);c = this.HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);b = this.HH(b, c, d, a, x[k + 6], S34, 0x4881d05);a = this.HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);d = this.HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);c = this.HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);b = this.HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);a = this.II(a, b, c, d, x[k + 0], S41, 0xf4292244);d = this.II(d, a, b, c, x[k + 7], S42, 0x432aff97);c = this.II(c, d, a, b, x[k + 14], S43, 0xab9423a7);b = this.II(b, c, d, a, x[k + 5], S44, 0xfc93a039);a = this.II(a, b, c, d, x[k + 12], S41, 0x655b59c3);d = this.II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);c = this.II(c, d, a, b, x[k + 10], S43, 0xffeff47d);b = this.II(b, c, d, a, x[k + 1], S44, 0x85845dd1);a = this.II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);d = this.II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);c = this.II(c, d, a, b, x[k + 6], S43, 0xa3014314);b = this.II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);a = this.II(a, b, c, d, x[k + 4], S41, 0xf7537e82);d = this.II(d, a, b, c, x[k + 11], S42, 0xbd3af235);c = this.II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);b = this.II(b, c, d, a, x[k + 9], S44, 0xeb86d391);a = this.addUnsigned(a, AA);b = this.addUnsigned(b, BB);c = this.addUnsigned(c, CC);d = this.addUnsigned(d, DD);}let tempValue = this.wordToHex(a) + this.wordToHex(b) + this.wordToHex(c) + this.wordToHex(d);return tempValue.toLowerCase();}
}
let md5 = new Md5Class();function testMd5() {let startTick = Date.now() / 1000;let result = "测试文本字符串测试文本字符串测试文本字符串";for (let i = 0; i< 1e6; ++i) {result = md5.res(result+i);}console.log(result);let endTick = Date.now() / 1000; console.log(endTick - startTick);
}testMd5();

还有就是对于React Hooks写法, 个人感觉,
会导致代码更凌乱, 结构层次不清晰, 可读性和可维护性下降.

相关文章:

Javascript的ES6 class写法和ES5闭包写法性能对比

看到很多闭包写法的函数, 一直怀疑它对性能是否有影响. 还有就是备受推崇的React Hooks函数式写法中出现大量的闭包和临时函数, 我很担心这样会影响性能. 于是, 做了一个实验来做对比. 这个实验很简单, 用md5计算一百万次. 计算过程将结果再放回参数, 这样避免结果没被引用被…...

探秘MySQL——全面了解索引、索引优化规则

文章目录0.什么是索引1.常用索引分类逻辑维度底层数据结构维度物理维度&#xff08;InnoDB&#xff09;2.为什么底层是B树平衡二叉查找树红黑树B树&#xff08;多叉&#xff09;B树&#xff08;多叉&#xff09;3.MySQL索引优化SQL性能分析之explainQ.MySQL如何查看查询是否用到…...

战斗力最强排行榜:10-30人团队任务管理工具

工欲善其事&#xff0c;必先利其器。在高效的任务执行过程中&#xff0c;选择灵活轻便的项目管理工具来提升工作效率、适应快速多变的发展诉求&#xff0c;对团队来说&#xff0c;至关重要。但是如果团队不大&#xff0c;企业对这块的预算又有限&#xff0c;大型的团队任务管理…...

2023-03-09干活小计

强化学习&#xff1a; 强化学习用智能体&#xff08;agent&#xff09;这个概念来表示做决策的机器。 感知、决策和奖励 感知。智能体在…...

基数排序算法

目录&#xff1a;什么是基数排序&#xff1f;基本原理核心思想实现逻辑代码实现复杂度分析总结什么是基数排序&#xff1f; 基数排序&#xff1a;基数排序&#xff08;Radix sort&#xff09;是一种非比较型整数排序算法&#xff0c; 基本思想主要是通过关键字间的比较和移动记…...

项目实战典型案例24——xxljob控制台不打印日志排查

xxljob控制台不打印日志排查一&#xff1a;背景介绍问题截图问题解读二&#xff1a;思路&方案三&#xff1a;过程四&#xff1a;总结一&#xff1a;背景介绍 本篇博客是对xxljob控制台不打印日志排查进行的总结和进行的改进。 目的是将经历转变为自己的经验。通过博客的方…...

旋转框目标检测mmrotate v1.0.0rc1 之RTMDet训练DOTA的官方问题解析整理(四)

关于rotated_rtmdet_l-coco_pretrain-3x-dota_ms.py配置文件的batchsize和学习率设置问题&#xff1a;回答&#xff1a;如何在mmrotate中绘制特征图问题&#xff1a;回答&#xff1a;你好AllieLan&#xff0c;您可以尝试使用https://github.com/open-mmlab/mmyolo/blob/main/de…...

4个顶级的华为/小米/OPPO/Vivo手机屏幕解锁工具软件

有好几次用户发现自己被锁定在他们的华为/小米/OPPO/Vivo设备之外&#xff0c;我们知道这可能是一种非常可怕的体验。在这种情况下&#xff0c;找到安卓手机解锁软件&#xff0c;重新获得手机中重要数据和文件的访问权限。看看这篇文章&#xff0c;因为我们将与您分享什么是解锁…...

华为OD机试题 - 和最大子矩阵(JavaScript)| 机考必刷

更多题库,搜索引擎搜 梦想橡皮擦华为OD 👑👑👑 更多华为OD题库,搜 梦想橡皮擦 华为OD 👑👑👑 更多华为机考题库,搜 梦想橡皮擦华为OD 👑👑👑 华为OD机试题 最近更新的博客使用说明本篇题解:和最大子矩阵题目输入输出示例一输入输出说明Code思路版权说明华…...

企业电子招标采购系统源码之项目说明和开发类型

项目说明 随着公司的快速发展&#xff0c;企业人员和经营规模不断壮大&#xff0c;公司对内部招采管理的提升提出了更高的要求。在企业里建立一个公平、公开、公正的采购环境&#xff0c;最大限度控制采购成本至关重要。符合国家电子招投标法律法规及相关规范&#xff0c;以及…...

Python高频面试题——装饰器(带大家理解装饰器的本质)

装饰器概念装饰器本质上是一个python函数&#xff0c;它可以让其他函数在不需要做任何代码变动的前提下增加额外功能&#xff0c;装饰器的返回值也是一个函数对象。它经常用于有切面需求的场景&#xff0c;比如&#xff1a;插入日志、性能测试、事务处理、缓存、权限验证等场景…...

全方位解读智能中控屏发展趋势!亚马逊Alexa语音+Matter能力成必备

随着智能家居行业逐步从碎片化的智能单品阶段&#xff0c;迈向体验更完整的全屋互联阶段&#xff0c;智能中控屏作为智能家居最佳的入口之一&#xff0c;在年轻人青睐全屋智能装修的风潮下&#xff0c;市场潜力彻底被引爆。 一、为什么是智能中控屏&#xff1f; 在智能音箱增…...

JAVA练习74-括号生成

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 前言 提示&#xff1a;这里可以添加本文要记录的大概内容&#xff1a; 3月10日练习内容 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、题目-…...

Java ORM开发 更全面的应用场景

1. 一个web系统, 想支持多种数据库, 如同时要用mysql, oracle 需要动态切换数据源? 2. 读写分离, 但读库与写库是不同的类型, 如分别是: mysql, oracle 3. 智能化自动过滤null和空字符串&#xff0c;不再需要写判断非空的代码。 4.动态/任意组合查询条件,不需要提前准备da…...

SpringBoot【基础篇】---- 基础配置

SpringBoot【基础篇】---- 基础配置1. 属性配置2. 配置文件分类3. yaml 文件4. yaml 数据读取1. 读取单一数据2. 读取全部数据3. 读取对象数据yaml 文件中的数据引用1. 属性配置 SpringBoot 通过配置文件 application.properties 就可以修改默认的配置&#xff0c;那咱们就先找…...

手机磁吸背夹散热器制冷快速方案

手机散热器是什么&#xff1f;手机散热器分为几种类型&#xff1f;手机散热的方式都有哪些&#xff1f; 因为经常玩游戏&#xff0c;手机发热得厉害&#xff0c;都可以煎鸡蛋了&#xff0c;心想着要买个东西给手机散散热&#xff0c;没想到还真的有手机散热器。 不知道手机散…...

青岛OJ(QingdaoU/OnlineJudge)部署如何直连数据库批量修改

1.postgres数据库QingdaoU/OnlineJudge用的数据库是postgreSQL&#xff0c;一个关系型数据库。默认端口是5432&#xff0c;我们下载一个navcat 15以上的版本&#xff0c;用来连数据库。2.修改docker-compose.yml文件修改docker-compose.yml&#xff0c;手动添加一个端口&#x…...

渗透测试——信息收集(详细)

信息收集&#xff1a;前言&#xff1a;信息收集是渗透测试除了授权之外的第一步&#xff0c;也是关键的一步&#xff0c;尽量多的收集目标的信息会给后续的渗透事半功倍。收集信息的思路有很多&#xff0c;例如&#xff1a;页面信息收集、域名信息收集、敏感信息收集、子域名收…...

什么是谐波

什么是谐波 目录 1. 问题的提出 2. “谐”字在中英文中的原意 2.1 “谐”字在汉语中的原义 2.2 “谐”字对应的英语词的原义 3.“harmonics(谐波)”概念是谁引入物理学中的&#xff1f; 4.“harmonics(谐波)”的数学解释 1. 问题的提出 “谐波”这个术语用于各种学科&am…...

技术报告:程序员如何开发一个商城型购物网站

前言随着互联网的快速发展&#xff0c;电商行业正成为越来越多人的选择。而作为电商行业的主要参与者之一&#xff0c;商城型购物网站的开发则成为程序员不可避免的任务之一。本文将对商城型购物网站的开发进行详细阐述&#xff0c;包括需求分析、架构设计、技术选型、前后端开…...

DPDK系列之八虚拟化virtio

一、virtio的介绍 在一篇文章中对virtio进行了简单的说明。在早期的虚拟化的过程中&#xff0c;无论是KVM还是Vmware亦或是Xen&#xff0c;每个平台想当然的是自己搞自己的IO接口。这就和现在国内的互联各个平台都是大而全一样&#xff0c;怎么可能我用你的支付接口呢&#xf…...

直播间与2位优秀创作者分享经历

我是卢松松&#xff0c;点点上面的头像&#xff0c;欢迎关注我哦&#xff01; 昨天&#xff0c;卢松松的直播间好像又被推荐给了2.9万人观看&#xff0c;讲了一个小时后直播间的人数一直攀升&#xff0c;最终冲破了2万人大关。晚些时候&#xff0c;白杨SEO也来到了我的直播间&…...

linux上快速安装 Flarum 指南

一、安装Composer Composer是PHP的依赖管理器(类似于Node.js的npm或Python的 pip ),它可用于当前流行的PHP平台,例如Drupal、Magento等。那么如何安装PHP Composer呢?本文将为大家介绍下在Debian 10上安装PHP Composer的教程。 在安装 Composer 之前,请确保您的 Debian …...

数学不好,英语不行,非本专业,可以学IT吗?

看到很多想入行IT编程的小伙伴&#xff0c;都会问一些比较类似的问题。 比如&#xff1a; 不是计算机专业的&#xff0c;可以学编程吗&#xff1f; 数学一直就不好&#xff0c;可以转行学IT吗&#xff1f; 学编程开发&#xff0c;对英语的要求会不会很高&#xff1f; 01、…...

软件测试13

Linux命令 1.pwd&#xff1a;查看当前所在的路径位置 2.ls&#xff1a;查看当前路径下有哪些文件 3.cd&#xff1a;切换路径 4.touch&#xff1a;创建普通文件&#xff0c;可以创建单文件&#xff0c;也可以创建多文件&#xff08;touch a&#xff0c;touch b c&#xff09; 5…...

React(八):引出Hook、useState、useEffect的使用详解

React&#xff08;八&#xff09;一、类组件的优劣势1.类组件的优势2.类组件的劣势&#xff08;1&#xff09;复杂组件会难以理解&#xff08;2&#xff09;复杂的class&#xff08;3&#xff09;组件复用状态很难二、Hook初体验useState1.使用Hook的计数器案例2.详解useState&…...

32*4VKL128 LQFP44超低功耗/超低工作电流/抗干扰LCD液晶段码驱动IC/LCD驱动芯片(IC) 适用于激光/红外线测距仪

产品型号&#xff1a;VKL128产品品牌&#xff1a;永嘉微电/VINKA封装形式&#xff1a;LQFP44产品年份&#xff1a;新年份原厂&#xff0c;工程服务&#xff0c;技术支持&#xff01;VKL128概述:VKL128是一个点阵式存储映射的LCD驱动器&#xff0c;可支持最大128点&#xff08;3…...

自定义控件(?/N) - 事件分发

一、外部传递到ViewGroup中Activity会通过 getWindow( ) 获取PhoneWindow对象并调用它的superDispatchTouchEvent( )&#xff0c;该方法会调用它&#xff08;PhoneWindow&#xff09;的内部类 DecorView 的 superDispatchTouchEvent( )&#xff0c;而它&#xff08;DecorView&a…...

诗一样的代码命名规范

有文化&#xff1a;落霞与孤鹜齐飞&#xff0c;秋水共长天一色&#xff1b;没文化&#xff1a;太阳落山的时候&#xff0c;看见一只鸟在水上飞&#xff1b;日常编码中&#xff0c;代码的命名是个大的学问。能快速的看懂开源软件的代码结构和意图&#xff0c;也是一项必备的能力…...

L1-010 比较大小 L1-030 一帮一 L1-015 跟奥巴马一起画方块 L1-035 情人节

本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数&#xff0c;其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出&#xff0c;其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 // 题目链接 https://pintia.cn/prob…...

如何使用免费的wordpress/百度top风云榜

我们都知道Java对象分配在堆中&#xff0c;但是堆分新生代、老年代&#xff0c;新生代又分eden、from Survivor、toSurvivor。今天通过简单的示例来验证下!一、对象优先分配在Eden区对象创建一般都优先放到eden区&#xff0c;jvm参数配置&#xff1a;-verbose:gc-Xms20M -Xmx20…...

wordpress所有函数/微信最好用的营销软件

EasyNVS云管理平台是新一代基于创新的超融合和技术构建&#xff0c;具备完整的视频流媒体服务能力和运维管理服务能力的云架构平台&#xff0c;可将多套EasyNVR设备统一接口进行登记和管理。 EasyNVS通道列表不显示数据 正常情况下&#xff0c;接入EasyNVS的设备通道都会显示在…...

做设计的靠谱兼职网站/郑州网站开发公司

建立mysql用户、组 groupadd mysql useradd -g mysql mysql 然后删除 userdel mysql 再添用户和组加时&#xff0c;提示&#xff1a; 解决方法&#xff1a;删除用户不用userdel mysql 改为用userdel -rf mysql...

做的网站浏览的越多越挣钱/深圳网络推广外包公司

Vuejs2.0全家桶结合ELementUI制作后台管理系统 0&#xff1a; 系统环境的介绍 1&#xff1a; Vuejs实例-01使用vue-cli脚手架搭建Vue.js项目 2&#xff1a; Vuejs实例-02Vue.js项目集成ElementUI 3&#xff1a; 使用Vue-Router插件构建单页面应用(这个不知道如何编写文章&#…...

网络设计目标及设计思想/搜索引擎优化的名词解释

Ⅰ 与后端交互 - ajax版本1 - 出现了跨域问题前端&#xff1a;index.html<!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Vue与后端交互 - 出现了跨域问题</title><script src"https://…...

企业邮箱怎么申请的/seo服务外包费用

本文为教程记录笔记&#xff0c;内容比较多&#xff0c;分为上下篇。&#xff08;对原著精简了一部分&#xff09;上篇主要介绍楼房主体&#xff0c;房顶以及墙线&#xff08;不清楚这个结构具体怎么叫&#xff09;的制作&#xff1b;下篇主要介绍楼顶围栏&#xff0c;窗户&…...