You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2014/06/04 17:58:14 UTC
svn commit: r1600319 -
/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
Author: nick
Date: Wed Jun 4 15:58:14 2014
New Revision: 1600319
URL: http://svn.apache.org/r1600319
Log:
When finding the CTCol object for a XSSF Sheet column, as we often have to traverse most of the list, and we are mostly reading not changing, switch to fetching all the objects as an array in one go, rather than fetching one at a time, which is hopefully faster. Aims to help bug #56556
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java?rev=1600319&r1=1600318&r2=1600319&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java Wed Jun 4 15:58:14 2014
@@ -199,8 +199,15 @@ public class ColumnHelper {
*/
public CTCol getColumn1Based(long index1, boolean splitColumns) {
CTCols colsArray = worksheet.getColsArray(0);
- for (int i = 0; i < colsArray.sizeOfColArray(); i++) {
- CTCol colArray = colsArray.getColArray(i);
+
+ // Fetching the array is quicker than working on the new style
+ // list, assuming we need to read many of them (which we often do),
+ // and assuming we're not making many changes (which we're not)
+ @SuppressWarnings("deprecation")
+ CTCol[] cols = colsArray.getColArray();
+
+ for (int i = 0; i < cols.length; i++) {
+ CTCol colArray = cols[i];
if (colArray.getMin() <= index1 && colArray.getMax() >= index1) {
if (splitColumns) {
if (colArray.getMin() < index1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org