You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/04/22 03:55:15 UTC
[Bug 56440] New: removeRow is too late ...
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
Bug ID: 56440
Summary: removeRow is too late ...
Product: POI
Version: 3.10
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: tersitain@gmail.com
API: XSSF
file: *.xlsx
When i use removeRow or shiftRows to handle some rows with FormulaCell,
its almost cost 2Sec for one Row.
Do the samething use HSSF is fast.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
--- Comment #2 from ki <te...@gmail.com> ---
thx for answer me.
Juet the simple file whth the
FormulaCell[=IF((COUNT(U224,U225,U226,U227))>0,ROUND(SUM(U224,U225,U226,U227),6),0)].
The file has 2000rows and 100 cols,size is 1.3 MB,not ON ie.
to delete 20rows for xlsx cost 40sec,but xls is 1sec....
the test soure is under..
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class ReadExcelSheetTest {
public static void main(final String[] args) throws InvalidFormatException
{
try {
String templatePath = "C:\\temp\\test.xlsx";
FileInputStream fis = null;
fis = new FileInputStream(templatePath);
Workbook workbook = WorkbookFactory.create(fis);
Sheet sheet = workbook.getSheet("a");
for (int i = 20; i >= 1; i--) {
Row row = sheet.getRow(i);
if (row != null) {
sheet.removeRow(row);
System.out.println("-----" + i);
}
}
workbook.write(new FileOutputStream("C:\\temp\\3.xlsx"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
--- Comment #3 from ki <te...@gmail.com> ---
thx for answer me.
just the simple file whth the
FormulaCell[=IF((COUNT(U224,U225,U226,U227))>0,ROUND(SUM(U224,U225,U226,U227),6),0)].
The file has 2000rows and 100 cols,size is 1.3 MB,not ON ie.
to delete 20rows for xlsx cost 40sec,but xls is 1sec....
the test soure is under..
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class ReadExcelSheetTest {
public static void main(final String[] args) throws InvalidFormatException
{
try {
String templatePath = "C:\\temp\\test.xlsx";
FileInputStream fis = null;
fis = new FileInputStream(templatePath);
Workbook workbook = WorkbookFactory.create(fis);
Sheet sheet = workbook.getSheet("a");
for (int i = 20; i >= 1; i--) {
Row row = sheet.getRow(i);
if (row != null) {
sheet.removeRow(row);
System.out.println("-----" + i);
}
}
workbook.write(new FileOutputStream("C:\\temp\\3.xlsx"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #4 from Nick Burch <ap...@gagravarr.org> ---
Are you able to use a profiler to work out where the extra time goes on XSSF?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
ki <te...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS|All |Windows 7
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
ki <te...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #5 from ki <te...@gmail.com> ---
To debug the source I knew c.length = 202176....
package org.apache.poi.xssf.model;
public class CalculationChain extends POIXMLDocumentPart {
・・・・
public void removeItem(int sheetId, String ref){
//sheet Id of a sheet the cell belongs to
int id = -1;
CTCalcCell[] c = chain.getCArray();
for (int i = 0; i < c.length; i++){
//If sheet Id is omitted, it is assumed to be the same as the
value of the previous cell.
if(c[i].isSetI()) id = c[i].getI();
if(id == sheetId && c[i].getR().equals(ref)){
if(c[i].isSetI() && i < c.length - 1 && !c[i+1].isSetI()) {
c[i+1].setI(id);
}
chain.removeC(i);
break;
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow is too late ...
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
ki <te...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|removeRow is too late ... |removeRow in XSSF is much
| |slower than with HSSF
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow in XSSF is much slower than with HSSF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
ki <te...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56440] removeRow is too late ...
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
HSSF is often a tiny bit faster than XSSF, but rarely more than a few times
Are you able to use a profiler to work out where the extra time on XSSF goes?
Also, does it happen for simple files too? i.e. is this related to one specific
class of file, or all files?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org