上一次修改时间:2017-10-01 23:02:02

数据规模------一千万带符号整数

服务器环境:CPU------Intel(R) Core(TM)2 Duo CPU T9400  2.53GHz

                    内存------2G   硬盘------500G 机械硬盘

1.数据文件生成

/*
 * 生成一千万个随机整数
 */
function generateInt(){
    $path = '/usr/local/apache/htdocs/test/data/int_1000w.txt';
    $handle = fopen($path, 'a');
    for($i=0; $i<1000; $i++){
        $str = '';
        for($j=0; $j<10000; $j++)
            $str .= rand(-50000000,50000000)."\n"; 
        fwrite($handle, $str);
    }
    fclose($handle);
}

生成后的文件大小为90M

1千万随机整数中查找某个特定值,如180的相关测试