[PATCH 1 of 2] revlog: add __contains__ for fast membership test
Yuya Nishihara
yuya at tcha.org
Thu Feb 5 06:03:40 CST 2015
On Wed, 04 Feb 2015 16:21:05 +0000, Pierre-Yves David wrote:
> On 02/04/2015 01:27 PM, Yuya Nishihara wrote:
> > + def __contains__(self, rev):
> > + """filtered version of revlog.__contains__"""
> > + return (revlog.revlog.__contains__(self, rev)
> > + and rev not in self.filteredrevs)
>
> I think there is some magical optimisation to do here, like hard coding
> the __contains__ content and maybe test for the existence of any
> filtered revision before checking for members
I thought about it, but I didn't. There's no hot loop calling __contains__,
so I can't say it has benefit now.
Regards,
More information about the Mercurial-devel
mailing list