Chris, thanks for the input...very much appreciated. I chose NOT to
use the "modified pre-ordered WTF" approach, and instead went with a
recursive function that used reactor once to retrieve all menu items,
and then leveraged Q of Qs to perform the remaining queries. Drastic
and very acceptable differences in time this way.

I also learned (the hard way, of course) that with coldspring in
place, my controller defaults to a singleton. Caused me a little bit
of grief when I was using a variables scoped container to hold
rendered navigation...kept getting appended to itself each time i
called the function afresh.

Thanks again.

Doug Boude  :0)

On 4/14/06, Chris Blackwell <[EMAIL PROTECTED]> wrote:
> I don't think that there is a problem with your approach, its basically the 
> same way I've written recursive functions for trees.  However recursive 
> functions are notoriously slow, and instantiating reactor gateway and record 
> objects over and over is only going to compound the problem.
>
> The simple option would be to cut reactor out of the loop here, just use 
> straight queries, it will be much faster.
>
> Secondly, and this is the way I now handle trees is to drop the recursion all 
> together.  Have a look at this sitepoint article
> http://www.sitepoint.com/article/hierarchical-data-database and some of the 
> referenced material.  It describes how to implement Modified Preorder Tree 
> Traversal (and convert your old data).  Using this you can return your 
> navigation tree with one query, including the nesting level.  The 
> disadvantage is that inserting data into the table is more complex, but for a 
> navigation I'm guessing that it won't change too often.  My approach to 
> adding/deleting nodes is the same as they describe in the "Adding a node" 
> section, I keep my parent column and call a rebuildtree() function after the 
> data is altered.  It's not the most efficient, but for trees that get vastly 
> more reads, than writes it's a good option.
>
> Also take a look at Barneyb's blog, to download his treemanager cfc
> http://www.barneyb.com/blog/archives/000532.jsp  I've used this in some of my 
> reactor records that return tree data.
>
> Cheers,
> Chris
>
>
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Boude
> Sent: 14 April 2006 14:59
> To: [email protected]
> Subject: [Reactor For CF] Recursive function using reactor
>
> Hi all. I'm building an app using model glue and reactor. I'm having
> an issue with a function I wrote that returns my navigation to me,
> appropriately nested. The function is a recursive one, and works as
> designed, no problem there. BUT, it's painfully slow (18 seconds
> against a table with only 20 records), even with debugging and reactor
> regeneration disabled. SO, I'm wondering if any of you can look at how
> I've approached this and tell me if anything jumps out at you as
> obviously inefficient. Any input is greatly appreciated!
>
> Doug  :0)
>
> The specs:

Reply via email to