Thanks for your answer.
Well, let us be more technacal. I am using hashset for tree traversal operations over a DataBase of 10M nodes, 1Go. This HashSet collects some informations during the traversal, mainly a string at each node. Actually, my code binds JAVA with something like
import module namespace set = "java.util.HashSet";
declare function init(){set:clear(), tree_traversal($my_big_DataBase), do_some_stuff_with_hash_set()}
declare function tree_traversal($elements)
{
for $element in $elements return (
set:add(get_some_stuff_within($element) ),
tree_traversal($element/element())
)
}
and the whole traversal takes a minute.
I don't know how to achieve this with pure XQUERY. The only thing that I tried is something like :
declare function init(){let $my_hash_set := tree_traversal($my_big_DataBase, map:new()) return do_some_stuff_with($my_hash_set) }
declare function tree_traversal($elements, $hash_set) as function(*) (return a HashSet)
{
for $element in $elements return (
tree_traversal($nodes/element(), $hash_set),
map:entry( get_some_stuff_within($element),boolean)
)
}
that performed very badly, compared to the first version (JAVA binding). I explained this thinking that the first version is O(N) operations, and the second is O(N^2) operations due to in-memory copy.
>> - second : it lacks powerful libraries, as complete math modules.
> What kind of functions would you be interested in?
I guess that I could find JAVA equivalent and bind them to BaseX. Such functionalities are available directly as XQUERY modules ?
Cheers,
Jean-Marc