~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml8.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-04 02:54:10 UTC
  • mto: (4274.1.1 1.15-btree-intern)
  • mto: This revision was merged to the branch mainline in revision 4275.
  • Revision ID: john@arbash-meinel.com-20090304025410-pzr7phpvarv25jea
Use intern() instead of _get_cached_ascii for getting unique revision_ids and file_ids.

intern() puts the strings in a dict (similar to what we do), but it does so
without increasing the refcount, so intern()ed strings do not have
unlimited lifetime.
This allows us to avoid duplicate copies in memory, without having an unlimited cache.
Further, we avoid keeping a Unicode representation of the string around,
as we no longer use unicode revision_ids or file_ids in the codebase.

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
    if a_str.__class__ == unicode:
132
132
        return _encode_utf8(a_str)
133
133
    else:
134
 
        return _get_cached_ascii(a_str)
 
134
        return intern(a_str)
135
135
 
136
136
 
137
137
def _clear_cache():