function parse-xml() very slow in embedded mode
Wednesday, 19 February 2014 · 3 messages
JM
Johan Mörén19 Feb 2014 10:26 #
Hi
I'm using BaseX in embedded mode (no database) and need to transform an xml payload that contains elements containing string-encoded xml in this form
...
<str><objectInstance fetchDate="2014-02-14T13:00:53.374+01:00">
<createdDateTime>2012-12-04T08:55:26.195Z</createdDateTime>
</objectInstance></str>
...I have both tried using xquery update (copy, modify) and with a simple identity-transform function that intercepts the <str/> element and replaces it with the results of parse-xml(.)
When executing the query in BasexGUI both solutions performs very well. However if i invoke it via the QueryProcessor in my java-process it is 50 to 100 times slower.
Any clues to what i might be missing?
Regards,
Johan Mörén
JM
Johan Mörén19 Feb 2014 12:30 #
Setting this option in the query proved useful
declare option db:intparse "yes";Halved the query time in the GUI and provided the same result and performance in embedded mode with the QueryProcessor.
/Johan
On Wed, Feb 19, 2014 at 10:26 AM, Johan Mörén <hutchkintoot at gmail.com>wrote:
Quoted text · Johan Mörén · 29 lines
> Hi > > I'm using BaseX in embedded mode (no database) and need to transform an > xml payload that contains elements containing string-encoded xml in this > form > > ... > <str><objectInstance fetchDate="2014-02-14T13:00:53.374+01:00"> > > <createdDateTime>2012-12-04T08:55:26.195Z</createdDateTime> > </objectInstance></str> > ... > > I have both tried using xquery update (copy, modify) and with a simple > identity-transform function that intercepts the <str/> element and replaces > it with the results of parse-xml(.) > > When executing the query in BasexGUI both solutions performs very well. > However if i invoke it via the QueryProcessor in my java-process it is 50 > to 100 times slower. > > Any clues to what i might be missing? > > Regards, > Johan Mörén > > > >
CG
Christian Grün19 Feb 2014 18:42 #
Hi Johan,
thanks for the feedback. It's true that the default Java XML parser (which is used as default since 7.8) is slower than the built-in one, so setting the option, as you did, is a good way out. - Do you know get the expected performance?
Christian
Quoted text · Johan Mörén · 50 lines
> Setting this option in the query proved useful > > declare option db:intparse "yes"; > > Halved the query time in the GUI and provided the same result and > performance in embedded mode with the QueryProcessor. > > /Johan > > > > > On Wed, Feb 19, 2014 at 10:26 AM, Johan Mörén <hutchkintoot at gmail.com> > wrote: >> >> Hi >> >> I'm using BaseX in embedded mode (no database) and need to transform an >> xml payload that contains elements containing string-encoded xml in this >> form >> >> ... >> <str><objectInstance fetchDate="2014-02-14T13:00:53.374+01:00"> >> >> <createdDateTime>2012-12-04T08:55:26.195Z</createdDateTime> >> </objectInstance></str> >> ... >> >> I have both tried using xquery update (copy, modify) and with a simple >> identity-transform function that intercepts the <str/> element and replaces >> it with the results of parse-xml(.) >> >> When executing the query in BasexGUI both solutions performs very well. >> However if i invoke it via the QueryProcessor in my java-process it is 50 to >> 100 times slower. >> >> Any clues to what i might be missing? >> >> Regards, >> Johan Mörén >> >> >> > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery