errata : * declare variable $BigDb := db:open('MyBigDataBase');

2015-01-02 21:54 GMT+01:00 jean-marc Mercier <jeanmarc.mercier@gmail.com>:
Dirk,

Hello, sorry, but a very similar behavior seems to appear also in the latest version BaseX80-20141225.174535. Here is a new code to test :

declare variable $BigDb := AppParam:DBInputOpen($ConfigDoc);
declare function local:dummy($db) {local:call(local:count_elements#1,$db)};
declare function local:count_elements($db) {count($db/descendant-or-self::element())};
declare function local:call($fun,$args) {$fun($args)};

prof:time(local:call(local:count_elements#1,$BigDb))
,prof:time(local:dummy($BigDb))

output :
3.05 ms
104170.17 ms
134666491 134666491





2015-01-02 20:05 GMT+01:00 jean-marc Mercier <jeanmarc.mercier@gmail.com>:
Hi Dirk,

You are right, I was using an old 8.0 BaseX version (seems to be the one from 23/09/2014). The problem does not appear in the latest release. Thank you !


2015-01-02 19:29 GMT+01:00 Dirk Kirsten <dk@basex.org>:
Hello Jean-Marc,

what version of BaseX did you use? I tried with the latest snapshot and used the XMark dataset (with factor 80, which produces around the same number of elements (133653910 to be exact) you had) and got the following output with an up-to-date index:

- 0.01 ms
- 0.01 ms
- 0.0 ms

If it isn't a bug in a previous version of BaseX, I would guess you reached the inline limit (http://docs.basex.org/wiki/Options#INLINELIMIT). You might want to try setting it to a higher value.

Cheers,
Dirk


On 01/02/2015 10:19 AM, jean-marc Mercier wrote:
> Hello (and happy new year 2015 !)
>
> I am facing some performance issues opening "big" databases due to an
> (unexpected for me) argument evaluation during function composition. Is
> this a normal behavior ?
>
> Cheers
>
> Here is a code description :
>
> declare variable $db := db:open("MyBigDataBase");
> declare function local:elts($db){$db//element()};
> declare function local:compose($f1 as function(*), $f2 as function(*)) as
> function(*){ function($a) { $f1($f2($a)) }};
>
> declare function local:count_elt($db) {count(local:elts($db))};
> prof:time(local:count_elt($db)),
> prof:time(count(local:elts($db))),
> prof:time(local:compose(count#1,local:elts#1) ($db))
>
> ouput :
> 3.1 ms
> 0.02 ms
> 100047.53 ms
> 134666491 134666491 134666491
>

--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22