POI 的簡單版本 EasyPoi效能測試 系列一,poieasypoi

來源:互聯網
上載者:User

POI 的簡單版本 EasyPoi效能測試 系列一,poieasypoi
1.基礎功能匯出測試    測試案例,匯出5行資料,一個關聯類別,25000或者5W行資料測試demo主對象public class MsgClient implements java.io.Serializable {    /** id */    private java.lang.String id;    // 電話號碼(主鍵)    @Excel(name = "電話號碼", width = 20, orderNum = "2")    private String           clientPhone = null;    // 客戶姓名    @Excel(name = "姓名", orderNum = "1")    private String           clientName  = null;    // 所屬分組    @ExcelEntity    private MsgClientGroup   group       = null;    // 備忘    @Excel(name = "備忘")    private String           remark      = null;    // 生日    @Excel(name = "出生日期", format = "yyyy-MM-dd", width = 20)    private Date             birthday    = null;    // 建立人    private String           createBy    = null;    關聯對象public class MsgClientGroup implements Serializable {     /**     *      */    private static final long serialVersionUID = 6946265640897464878L;     // 組名    @Excel(name = "分組")    private String            groupName        = null;    /**     * 建立人     */    private String            createBy;
測試代碼 @Test public void test() throws Exception {         List<MsgClient> list = new ArrayList<MsgClient>();        for (int i = 0; i < 25000; i++) {            MsgClient client = new MsgClient();            client.setBirthday(new Date());            client.setClientName("小明" + i);            client.setClientPhone("18797" + i);            client.setCreateBy("jueyue");            client.setId("1" + i);            client.setRemark("測試" + i);            MsgClientGroup group = new MsgClientGroup();            group.setGroupName("測試" + i);            client.setGroup(group);            list.add(client);        }        Date start = new Date();        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("2412312", "測試"),            MsgClient.class, list);        System.out.println(new Date().getTime() - start.getTime());        File savefile = new File("d:/");        if (!savefile.exists()) {            savefile.mkdirs();        }        FileOutputStream fos = new FileOutputStream("d:/tt.xls");        workbook.write(fos);        fos.close();    }測試結果    匯出用時03版本

測試No 資料量 用時
1 25000 1381
2 25000 1292
3 50000 1551
4 50000 1604
07版本
測試No 資料量 用時
1 25000 6276
2 25000 6342
3 50000 10014
4 50000 9897

07版本,修改了寫入類,改成了SXSSFWorkbook
測試No 資料量 用時
1 25000 3224
2 25000 3457
3 50000 4044
4 50000 3924

說明對大資料量的匯出,03版本的Excel基本模板基本上沒有在時間上面對效能做出影響但是07版本的匯出,在時間上有較大的差異,在修改成SXSSFWorkbook匯出時間比之前有了較大的提示,但是比03版本仍有不少差異但是兩個匯出檔案有3-4倍的差距,如果流量比較重要,或者網速比較重要可以用03,如果網速快,想提高伺服器用03的匯出


源碼地址:點擊開啟連結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.