mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
revset: cache smartset's min/max
As the content of a smartset never changes, min and max will never change either. This will save us time when this function is called multiple times. This is relevant for issue4782 but does not fix it.
This commit is contained in:
parent
52eae47139
commit
1983912bde
@ -2885,6 +2885,7 @@ class abstractsmartset(object):
|
||||
"""True if the set will iterate in descending order"""
|
||||
raise NotImplementedError()
|
||||
|
||||
@util.cachefunc
|
||||
def min(self):
|
||||
"""return the minimum element in the set"""
|
||||
if self.fastasc is not None:
|
||||
@ -2893,6 +2894,7 @@ class abstractsmartset(object):
|
||||
raise ValueError('arg is an empty sequence')
|
||||
return min(self)
|
||||
|
||||
@util.cachefunc
|
||||
def max(self):
|
||||
"""return the maximum element in the set"""
|
||||
if self.fastdesc is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user