【发布时间】:2014-12-22 17:09:58
【问题描述】:
我尝试使用 PHPExcel 手册第 4.2.1 节中的不同缓存方法。
做了一个 100k 行的基准测试,结果如下
gzip = time=50,memoryused=177734904
ser = time=34,memoryused=291654272
phptm= time=41,memoryused=325973456
isamm= time=39,memoryused=325972824
手册说 phptmp 和 isamm 方法使用磁盘而不是内存。因此,他们应该使用最少的内存,但似乎恰恰相反。
这是我用来测试的代码:
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
// $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;
// $cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
// $cacheSettings = array( 'memoryCacheSize' => '8MB');
// $cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_discISAM;
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
$xlsReader = PHPExcel_IOFactory::createReader($fileType);
$xlsReader->setReadDataOnly(true);
谁能解开这个谜团?
【问题讨论】:
标签: benchmarking phpexcel