When I am running this command in the OpenACS shell...
time { site_node::get_children -all -package_key curriculum -node_id _main-site-node-id_ } 10
...I get the following timings on my Athlon XP2500 / 1 GB ram:
- 10 nodes
existing proc: 1700 micro seconds/iteration
changed proc: 800 micro seconds/iteration
- 1123 nodes
existing proc: 170000 micro seconds/iteration
changed proc: 85000 micro seconds/iteration
- 2233 nodes
existing proc: 340000 micro seconds/iteration
changed proc: 180000 micro seconds/iteration
So the speed is only doubled and the gain seems to be decreasing as the number of nodes increase. This doesn't seem too worthwhile but I don't know ...
One other thing I think generally slows down "get_childern" unnecessarily (although not in this case) is the repeted foreach loop for the child urls that passed the filter when you specify a specific element to be in the returned list instead of the default url. It would be rather easy to move (or copy) that part of the code and let it exist inside the "if $passed_p" clause in the main filter loop, I think.
Also, is it intentional that "-exact" is not being used in the call to "get_children" in the last foreach, or is it by misstake? I fail to see why this call should differ from the one in the filter loop, at least.