Rev 2498: Unrolling into a direct loop drops us to 326ms in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
John Arbash Meinel
john at arbash-meinel.com
Fri May 4 20:05:12 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
------------------------------------------------------------
revno: 2498
revision-id: john at arbash-meinel.com-20070504190500-tq5wvnhmmd30m21y
parent: john at arbash-meinel.com-20070504185936-1mjdoqmtz74xe5mg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Fri 2007-05-04 14:05:00 -0500
message:
Unrolling into a direct loop drops us to 326ms
modified:
bzrlib/compiled/dirstate_helpers.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
-------------- next part --------------
=== modified file 'bzrlib/compiled/dirstate_helpers.pyx'
--- a/bzrlib/compiled/dirstate_helpers.pyx 2007-05-04 18:59:36 +0000
+++ b/bzrlib/compiled/dirstate_helpers.pyx 2007-05-04 19:05:00 +0000
@@ -280,7 +280,26 @@
field_count - cur, expected_field_count, entry_size,
state._num_entries, fields)
- if num_present_parents == 1:
+ if num_present_parents == 0:
+ # Move the iterator to the current position
+ state._dirblocks = [('', []), ('', [])]
+ current_block = state._dirblocks[0][1]
+ current_dirname = ''
+ append_entry = current_block.append
+ pos = cur
+ while pos < field_count:
+ entry = _fields_to_entry_0_parents(fields[pos:pos+entry_size])
+ pos = pos + entry_size
+ dirname = entry[0][0]
+ if dirname != current_dirname:
+ # new block - different dirname
+ current_block = []
+ current_dirname = dirname
+ state._dirblocks.append((current_dirname, current_block))
+ append_entry = current_block.append
+ append_entry(entry)
+ state._split_root_dirblock_into_contents()
+ elif num_present_parents == 1:
# Bind external functions to local names
_int = int
# We access all fields in order, so we can just iterate over
@@ -330,14 +349,6 @@
# append the entry to the current block
append_entry(entry)
state._split_root_dirblock_into_contents()
- elif num_present_parents == 0:
- entries = []
- pos = cur
- while pos < field_count:
- PyList_Append(entries,
- _fields_to_entry_0_parents(fields[pos:pos+entry_size]))
- pos = pos + entry_size
- state._entries_to_current_state(entries)
else:
fields_to_entry = state._get_fields_to_entry()
entries = []
More information about the bazaar-commits
mailing list