Are you using kix 4.02? Looks like the UBOUND performance issue has been fixed 
Yes it calls it self for each subfolder, to accomplish this it uses the global variables $_i and $_temparray as a flag/place holder. one of the first thing the UDF does is check the existence of $_temparray, if is in use it sets a local UDF variable $subflag to equal 1. Since this variable is new for every recursive call the UDF does not preform the final step exits to the parent UDF and continues to build $_temparray.
The only iteration of the UDF that does not have $subflag set to equal 1 is the root UDF, so once all subfolders have been ran, the child UDF's exit, returning control to the parent UDF, stopping at the root UDF, this process is repeated for every folder in the root UDF DIR command and so on and so on.....
Once the root UDF had preformed the DIR command on the root folder, it then checks the $subflag variable, since this is the root UDF, $subflag was never set and the UDF finishes the rest of the script.
did you follow that? 
Bryce