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/08/14 16:06:00 UTC

[Bug 56854] New: XMLBeans performance when using getXXXList() and other proxy methods

https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

            Bug ID: 56854
           Summary: XMLBeans performance when using getXXXList() and other
                    proxy methods
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: yaniv@kundas.net

The XMLBeans recommendation is that when accessing long XML documents, or
when performance matters, one should use XmlCursor and not getXXXList().

In order to provide a short-term solution, I propose we sweep the
code and replace all usages of getXXXList() with getXXXArray() -  which is
much faster since it creates a snapshot of the xml data instead of a live
view.

This will be trivial for read-only operations (e.g. bug #56556) and easy
for write operations – just read the array, work on it or create a new one,
and set the result back to the proxy.

Also, some attempts to minimize this – using toArray() on the returned
list, can be reduced to getXXXArray(), since toArray() iterates over the
elements, which is very inefficient in the XmlBeans impl.

We should decide how to document the new (and old) usages of getXXXArray(),
which are deprecated (and probably will be as long as the XMLBeans project is
dead) -
either by ignoring it altogether, or by adding @SuppressWarnings("deprecation")
on all usages (thus always using a variable) optionally with a comment
describing why the deprecated method is used (e.g. a link to this bug).

In addition, other methods (e.g. CTCol.getMax()) are sometimes called several
times in the same scope when their result is not changing, which is another
redundant piece of XMLBeans code being called.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

Yaniv Kunda <ya...@kundas.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31921|Preliminary optimizations   |56854-1
        description|                            |

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

--- Comment #5 from Yaniv Kunda <ya...@kundas.net> ---
You're right - sometimes it takes development to visit the "complicated"
station when travelling from "a mess" to "elegant" :-)

Note: the patch for XSSFSheet.removeMergedRegion/s is what I originally done in
https://issues.apache.org/bugzilla/attachment.cgi?id=31960&action=diff
for issue 55280 (https://issues.apache.org/bugzilla/show_bug.cgi?id=55280)

(In reply to Andreas Beeker from comment #4)
> Thank you for the second patch - applied with r1624922
> XSSFSheet.removeMergedRegion(int) looked too complicated, I haven't seen a
> reason, why not to use the default remove-element-by-index impl.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

--- Comment #3 from Yaniv Kunda <ya...@kundas.net> ---
Created attachment 32020
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32020&action=edit
56854-2

Additional optimizations, mainly in XSSFSheet

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

--- Comment #4 from Andreas Beeker <an...@gmx.de> ---
Thank you for the second patch - applied with r1624922
XSSFSheet.removeMergedRegion(int) looked too complicated, I haven't seen a
reason, why not to use the default remove-element-by-index impl.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

--- Comment #1 from Yaniv Kunda <ya...@kundas.net> ---
Created attachment 31921
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31921&action=edit
Preliminary optimizations

This is a first sweep of proxy method usages, which includes mostly usage of
array-based proxy methods instead of list-based when appropriate, and other
repeat calls of methods inlined.

test-all runtime dropped from ~80 seconds to ~60 on my machine, mostly due to
the changes in XSSF and ColumnHelper.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

Andreas Beeker <an...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #6 from Andreas Beeker <an...@gmx.de> ---
Thanks for linking the other bug - I've already had a quick look yesterday
where these XSSFSheet.removeMergedRegion(s) methods came from ... :)

I haven't setup a profile environment for the test cases, yet (... the builds
are now faster, when looking at builds.apache.org, but this only a very rough
estimation ...)

Yaniv, in case you already have it in place (and also have some old stats to
compare to), it would be good, if you also validate/profile the derivation from
your patch - sometimes it's hard to decide if something is just refurbished old
code or if it's like this on purpose.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

--- Comment #2 from Andreas Beeker <an...@gmx.de> ---
Thank you for the patch - applied with r1620997

Most changes were trivial and the tests for ColumnHelper were successful, so
should be ok. Added a few deprecation-ignores.

for the time being, I'll leave the bug entry open, waiting for the next diff.

-- 
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 56854] XMLBeans performance when using getXXXList() and other proxy methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56854

Yaniv Kunda <ya...@kundas.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|PC                          |All
            Version|unspecified                 |3.11-dev
                 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