概述 今天产品反映有个5000条数据的页面的保存按钮很慢,查看代码看到是因为点击保存按钮之后,进行了查重操作,而查重操作是用2个for循环完成了,时间复杂度是O(n^2)。没办法,只能想办法优化一下了。 主要参考了这篇文章: "JavaScript 高性能数组去重" 源码 简单来说,这个页面的要求是 ...
分类:
Web程序 时间:
2019-03-06 20:39:04
阅读次数:
241
本文只列举一个压缩帮助类,使用的是有要添加一个dll引用ICSharpCode.SharpZipLib.dll【下载地址】。 另外说明一下的是,这个类压缩格式是ZIP的,所以文件的后缀写成 .zip。 还有,如果用这个类来解压rar格式的压缩文件时会报错,就网上说的那个"Wrong Local he ...
方法一:作比较 方法二:使用整除实现,除完后如果是个0或不是个0,这种方法引入了计算,效率会降低,所以能加就不要减,能乘就不要除,能不计算就不计算 方法三: 方法四:字符串处理实现 方法五:折半实现 方法六:math实现,这种方法比除法的更慢,如果循环100万次就很明显 欢迎补充~ ...
分类:
编程语言 时间:
2019-02-23 10:38:22
阅读次数:
540
题目描述 将1,2,?,9共9个数分成3组,分别组成3个三位数,且使这3个三位数构成1:2:3的比例,试求出所有满足条件的3个三位数。 例如:192 384 576 解法1:用字符串解决 ...
分类:
其他好文 时间:
2019-02-15 15:57:19
阅读次数:
185
HDU-5969:http://acm.hdu.edu.cn/showproblem.php?pid=5969 一开始也是分了类,觉得要两种情况,l 与 r 位数相同与不同的情况,仔细想一下,可以一起处理,从最高位(左侧符号位)开始,遇到不同后面全部补1即可。 刚写好交信心满满,一交就Wrong a ...
分类:
其他好文 时间:
2019-02-08 17:12:22
阅读次数:
227
算法描述: Given the head of a graph, return a deep copy (clone) of the graph. Each node in the graph contains a label (int) and a list (List[UndirectedGra ...
分类:
其他好文 时间:
2019-02-06 10:44:54
阅读次数:
146
May 31, 2016 May 31, 2016 Calling a virtual method through an interface always was a lot slower than calling a static method through an interface. But ...
分类:
其他好文 时间:
2019-01-30 01:25:10
阅读次数:
153
A Bug's Life POJ - 2492 Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two dif ...
分类:
其他好文 时间:
2019-01-28 19:22:43
阅读次数:
148
$(this.div_wrong).show().css({width:"0px", height:"0px"}) .animate({width:"260px",height:"300px"}, 150 ) .animate({width:"200px",height:"240px"}, 150 ...
分类:
Web程序 时间:
2019-01-28 00:41:12
阅读次数:
201
这个问题吊不起微信支付,最终发现是后台接口给我传的appid不正确,传成另一个app的id了 错误日志: FAILURE: Build failed with an exception. * What went wrong:Execution failed for task ':app:transf ...
分类:
编程语言 时间:
2019-01-27 19:28:38
阅读次数:
223