阵列处理性能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阵列处理性能相关的知识,希望对你有一定的参考价值。
This method is better suited for processing large arrays in the smallest amount of time without affecting the user experience.
//Copyright 2009 Nicholas C. Zakas. All rights reserved. //MIT Licensed function timedChunk(items, process, context, callback){ var todo = items.concat(); //create a clone of the original setTimeout(function(){ var start = +new Date(); do { process.call(context, todo.shift()); } while (todo.length > 0 && (+new Date() - start < 50)); if (todo.length > 0){ setTimeout(arguments.callee, 25); } else { callback(items); } }, 25); }
以上是关于阵列处理性能的主要内容,如果未能解决你的问题,请参考以下文章
php Slack.com Webhook Integration(PHP) - 简单的片段,告诉您如何构建有效负载阵列。