ASF Bugzilla – Attachment 32715 Details for
Bug 57893
[PATCH] XSSFSheet.getMergedRegion(int) takes O(n^2) time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Sample code demonstrating slow performance
MergedRegionsSpeedTest.java (text/x-java), 1.45 KB, created by
Chris Boyle
on 2015-05-05 16:23:34 UTC
(
hide
)
Description:
Sample code demonstrating slow performance
Filename:
MIME Type:
Creator:
Chris Boyle
Created:
2015-05-05 16:23:34 UTC
Size:
1.45 KB
patch
obsolete
>package com.example; > >import java.io.IOException; > >import org.apache.poi.openxml4j.exceptions.InvalidFormatException; >import org.apache.poi.openxml4j.opc.OPCPackage; >import org.apache.poi.ss.util.CellRangeAddress; >import org.apache.poi.xssf.usermodel.XSSFSheet; >import org.apache.poi.xssf.usermodel.XSSFWorkbook; >import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMergeCell; >import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMergeCells; > >public class MergedRegionsSpeedTest { > > public static void main(final String[] args) throws IOException, InvalidFormatException, InterruptedException { > final XSSFSheet sheet = new XSSFWorkbook(OPCPackage.open("many-merges.xlsx")).getSheetAt(0); > final int count = sheet.getNumMergedRegions(); > > long start = System.currentTimeMillis(); > for (int i = 0; i < count; i++) { > sheet.getMergedRegion(i); > } > long millis = System.currentTimeMillis() - start; > System.out.println("getMergedRegion(int): " + millis); > > start = System.currentTimeMillis(); > final CTMergeCells mergeCells = sheet.getCTWorksheet().getMergeCells(); > if (mergeCells != null) { > @SuppressWarnings("deprecation") > final CTMergeCell[] mergeCellArray = mergeCells.getMergeCellArray(); > for (int i = 0; i < count; i++) { > CellRangeAddress.valueOf(mergeCellArray[i].getRef()); > } > } > millis = System.currentTimeMillis() - start; > System.out.println("Direct access: " + millis); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 57893
: 32715 |
32716
|
32723
|
32724