You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2010/10/12 16:05:24 UTC
performance issues with ooxml-schemas-1.1.jar
Hi All,
There are performance issues with using JDK 1.5 syntax methods in
ooxml-schemas-1.1.jar and my concern is whether it is a blocker for POI-3.7.
In ooxml-schemas-1.0.jar a collection of XmlBeans could be accessed via
getXXXArray(), e.g.
CTRow[] rows = sheet.getRowArray()
ooxml-schemas-1.1.jar was compiled with JDK-1.5 support and the
preferred way of accessing collections is via getXXXList():
List<CTRow> rows = sheet.getRowList()
XmlBeans seems to force users to use getXXXList(), because all
getXXXArray() accessors are marked deprecated. So we changed everything
to use getXXXList() and thought we were fine :).
I always thought that getXXXList() and getXXXArray() are synonyms and
the returned List is a wrapper around the array. I also thought that the
following two forms of walking the sheet matrix are equivalent:
//old-style getXXArray()
for(CTRow row : sheet.getRowArray()){
for(CTCell cell : row.getCArray()){
}
}
// new getXXXList()
for(CTRow row : sheet.getRowList()){
for(CTCell cell : row.getCList()){
}
}
It turned out it is NOT so, getXXArray() is way faster than
getXXXList(). I analyzed the auto-generated source code and found that
they work differently.
A call of getXXXArray() performs an XPATH request to the underlying DOM
and returns the selected beans.
A call of getXXXList() does nothing. The returned List is a custom
subclass of AbstractList where overridden List.get(int index) sends an
XPATH request. This means that XPATH is sent on every iteration or on
every call of List.get(int index).
You won't notice much difference for small files, but the larger the
DOM, the more dramatic difference is.
Below are my benchmarks. I ran the code snippets above against sample
sheets of different sizes.
matrix,
rows x columns getXXXArray() getXXXList()
100 x 100 35ms 70ms
1000 x 100 150ms 700ms
5000 x 100 570ms 4900ms
10000 x 100 3600ms 27000ms
I'm going to produce the release artifacts by Friday. There is no time
to fix this problem - it is a serious change and I don't want to
occasionally break anything. I'm inclined to think it is OK to release -
we did three betas and so far the feedback was positive. I plan POI-3.8
in Dec-Jan and we can defer the fix until then.
What do people think?
Regards,
Yegor
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by David Fisher <df...@jmlafferty.com>.
>> It turned out it is NOT so, getXXArray() is way faster than getXXXList(). I analyzed the auto-generated source code and found that they work differently.
>>
>> A call of getXXXArray() performs an XPATH request to the underlying DOM and returns the selected beans.
>> A call of getXXXList() does nothing. The returned List is a custom subclass of AbstractList where overridden List.get(int index) sends an XPATH request. This means that XPATH is sent on every iteration or on every call of List.get(int index).
>
> Did you have any luck finding out why the xmlbeans array method is marked as deprecated? I guess ideally we want to have the schemas generate a version with the array methods, but no deprecation warnings. (We don't want to skip the warnings, as that might mask something in future!)
I just added a comment to the issue that Maxim mentioned.
https://issues.apache.org/jira/browse/XMLBEANS-389 - List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
This is similar to the issues that Bryce mentioned before.
Regards,
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by Nick Burch <ni...@alfresco.com>.
On Tue, 12 Oct 2010, Yegor Kozlov wrote:
> It turned out it is NOT so, getXXArray() is way faster than getXXXList(). I
> analyzed the auto-generated source code and found that they work differently.
>
> A call of getXXXArray() performs an XPATH request to the underlying DOM and
> returns the selected beans.
> A call of getXXXList() does nothing. The returned List is a custom subclass
> of AbstractList where overridden List.get(int index) sends an XPATH request.
> This means that XPATH is sent on every iteration or on every call of
> List.get(int index).
Did you have any luck finding out why the xmlbeans array method is marked
as deprecated? I guess ideally we want to have the schemas generate a
version with the array methods, but no deprecation warnings. (We don't
want to skip the warnings, as that might mask something in future!)
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by Yegor Kozlov <ye...@dinom.ru>.
Thanks for the link. I see their point to keep the lists 'live', in
many cases it allows to write simper and shorter code.
In POI we are interested in maximum performance when reading documents,
so the getXXXArray() form should be preferred. I reverted the most
crucial parts of XSSF back to getXXXArray() and the time to run
ooxml-tests dropped from 110 seconds to 45 seconds on my machine.
Yegor
> Hello!
>
> 12.10.2010 18:05, Yegor Kozlov пишет:
>> Hi All,
>>
>> There are performance issues with using JDK 1.5 syntax methods in
>> ooxml-schemas-1.1.jar and my concern is whether it is a blocker for
>> POI-3.7.
>
> https://issues.apache.org/jira/browse/XMLBEANS-389
>
> best wishes, Max
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by Yegor Kozlov <ye...@dinom.ru>.
On 10/13/2010 7:40 PM, David Fisher wrote:
>>> Hi All,
>>>
>>> There are performance issues with using JDK 1.5 syntax methods in ooxml-schemas-1.1.jar and my concern is whether it is a blocker for POI-3.7.
>> https://issues.apache.org/jira/browse/XMLBEANS-389
> https://issues.apache.org/jira/browse/XMLBEANS-438
>
> Is this related? I contacted Bryce out of band, he can probably do some testing to help us look for a resolution.
>
These issues may be related on low-level. Bruce's issue is about saving
large collections in XmlBeans and my concern was about reading large
lists. They both involve manipulation of DOM and it might be the same
bottleneck.
Yegor
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by David Fisher <df...@jmlafferty.com>.
>> Hi All,
>>
>> There are performance issues with using JDK 1.5 syntax methods in ooxml-schemas-1.1.jar and my concern is whether it is a blocker for POI-3.7.
>
> https://issues.apache.org/jira/browse/XMLBEANS-389
https://issues.apache.org/jira/browse/XMLBEANS-438
Is this related? I contacted Bryce out of band, he can probably do some testing to help us look for a resolution.
Regards,
Dave
>
> best wishes, Max
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: performance issues with ooxml-schemas-1.1.jar
Posted by Maxim Valyanskiy <ma...@jet.msk.su>.
Hello!
12.10.2010 18:05, Yegor Kozlov пишет:
> Hi All,
>
> There are performance issues with using JDK 1.5 syntax methods in
> ooxml-schemas-1.1.jar and my concern is whether it is a blocker for POI-3.7.
https://issues.apache.org/jira/browse/XMLBEANS-389
best wishes, Max
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org