Skip to content

Instantly share code, notes, and snippets.

@sandacn
sandacn / gist:923000
Created April 16, 2011 09:10
## 测试一个特殊case下的性能优化
<?php
# 测试的结果表明,使用第一种方法是最快的,另外注意在for之前计算好最大值
$server_string = '192.168.1.52:11211,192.168.1.53:11211,192.168.1.54:11211,192.168.1.50:11211,192.168.1.51:11211';
$server_string = '192.168.1.52:11211:1,192.168.1.53:11211:2,192.168.1.54:11211:3,192.168.1.50:11211:4,192.168.1.51:11211:5';
$server_setting = explode(',',$server_string);
$MAX = 1000;
$start = microtime(true);
for ($k = 0; $k < $MAX; $k++) {