Hi Tom,

Thanks for the XQuery example.

Your hint was helpful: If a function signature is not registered yet
when it is parsed, all kind of lookups are performed to locate the
function. This is e.g. the case if the function is recursive, or if
the invoked functions occurs after the currently parsed code.

I have revised the code which is responsible for locating invoked
functions: In the JavaFunction class [1], the lookup will be avoided
if we can tell in advance that no Java class will be found.

A new snapshot is online [2]; looking forward to your profiling results,
Christian

[1] 
https://github.com/BaseXdb/basex/commit/878c70fa3e1ef8ec6ab1f08b31f83e3157fc04c0#diff-2593cd6d13416ce7a77f1fba8f42a177R197
[2] http://files.basex.org/releases/latest/




> Given the following module (installed with module install foo.xqm):
>
> module namespace uc = 'http://unifits.com/common';
> declare function uc:remove-elements($input as element(), $remove-names as 
> xs:string*) as element() {
>   element {node-name($input) }
>   {$input/@*,
>     for $child in $input/node()[not(local-name() = $remove-names)]
>     return
>       if ($child instance of element())
>       then uc:remove-elements($child, $remove-names)
>       else $child
>    }
> };
>
>
> if I start BaseXGui in debug mode, and set a breakpoint in
> Reflect.forName(), every time I execute a query such as
>
> import module namespace uc = 'http://unifits.com/common';
> /
>
> the breakpoint is hit, i.e. Class.forName() is called.
> I *think* this might have to do with the fact that the function above is
> recursive, but I have to admit that I don't really grasp the code that
> does the module loading/parsing.
>
> Thanks,
> -tom

Reply via email to