Detailed? What's kept beyond "a called b (arguments...)" ? That's not a lot of bytes, unless it's complete deep copies of structures.
-C. On Apr 5, 2013 9:08 PM, "Ben Tilly" <bti...@gmail.com> wrote: > On Fri, Apr 5, 2013 at 6:03 PM, Conor Walsh <c...@adverb.ly> wrote: > > On Apr 5, 2013 8:24 PM, "Uri Guttman" <u...@stemsystems.com> wrote: > > > as for your ram usage, all recursions can be unrolled into plain loops > by > > > managing your own stack. this is a classic way to save ram and sub call > > > overhead. with perl it would be a fairly trivial thing to do. use an > array > > > for the stack and each element could be a hash ref containing all the > > > data/args for that level's call. then you just loop and decide to > 'recurse' > > > or not. if you recurse you push a new hash ref onto the stack and > loop. if > > > you don't recurse you pop a value from the stack and maybe modify the > > > previous top of the stack (like doing a return early in recursion). i > leave > > > the details to you. this would save you a ton of ram and cpu for each > call > > > if you go very deep and complex. > > > > Uri, you know more perlguts than I do, so maybe this is a dumb question, > > but... why is this that much faster than actual recursion? That speaks > > poorly of lowercase-p perl. > > Do you like having detailed stack backtraces on program crashes? It > takes a lot of work to maintain that information, and you're using it > whether or not you crash. > _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm