# HG changeset patch # User Pierre-Yves David # Date 2014-04-25 21:51:24 # Node ID 6e38b5d4997788ee7accf4ab9cd1c8f8d504db7d # Parent 1e6d2b6b37ead11aebfcf6104dc303522cb58aac revset: reduce dict lookup in lazyset.__contains__ Avoid an extra dict lookup when we have to compute the value. No visible performance impact but this shaves the yak a few extra nanometers. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2342,7 +2342,8 @@ class lazyset(object): def __contains__(self, x): c = self._cache if x not in c: - c[x] = x in self._subset and self._condition(x) + v = c[x] = x in self._subset and self._condition(x) + return v return c[x] def __iter__(self):