~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-02 22:07:54 UTC
  • mto: This revision was merged to the branch mainline in revision 5393.
  • Revision ID: john@arbash-meinel.com-20100802220754-jvtkt7dtuwon2gdk
id_index size drops to 230kB with StaticTuples.
Even better, though, is that using StaticTuple in the parser gives us
an overall benefit of about 20%. It isn't our biggest data use, but
it is something, at least.

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
    inventory,
221
221
    lock,
222
222
    osutils,
 
223
    static_tuple,
223
224
    trace,
224
225
    )
225
226
 
2166
2167
        # cause quadratic failure.
2167
2168
        # TODO: This should use StaticTuple
2168
2169
        file_id = entry_key[2]
 
2170
        entry_key = static_tuple.StaticTuple.from_sequence(entry_key)
2169
2171
        if file_id not in id_index:
2170
 
            id_index[file_id] = (entry_key,)
 
2172
            id_index[file_id] = static_tuple.StaticTuple(entry_key,)
2171
2173
        else:
2172
2174
            entry_keys = id_index[file_id]
2173
2175
            if entry_key not in entry_keys:
2180
2182
        already present.
2181
2183
        """
2182
2184
        file_id = entry_key[2]
2183
 
        entry_keys = id_index[file_id]
2184
 
        idx = entry_keys.index(entry_key)
2185
 
        id_index[file_id] = entry_keys[:idx] + entry_keys[idx+1:]
 
2185
        entry_keys = list(id_index[file_id])
 
2186
        entry_keys.remove(entry_key)
 
2187
        id_index[file_id] = static_tuple.StaticTuple.from_sequence(entry_keys)
2186
2188
 
2187
2189
    def _get_output_lines(self, lines):
2188
2190
        """Format lines for final output.