Posted 15 August 2024, 7:41 am EST
- Updated 15 August 2024, 8:31 am EST
Hi, here is simple test with latest version
Version: com.grapecity.documents:gcexcel:7.1.5
Config: MacBook Pro M1 Pro 32GB
public class ExcelDemo {
@Test
public void testPerformance() throws IOException {
var workbook = new Workbook();
var worksheet = workbook.getWorksheets().add();
worksheet.setName("Data");
var style = workbook.getStyles().add("myCustomStyle");
style.getFont().setSize(16);
style.getFont().setColor(Color.GetLightGray());
var dataStartTime = System.currentTimeMillis();
var range = worksheet.getRange(0, 0, 50_000, 25);
range.setValue(data());
range.setStyle(style);
var condition = (IFormatCondition) range.getFormatConditions().add(FormatConditionType.Expression, FormatConditionOperator.None, "=ISEVEN(ROW())", null);
condition.getInterior().setColor(Color.FromArgb(238, 243, 248));
System.out.println("Data Time (ms): " + (System.currentTimeMillis() - dataStartTime));
var hyperlinkStartTime = System.currentTimeMillis();
for (int i = 0; i < 50_000; i++) {
worksheet.getHyperlinks().add(worksheet.getRange(i, 24), "https://google.com/" + i, null, null, "Google Link");
}
System.out.println("Hyperlink Time (ms): " + (System.currentTimeMillis() - hyperlinkStartTime));
Files.createFile(Path.of("testFile.xlsx"));
var saveStartTime = System.currentTimeMillis();
workbook.save("testFile.xlsx", SaveFileFormat.Xlsx);
System.out.println("Save Time (ms): " + (System.currentTimeMillis() - saveStartTime));
}
private Object[][] data() {
Object[][] rows = new Object[50_000][25];
Object[] columns = new Object[]{
"column1",
"column2",
"column3",
"column4",
"column5",
"column6",
"column7",
"column8",
"column9",
"column10",
"column11",
"column12",
"column13",
"column14",
"column15",
"column16",
"column17",
"column18",
"column19",
"column20",
"column21",
"column22",
"column23",
"column24",
"column25"
};
Arrays.fill(rows, columns);
return rows;
}
}
Results (several attempts):
Data Time (ms): 400 - 550
Hyperlink Time (ms): 7000 - 15500
Save Time (ms): 2000 - 3000)