Skip to content

Commit

Permalink
Two minor optimizations in heavily used code paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Nov 30, 2013
1 parent f5c46b5 commit 12646e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dulwich/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,8 +1182,10 @@ def get_object_at(self, offset):
and then the packfile can be asked directly for that object using this
function.
"""
if offset in self._offset_cache:
try:
return self._offset_cache[offset]
except KeyError:
pass
assert isinstance(offset, long) or isinstance(offset, int),\
'offset was %r' % offset
assert offset >= self._header_size
Expand Down
2 changes: 1 addition & 1 deletion dulwich/walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def next(self):
self._pq_set.remove(sha)
if sha in self._done:
continue
self._done.add(commit.id)
self._done.add(sha)

for parent_id in self._get_parents(commit):
self._push(parent_id)
Expand Down

0 comments on commit 12646e0

Please sign in to comment.