MyExcel 3.4.0.RC2 release, performance & Reviews

MyExcel, is a set of import, export, encryption, Excel and many other features of Java toolkit.

MyExcel constructed using declarative syntax, read Excel, specific operational details POI shield (no perception of the POI), to develop alternative conventional techniques, such construct (from the simple to the highly complex Excel) Excel and reading becomes very convenient and build, read performance is very good, very low memory footprint ( see read performance evaluation below ).

The Import:

List<ArtCrowd> result = SaxExcelReader.of(ArtCrowd.class)
        .sheet(0) // 0代表第一个,如果为0,可省略该操作,也可sheet("名称")读取
        .rowFilter(row -> row.getRowNum() > 0) // 如无需过滤,可省略该操作,0代表第一行
        .beanFilter(ArtCrowd::isDance) // bean过滤
        .read(path.toFile());

This update points are as follows:

  • Repair CsvBuilder thread-safety issues;
  • CsvBuilder and DefaultExcelBuilder unified model, unified and easy to read source code to upgrade;
  • Delayed CsvBuilder temporary files created opportunity, created only when there is data;
  • CsvBuilder support Map export, csv / excel without specifying fieldDisplayOrder when exporting to Map, Map using the default order;
  • When Csv export Bigdecimal, support formatting;
  • Significantly optimize memory usage when the mass data read Excel, the average memory footprint is about 75 trillion;
  • Support no ExcelColumn notes read, then read all fields default default order;
  • Exporting data transformation adds converter cache to improve performance derived;
  • Support global set time, numerical format, the time for multiple attributes or attribute values ​​do not all need to format set;
  • Add comment ExcelModel ExcelTable place annotations, add annotations ExcludeColumn IgnoreColumn place, enhanced semantics, the degree of recognition;
  • Code optimization, remove redundant code and semantic code is unknown;
  • DefaultExcelBuilder, DefaultStreamExcelBuilder support formula is derived;
  • Unified .xlsx, .xls, .csv SAX reads model;

For details, please refer to the documentation: Documentation

It should the user request, this provides MyExcel read performance testing, as follows:

Test Environment: MAC AIR 8G memory 1.8 GHz dual-core Intel Core i5

Test file: .xlsx file 550,000 lines 10/40 cycles per importer reading once finished, sleeps for 5 seconds, and the pure read, do not do any custom processing

Contrast side: MyExcel V3.4.0.RC2 VS Ali EasyExcel V2.1.6

First on the results, the specific parameters of the venue last! ! !

MyExcel : average occupancy memory 75M, the total time of 12 minutes 40 times, substantially no change in the data memory footprint for

Ali EasyExcel : average memory for 300M, 15 minutes of inactivity finished

script:

public static void main(String[] args) throws Exception {
        URL htmlToExcelEampleURL = App.class.getResource("/big_build.xlsx");
        Path path = Paths.get(htmlToExcelEampleURL.toURI());

        for (int i = 0; i < 40; i++) {
            SaxExcelReader.of(TestDO.class).readThen(path.toFile(), c -> {
      //          System.out.println(c.birthday);
            });

      //    替换为阿里EasyExcel
      //    EasyExcel.read(path.toFile(), TestDO.class,new DemoDataListener()).sheet().doRead();
            Thread.sleep(5000);
        }
    }



public class TestDO {

    @ExcelColumn(title = "姓名", index = 0)
    String name;

    @ExcelColumn(title = "姓名", index = 1)
    String dance;

    @ExcelColumn(title = "金钱", index = 2)
    String money;

    @ExcelColumn(title = "生日", index = 3)
    String birthday;

    @ExcelColumn(title = "当前日期", index = 4)
    String localDate;

    @ExcelColumn(title = "当前时间", index = 5)
    String localDateTime;

    @ExcelColumn(title = "小猫数目", index = 6)
    String cats;

    @ExcelColumn(title = "小狗数目", index = 7)
    String dogs;

    @ExcelColumn(title = "考拉数目", index = 8)
    String kos;

    @ExcelColumn(title = "考拉数目", index = 9)
    String jos;
}

Guess you like

Origin www.oschina.net/news/113304/myexcel-3-4-rc2-released
Recommended