Rev 2507: Using text.split() is down to 174ms in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
John Arbash Meinel
john at arbash-meinel.com
Fri May 4 23:12:16 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
------------------------------------------------------------
revno: 2507
revision-id: john at arbash-meinel.com-20070504221204-d9mjz2nl8fd5maxp
parent: john at arbash-meinel.com-20070504220621-iwla6gmrtx7iy37s
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Fri 2007-05-04 17:12:04 -0500
message:
Using text.split() is down to 174ms
We'll need some work to get the Reader version faster.
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 22:06:21 +0000
+++ b/bzrlib/compiled/dirstate_helpers.pyx 2007-05-04 22:12:04 +0000
@@ -260,7 +260,7 @@
if not PyList_CheckExact(fields):
raise TypeError('fields must be a list')
- pos = 0
+ pos = 1
field_count = len(fields)
state._dirblocks = [('', []), ('', [])]
@@ -352,15 +352,17 @@
text = state._state_file.read()
# TODO: check the crc checksums. crc_measured = zlib.crc32(text)
- reader = Reader(text)
+ # reader = Reader(text)
num_present_parents = state._num_present_parents()
entry_size = state._fields_per_entry()
- fields = reader.get_all_fields()
+ # fields = reader.get_all_fields()
+ fields = text.split('\0')
+ fields.pop()
# skip the first field which is the trailing null from the header.
- cur = 0
+ cur = 1
# Each line now has an extra '\n' field which is not used
# so we just skip over it
@@ -371,12 +373,12 @@
num_entries = state._num_entries
expected_field_count = entry_size * num_entries
field_count = len(fields)
- if field_count - cur != expected_field_count:
+ if (field_count - cur) != expected_field_count:
# this checks our adjustment, and also catches file too short.
raise AssertionError(
'field count incorrect %s != %s, entry_size=%s, '
'num_entries=%s fields=%r' % (
- field_count - cur, expected_field_count, entry_size,
+ (field_count - cur), expected_field_count, entry_size,
state._num_entries, fields))
if num_present_parents == 0:
More information about the bazaar-commits
mailing list