easypoi、easyexcel和hutool读取excel测试对比

因官方api已经很详细了,本文仅记录测试对比,不做使用方法介绍。测试结果与各种环境相关,仅作参考。

准备

excel 文件:14,535,190 字节(磁盘上的14.5 MB)92568条数据。 1.easypoi (4.3.0) 2.easyexcel(2.2.10) 3.hutool(5.5.1)

测试对比

取5次的平均值,未对excel做数据校验:

函数 耗时(s) easypoi ExcelImportUtil#importExcelBySax 594.23237800 easyexcel EasyExcel#read 42.09475480 hutool ExcelUtil#readBySax 26.39670200

如何选择?

1.如果excel数据量小,可选择easypoi,扩展功能比较丰富,如支持注解数据校验等功能;数据量大未使用sax读取excel,容易oom。 2.如果excel数据量大,建议使用easyexcel。 3.hutool速度也快,但是RowHandler不支持泛型;数据量大未使用sax读取excel,容易oom。

经验分享 程序员 微信小程序 职场和发展