Hi,

I tried similar thing using java. It is taking 86 ms for parsing.

QueryProcessor mod = new QueryProcessor("import module 'http://www.xyz.org/2008/function/ins' at 'file:/C:/avc/FUNCTION_LIBRARY.xq';'a' ", context);
long time=System.currentTimeMillis();
mod.parse();
System.out.println(" Time ::" + (System.currentTimeMillis() - time));


Output ::
Time :: 86 

Does the current overhead represent a
bottleneck in your scenario?

We have a scenario where we need to execute queries thousand times for each user, that will hamper the performance.


Thanks
Anky


On 23 January 2015 at 17:56, Christian Grün <christian.gruen@gmail.com> wrote:
> These are the benchmarking result.

Thanks. The overhead of 2-3 ms could surely be reduced once the
modules will be precompiled. Does the current overhead represent a
bottleneck in your scenario?

> I have one more doubt regarding module compilation. Are the modules compiled
> lazily ?.

Library modules are parsed every time they are imported.

C.

>
>
> On 23 January 2015 at 17:21, Christian Grün <christian.gruen@gmail.com>
> wrote:
>>
>> Hi Ankit,
>>
>> > In my queries  I am also including a module function library in each of
>> > my
>> > xqueries,
>> > so is there a way I can directly set the compiled module function
>> > library
>> > for all the QueryProcessor instance ,instead of adding library
>> > every time instance gets created.
>>
>> I guess you are using the import module statement of XQuery? That's
>> the only way to do it (but it will only be parsed once per call).
>> However, if you copy your module to the repository, you won't have to
>> specify the file path. I invite you to check out our documentation on
>> the XQuery repository [1].
>>
>> Regarding your request of compiling the module, I would be interested
>> to hear if you have already done some benchmarking in order to find
>> out how much time is spent for parsing the module?
>>
>> Best,
>> Christian
>>
>> [1] http://docs.basex.org/wiki/Repository
>>
>>
>> >
>> >
>> > Thanks
>> > Anky
>> >
>> > On 23 January 2015 at 16:13, Christian Grün <christian.gruen@gmail.com>
>> > wrote:
>> >>
>> >> Hi Ankit,
>> >>
>> >> > I was exploring BaseX for my XML based product. I was wondering
>> >> > whether
>> >> > there is Prepared Statement Like facility incorporated in BaseX,
>> >> >
>> >> > With the same QueryProcessor instance, is it possible to execute it
>> >> > multiple
>> >> > times with different binding values for given variable.
>> >>
>> >> We are working on caching precompiled XQuery expressions; for now, you
>> >> need to create new QueryProcessor instances. In practice, however,
>> >> this rarely leads to problems, because QueryProcessor instances are
>> >> very light-weight. The following BaseX call creates 100,000 instances
>> >> of the QueryProcessor, it takes around 2 seconds:
>> >>
>> >> > basex -V -r100000 "1"
>> >>
>> >> Parsing: 0.01 ms (avg)
>> >> Compiling: 0.0 ms (avg)
>> >> Evaluating: 0.0 ms (avg)
>> >> Printing: 0.01 ms (avg)
>> >> Total Time: 0.02 ms (avg)
>> >>
>> >> Obviously, the query "1" is very simple, but usually, parsing only
>> >> gets relevant if the queries to be parsed take many KBs or even MBs
>> >> (such as can be the case in RESTXQ applications).
>> >>
>> >> Best,
>> >> Christian
>> >
>> >
>
>