Commits

shl...@6f433eb9-a002-0410-945b-ee5462c261ee  committed 5885e30

Optimization - removed an _is_top() conditional.

  • Participants
  • Parent commits a0228f1
  • Branches experimental-optimizations-1

Comments (0)

Files changed (2)

     _curr_comps() and _current_path to _curr_path() to make them
     shorter and faster. Added a comment explaining what they are.
     - Optimization/Refactoring - optimized _calc_current_item_obj.
+    - Optimization - removed an _is_top() conditional in _recurse() that
+    was likely not to be evaluated, by re-arranging the order of _mystat
+    call. Now _mystat is not an action, but rather called explicitly.
+    _is_top() is now PODded-out because it's not used.
 
 0.1.5 - Sat Jan  3 17:17:31 IST 2009
     - Unified the two calls to stat() (and several calls to other file

File lib/File/Find/Object.pm

         $top->_calc_curr_path();
 
         $top->_fill_actions($self);
+        $top->_mystat();
 
         return 1;
     }
     return $self->_dir_stack->[-1] || $self;
 }
 
+=begin Removed
+
+# We're removing this because it's no longer used, but may be used in the
+# future.
+
 sub _is_top
 {
     my $self = shift;
     return ! exists($self->{_st});
 }
 
+=end Removed
+
+=cut
+
 sub _curr_mode {
     return shift->_top_stat->[2];
 }
         if (-e $self->_move_to_next_target())
         {
             $self->_fill_actions($self);
+            $self->_mystat();
+            $self->_stat_ret($self->_top_stat_copy());
             return 1;
         }
     }
     my @actions = qw(_handle_callback _recurse);
 
     $self->_def_actions(
-        ["_mystat", ($self->depth() ? reverse(@actions) : @actions)]
+        [($self->depth() ? reverse(@actions) : @actions)]
     );
 
     return;
     # If current is not a directory always return 0, because we may
     # be asked to traverse single-files.
 
-    if ($self->_is_top()) {
-        # Assign to _stat_ret as well, so the _stat_ret field of the top
-        # item will be set.    
-        $self->_stat_ret($self->_top_stat_copy());
-    }
-
     if ($self->_curr_not_a_dir())
     {
         return 0;