I'm having a very difficult issue to resolve. I have an XQuery file with
6325 lines that does very complex calculations / validations / etc. When
I'm running this script on an XML file of about 60MB, it takes about 2
hours to finish. I'm trying to find ways to debug this, and change the
code where necessary so it will run faster and on larger files. I
noticed that when I'm using TAILCALLS = -1 I need more than 4 MB stack
size. (I've increased it to 100MB since it's just one thread anyway)
I'm trying to find out what I can improve in the code, but I can't
understand how yet. I've used a profiler (yourkit) to see if I can get
more information, but I'm not very experienced with profilers and I
don't think any information from the profiler can help me fix the
script. Compilation takes about 16 seconds with INLINELIMIT = 0 and
MAINMEM = true, so the issue is in execution.
I'm wondering if multiple function calls that are not tail calls can
create this issue, or maybe I need to change tail calls to tail
recursion calls, and keep a TAILCALLS = 256. Some hints on how to
improve performance here would be very welcome.
p.s I realized BaseX could have a very neat feature for the GUI, to have
the option to only compile or compile + run an XQuery file. (if it
doesn't already exist)
On 12/21/2016 03:56 PM, Christian Grün wrote:
I'm curious, what value do you recommend here? I've been using it for BaseX
with -Xss4m for a long time, but I'm sure that is too much.
Hm, good question ;) I think that the Java default setting (…which
also depends on your system configuration) is usually the best
tradeoff. In our own apps, we usually rewrite our XQuery code such
that there is no need for this flag (mostly because of convenience, to
ensure that it runs out-of-the-box when changing the system). If you
don’t experience any bottlenecks with 4m that you don’t encounter with
a smaller value, it’s probably a good choice.
Thanks,
Christian