From: Lloyd Linklater Date: 2007-07-24T04:51:07+09:00 Subject: Re: Large binary trees & stack level too deep Kenneth Kalmer wrote: > I'm writing a postfix log parser, based on the pflog2mysql library in > the RAA, but without the MySQL storage. We need to analyze mail > traffic through our various mail relays and then bill per usage. The > parsing works fine, the analysis is the tricky part, so herewith my > story. > > This raises the question, is a binary tree right for sorting such high > volumes of information? > > I plan to release the final product as FOSS, so if anyone wants a > Please refrain from giving explicit code examples, this is a personal > challenge for myself and I'm looking for guidance. Well, if a binary tree gets too large and it is being called recursively, then you really do need to make sure that you do not blow your stack. Thinking back to old school ways of handling such things, this is more of a coding approach rather than Ruby specific advice here, you might consider using databases. If you set it up so that each branch references the ways that you can go on the tree, you can then walk the tree iteratively rather than recursively. Just a thought. -- Posted via http://www.ruby-forum.com/.