Hi Carl,

it would be generally possible to optimize the current implementation
of function-lookup and related reflective functions, but I think it
will take us some more time.

Instead, I rather recommend you to use function items, because these
will always give you better performance and are less error-prone (they
can be optimized much better than function calls based on string
references).

I'm not sure how your complete code looks like (and it would probably
be too complex to serve as example here), but the following code might
give you a hint how this could look like:

  let $add := function($a) { $a + $a }
  let $multiply := function($a) { $a * 2 }
  for $f in ($add, $multiply)
  return $f(2)

If you have already worked with function items... Sorry for teaching ;)

Christian



On Fri, Feb 21, 2014 at 5:06 PM, Carl Leitner <[email protected]> wrote:
> Hi,
> I noticed a significant performance degradation in the function-lookup method 
> introduced at:
>   
> https://github.com/BaseXdb/basex/commit/4aeb4bdc74d980b4c8f2e27546d21fdc1ebaeb77
>
> Where as at: b8b3dd2bee205303aeab3e8a0967b371a2ad7ef7 I have:
>> xquery import module namespace csd_bsq = 
>> "https://github.com/his-interop/openinfoman/csd_bsq"; at 
>> "/Users/litlfred/pulsar_cats/openinfoman/repo/csd_base_stored_queries.xqm"; 
>> let $r:= function-lookup(xs:QName('csd_bsq:facility_search'),2) return ()
> Query executed in 22.57 ms.
>
> At 4aeb4bdc74d980b4c8f2e27546d21fdc1ebaeb77 I have:
>>xquery import module namespace csd_bsq = 
>>"https://github.com/his-interop/openinfoman/csd_bsq"; at 
>>"/Users/litlfred/pulsar_cats/openinfoman/repo/csd_base_stored_queries.xqm";  
>>()
> Query executed in 17.48 ms.
>>xquery import module namespace csd_bsq = 
>>"https://github.com/his-interop/openinfoman/csd_bsq"; at 
>>"/Users/litlfred/pulsar_cats/openinfoman/repo/csd_base_stored_queries.xqm"; 
>>let $r:= xs:QName('csd_bsq:facility_search') return ()
> Query executed in 20.44 ms.
>>xquery import module namespace csd_bsq = 
>>"https://github.com/his-interop/openinfoman/csd_bsq"; at 
>>"/Users/litlfred/pulsar_cats/openinfoman/repo/csd_base_stored_queries.xqm"; 
>>let $r:= function-lookup(xs:QName('csd_bsq:facility_search'),2) return ()
> Query executed in 716.18 ms.
>
> Any suggestions on how to avoid this?
>
> Thanks so much.
>
> Cheers,
> -carl
>
>
>
> _______________________________________________
> BaseX-Talk mailing list
> [email protected]
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
_______________________________________________
BaseX-Talk mailing list
[email protected]
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to