73
75
#log.info('built revision graph cache: %r secs' % (time.time() - z,))
74
76
print 'built revision graph cache: %.3fs' % (time.time() - z,)
78
#trace.debug_memory('after computing')
76
79
return (rev_info, rev_indices)
95
98
get_parent_keys = graph.get_parent_keys
96
99
get_child_keys = graph.get_child_keys
100
# Using StaticTuple does show a memory reduction. There doesn't seem to be
101
# a time-difference wrt how long it takes to build (probably because we
102
# have gc disabled?). StaticTuple helps more when things have long
103
# lifetimes, as it prevents gc from degrading as much.
104
# Anyway, peak memory was 81.1MB down from 85.6MB. Not a huge difference,
105
# but something. Note that StaticTuple won't work directly because the
106
# caching code uses 'marshal' which requires native python objects like
107
# 'tuple' and doesn't support StaticTuple.
108
# stuple = static_tuple.StaticTuple.from_sequence
109
# st = static_tuple.StaticTuple
97
110
for seq, info in enumerate(merge_sorted):
98
111
#seq, revid, merge_depth, revno, end_of_merge = info
99
112
# Switch back from a tuple key to a simple string rev_id
100
113
rev_id = info.key[-1]
101
114
revno_str = '.'.join(map(str, info.revno))
102
parent_ids = [p[-1] for p in get_parent_keys(info.key)]
115
parent_ids = tuple([p[-1] for p in get_parent_keys(info.key)])
103
116
rev_indices[rev_id] = len(rev_info)
104
117
# TODO: StaticTuple / just use the original merge_sorted object
105
118
basic_info = (seq, rev_id, info.merge_depth, revno_str,