[jira] [Commented] (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13108996#comment-13108996 ] Eric Schwarzenbach commented on XMLBEANS-389: - I for one would appreciate an answer to that last question: "Is there a reason that XMLBeans marks array features as deprecated?" It seems particularly bad that the list implementation is so weak in light of the deprecation. I've been switching over my code to use the list functions instead of the array functions, guided by that deprecation. It also seems that you cannot remove items through the list interface (maybe there's another issue on that...I'm still googling after having run into that, which lead me here). > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923952#action_12923952 ] David Fisher commented on XMLBEANS-389: --- We've encountered this trouble in Apache POI and recently reverted back to the array setters. Our concern is that these are marked as deprecated. Currently we have to do the following: {code} ./org/apache/poi/xssf/model/SharedStringsTable.java 106:@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support 114:for (CTRst st : sst.getSiArray()) { {code} Is there a reason that XMLBeans marks array features as deprecated? > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664417#action_12664417 ] Philip Aston commented on XMLBEANS-389: --- Unless I'm missing something, the List accessors aren't documented anywhere. Its probably easier to phrase it as an FAQ. > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664307#action_12664307 ] Radu Preotiuc-Pietro commented on XMLBEANS-389: --- Do you have a particular place in mind where this documentation would fit, or is it generic FAQ? > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664059#action_12664059 ] Philip Aston commented on XMLBEANS-389: --- Of course. I guess I was really expecting the list accessors to take a snapshot like the array accessor. Here's a jump start for the doc: When a schema is compiled with -javasource=1.5, java.util.List based accessors are generated as well as the array accessors. Unlike the array accessors, the returned lists are live. Changes to a List are reflected in the underlying XMLBean, and changes to the XMLBean are reflected in the List. This live behavior makes iteration over large lists inefficient. Each time an Iterator.hasNext() or Iterator.next() is called, the iterator walks over the underlying XMLBean structure. This scales poorly with as the size of the list grows, so the list accessors should only be used for small sequences. To create a non-live list efficiently, avoid the list accessors. Instead construct a new java.util.ArrayList around an array returned from an array accessor. > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663994#action_12663994 ] Radu Preotiuc-Pietro commented on XMLBEANS-389: --- The reason AbstractList.modCount cannot be used is that there could be modifications to the document coming from outside of the List implementation (unlike an ordinary ArrayList). That code can't know how many Iterators are currently opened on the same section of the document and can be affected by the change. I agree that this limitation has to be documented somewhere. > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663707#action_12663707 ] Philip Aston commented on XMLBEANS-389: --- Thanks Radu. I may be missing something for the first issue. Why can't you use the AbstactList.modCount to implement a fail fast iterator? The second issue is the killer of course. Could the iterator use an XmlCursor? If nothing can be done, I suggest the FAQ is updated to warn that the List accessors should not be used for large arrays. > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-389) List accessors generated with -javasource=1.5 produce lists that scale poorly with the size of the list
[ https://issues.apache.org/jira/browse/XMLBEANS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663525#action_12663525 ] Radu Preotiuc-Pietro commented on XMLBEANS-389: --- Thank you Philip, for the report and for the test case. I have looked at this and I don't know if we are going to be able to fix it. The problem is two-fold. One issue is that the List can change under the iterator, even without using any of the List methods, because the List is a live view to the XML document. Because of that, caching the size of the list in the iterator (I was actually considering caching it inside the List impl, so as to not have to implement Iterator) is going to cause hasNext() to stop working correctly, while it does work correctly now. Unfortunately, next() does not work correctly now and cannot be made to work correctly even if we set the iterator to be fail-fast, because like I said, we cannot capture all the changes in the List implementation code. The second issue is that next() also walks the array and so iteration will behave quadratically even if we somehow fix hasNext(). Basically, the original XMLBeans design calls for the use of XmlCursor if you want to walk over long sequences of elements and performance is important. For the cases where performance is not important or the size of the List is not big, you can use the generic List or you can get an array containing copy of the elements (non-live) if you want to isolate yourself from potential changes to the document. But the fact is that implementing an efficient List access is very difficult in the current code. > List accessors generated with -javasource=1.5 produce lists that scale poorly > with the size of the list > --- > > Key: XMLBEANS-389 > URL: https://issues.apache.org/jira/browse/XMLBEANS-389 > Project: XMLBeans > Issue Type: Bug > Components: Compiler >Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1, > Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 >Reporter: Philip Aston > Attachments: testcase.tgz > > > When a schema is compiled with -javasource=1.5, convenient list based > accessors are generated as well as the array accessors. E.g. > java.util.List getParamList() > The implementation of the List is built upon java.lang.AbstractList. The > AbstractList iterator's hasNext() method calls size(). For an XMLBean > generated list, size() walks the store and so iteration scales quadratically. > Here are some numbers showing the problem: > XMLBeans backed list of 1 strings: 0.013766 ms > XMLBeans backed list of 16 strings: 0.255458 ms > XMLBeans backed list of 256 strings: 1.612057 ms > XMLBeans backed list of 1024 strings: 25.458934 ms > XMLBeans backed list of 2048 strings: 123.393447 ms > XMLBeans backed list of 4096 strings: 505.594661 ms > plain list of 1 strings: 0.002304 ms > plain list of 16 strings: 0.007788 ms > plain list of 256 strings: 0.013384 ms > plain list of 1024 strings: 0.052215 ms > plain list of 2048 strings: 0.103550 ms > plain list of 4096 strings: 0.206648 ms > I think the generated list should override iterator(), and return an Iterator > that calculates the list size once per iteration. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org