monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] using empty() instead of size()


From: Zack Weinberg
Subject: Re: [Monotone-devel] using empty() instead of size()
Date: Mon, 22 Sep 2008 14:14:25 -0700

On Mon, Sep 22, 2008 at 1:26 PM, Markus Wanner <address@hidden> wrote:
> in rev 805c482bc9bb80cd393be7d3ba01a65377d91d9c I've replaced lots of
> .size() == 0 (and similar) calls with .empty(). For one thing, I personally
> find it clearer and easier to read. And it's considered good practice
> because the implementation for most STL containers is simpler and faster.
>
> I didn't notice any improvement with the commit benchmark, but the annotate
> one from nvm.cbench showed speedups between 4% and 15%.

I'm honestly surprised .empty() and .size() == 0 don't generate
identical code, but hey.  Thanks!

zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]