~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2010-08-27 18:02:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5393.
  • Revision ID: john@arbash-meinel.com-20100827180222-wdq7ac9cdai76mk4
Per Vincent's request, clean up the code comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
656
656
        # Build up the key that will be used.
657
657
        # By using <object>(void *) Pyrex will automatically handle the
658
658
        # Py_INCREF that we need.
659
 
        # TODO: We could avoid a tuple allocation and delete by using
660
 
        #       StaticTuple_New and StaticTuple_SET_ITEM, however, it is a bit
661
 
        #       clumsy, and we should be sure of the benefit first.
662
 
        #       Currently, WT.lock_read() && wt._read_dirblocks() seems to go
663
 
        #       from 3.05ms to 3.44ms for bzr.dev.
664
659
        cur_dirname = <object>p_current_dirname[0]
 
660
        # Use StaticTuple_New to pre-allocate, rather than creating a regular
 
661
        # tuple and passing it to the StaticTuple constructor.
 
662
        # path_name_file_id_key = StaticTuple(<object>p_current_dirname[0],
 
663
        #                          self.get_next_str(),
 
664
        #                          self.get_next_str(),
 
665
        #                         )
665
666
        tmp = StaticTuple_New(3)
666
667
        Py_INCREF(cur_dirname); StaticTuple_SET_ITEM(tmp, 0, cur_dirname)
667
 
        s1 = self.get_next_str()
668
 
        s2 = self.get_next_str()
669
 
        Py_INCREF(s1); StaticTuple_SET_ITEM(tmp, 1, s1)
670
 
        Py_INCREF(s2); StaticTuple_SET_ITEM(tmp, 2, s2)
 
668
        cur_basename = self.get_next_str()
 
669
        cur_file_id = self.get_next_str()
 
670
        Py_INCREF(cur_basename); StaticTuple_SET_ITEM(tmp, 1, cur_basename)
 
671
        Py_INCREF(cur_file_id); StaticTuple_SET_ITEM(tmp, 2, cur_file_id)
671
672
        path_name_file_id_key = tmp
672
 
        # path_name_file_id_key = StaticTuple(<object>p_current_dirname[0],
673
 
        #                          self.get_next_str(),
674
 
        #                          self.get_next_str(),
675
 
        #                         )
676
673
 
677
674
        # Parse all of the per-tree information. current has the information in
678
675
        # the same location as parent trees. The only difference is that 'info'
696
693
            executable_cstr = self.get_next(&cur_size)
697
694
            is_executable = (executable_cstr[0] == c'y')
698
695
            info = self.get_next_str()
 
696
            # TODO: If we want to use StaticTuple_New here we need to be pretty
 
697
            #       careful. We are relying on a bit of Pyrex
 
698
            #       automatic-conversion from 'int' to PyInt, and that doesn't
 
699
            #       play well with the StaticTuple_SET_ITEM macro.
 
700
            #       Timing doesn't (yet) show a worthwile improvement in speed
 
701
            #       versus complexity and maintainability.
699
702
            # tmp = StaticTuple_New(5)
700
703
            # Py_INCREF(minikind); StaticTuple_SET_ITEM(tmp, 0, minikind)
701
704
            # Py_INCREF(fingerprint); StaticTuple_SET_ITEM(tmp, 1, fingerprint)