in reply to inline perl and recursion

I am looking to save some time when going through a large data structure, mainly I would like to have the recursive call go through c, rather than perl.

I don't know about recurion in XS (C), but you can save a little bit of time by recoding your traversal algorithm to avoid array dereferencing. Something like the following (untested):

# object1: sub depth{ my $self = shift; my $max = 0; foreach my $item ( @{$self->{child}} ) { next if ! defined ($item); my $depth = $item->depth(); $max = $depth if $depth > $max; } $self->{myDepth} = $max+1; return $max+1; }