comparison mercurial/util.py @ 27667:37df458d60c2

util: remove outdated comment about construction overhead An old implementation of this class (possibly only in my local repo) allocated nodes in the cache during construction time, making __init__ slow for large cache capacities. The current implementation lazily grow the cache size, making this comment wrong.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 05 Jan 2016 20:52:34 -0800
parents 6cd3044985c2
children 4e27c0a70574
comparison
equal deleted inserted replaced
27666:cd2f691f20b8 27667:37df458d60c2
538 538
539 The head node is the newest entry in the cache. If the cache is full, 539 The head node is the newest entry in the cache. If the cache is full,
540 we recycle head.prev and make it the new head. Cache accesses result in 540 we recycle head.prev and make it the new head. Cache accesses result in
541 the node being moved to before the existing head and being marked as the 541 the node being moved to before the existing head and being marked as the
542 new head node. 542 new head node.
543
544 NOTE: construction of this class doesn't scale well if the cache size
545 is in the thousands. Avoid creating hundreds or thousands of instances
546 with large capacities.
547 """ 543 """
548 def __init__(self, max): 544 def __init__(self, max):
549 self._cache = {} 545 self._cache = {}
550 546
551 self._head = head = _lrucachenode() 547 self._head = head = _lrucachenode()