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: Markus Wanner
Subject: Re: [Monotone-devel] using empty() instead of size()
Date: Tue, 23 Sep 2008 18:16:35 +0200
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Hi,

Derek Scherger wrote:
> Even if size does have to traverse a list to count the elements one 
> would expect that traversing an *empty* list should be reasonably quick.

Yeah, but it the list is large, traversing is rather expensive, compared
to aborting and returning false upon seeing the first element, as
empty() can do.

It's the difference between wanting to know the exact size or just being
interested if there are some elements or not.

> All the same, empty() does seem a bit easier on the eyes

Yeah, I also like empty() better.

> and if it wins on performance too then what the heck.

For what it's worth, I suspected the slightly increased binary
size and additional link time required for the nvm.cbr branch's binary
and rerun the benchmark again just exactly the revision before:

  new: 805c482bc9bb80cd393be7d3ba01a65377d91d9c
  ref: 639a3179473e718e8b01b9c99232fa1f81ca7f61

This time I took special care to shut down other services on the machine
so that the benchmark should really be the absolutely only load.

With enough test runs I cannot really confirm the speed gain. See the
three results below. I don't think it's really the nvm.cbr branch, as
the executable didn't grow significantly. It would at least really
surprise me.

I rather think it's not such a good benchmark, because it varies quite a
lot and it seems to measure a lot of disc i/o due to the drop_caches.
I'm not sure we really want to exclude that from our benchmarks, because
normally you run operations such as annotate with quite well populated
caches.

Anyway, sorry for the noise. I've just dropped the comment from NEWS.

Regards

Markus Wanner



>                           annotate-a-ref.csv annotate-a-new.csv     p
> annotate-avg-resident-MiB              23.53              23.49  0.70
>     annotate-avg-size-MiB             118.68             118.62  0.84
> annotate-max-resident-MiB              34.20              34.17  0.00
>     annotate-max-size-MiB             130.86             130.86   nan
>      annotate-num-samples            1753.60            1757.40  0.87
>      annotate-system-time               0.86               0.87  0.67
>        annotate-user-time               3.49               3.50  0.62
>        annotate-wall-time               9.18               9.11  0.27
>                           annotate-b-ref.csv annotate-b-new.csv     p
> annotate-avg-resident-MiB              11.89              11.68  0.44
>     annotate-avg-size-MiB             103.59             103.74  0.75
> annotate-max-resident-MiB              18.63              18.61  0.00
>     annotate-max-size-MiB             115.32             115.32   nan
>      annotate-num-samples             602.20             540.10  0.33
>      annotate-system-time               0.18               0.18  0.70
>        annotate-user-time               0.51               0.52  0.40
>        annotate-wall-time               3.24               2.87  0.26
>                           annotate-c-ref.csv annotate-c-new.csv     p
> annotate-avg-resident-MiB              11.83              11.35  0.31
>     annotate-avg-size-MiB             103.50             102.42  0.41
> annotate-max-resident-MiB              18.28              18.26  0.00
>     annotate-max-size-MiB             114.93             114.93   nan
>      annotate-num-samples             590.60             676.10  0.26
>      annotate-system-time               0.24               0.27  0.12
>        annotate-user-time               0.75               0.75  0.77
>        annotate-wall-time               3.19               3.66  0.21
>                           annotate-d-ref.csv annotate-d-new.csv     p
> annotate-avg-resident-MiB              27.30              26.69  0.18
>     annotate-avg-size-MiB             123.26             122.28  0.18
> annotate-max-resident-MiB              36.11              36.08  0.00
>     annotate-max-size-MiB             132.78             132.78   nan
>      annotate-num-samples            2699.90            2719.70  0.80
>      annotate-system-time               1.07               1.04  0.32
>        annotate-user-time               7.85               7.89  0.33
>        annotate-wall-time              13.87              14.22  0.36
> 
> 
> 
>                           annotate-a-ref.csv annotate-a-new.csv     p
> annotate-avg-resident-MiB              23.42              23.43  0.99
>     annotate-avg-size-MiB             118.53             118.56  0.93
> annotate-max-resident-MiB              34.19              34.17  0.00
>     annotate-max-size-MiB             130.86             130.86   nan
>      annotate-num-samples            1708.50            1741.50  0.37
>      annotate-system-time               0.88               0.85  0.23
>        annotate-user-time               3.48               3.50  0.34
>        annotate-wall-time               9.11               9.16  0.63
>                           annotate-b-ref.csv annotate-b-new.csv     p
> annotate-avg-resident-MiB              11.54              11.67  0.41
>     annotate-avg-size-MiB             101.81             103.59  0.17
> annotate-max-resident-MiB              18.63              18.61  0.00
>     annotate-max-size-MiB             115.32             115.32   nan
>      annotate-num-samples             570.40             566.40  0.83
>      annotate-system-time               0.18               0.19  0.53
>        annotate-user-time               0.52               0.51  0.48
>        annotate-wall-time               3.04               3.02  0.77
>                           annotate-c-ref.csv annotate-c-new.csv     p
> annotate-avg-resident-MiB              12.03              12.20  0.21
>     annotate-avg-size-MiB             104.18             105.06  0.37
> annotate-max-resident-MiB              18.28              18.26  0.00
>     annotate-max-size-MiB             114.93             114.93   nan
>      annotate-num-samples             679.40             602.40  0.28
>      annotate-system-time               0.22               0.26  0.01
>        annotate-user-time               0.76               0.77  0.92
>        annotate-wall-time               3.58               3.22  0.32
>                           annotate-d-ref.csv annotate-d-new.csv     p
> annotate-avg-resident-MiB              27.22              27.25  0.65
>     annotate-avg-size-MiB             122.85             123.24  0.08
> annotate-max-resident-MiB              36.11              36.08  0.00
>     annotate-max-size-MiB             132.78             132.78   nan
>      annotate-num-samples            2674.90            2695.60  0.63
>      annotate-system-time               1.07               1.08  0.79
>        annotate-user-time               7.83               7.85  0.55
>        annotate-wall-time              13.86              13.88  0.86
> 
> 
> 
> 
>                           annotate-a-ref.csv annotate-a-new.csv     p
> annotate-avg-resident-MiB              23.45              22.90  0.31
>     annotate-avg-size-MiB             118.90             117.10  0.31
> annotate-max-resident-MiB              34.19              34.17  0.00
>     annotate-max-size-MiB             130.86             130.86   nan
>      annotate-num-samples            1781.10            1795.00  0.78
>      annotate-system-time               0.86               0.88  0.50
>        annotate-user-time               3.51               3.49  0.49
>        annotate-wall-time               9.17               9.41  0.36
>                           annotate-b-ref.csv annotate-b-new.csv     p
> annotate-avg-resident-MiB              11.28              11.61  0.44
>     annotate-avg-size-MiB             102.36             103.80  0.31
> annotate-max-resident-MiB              18.63              18.60  0.00
>     annotate-max-size-MiB             115.32             115.32   nan
>      annotate-num-samples             588.60             552.80  0.62
>      annotate-system-time               0.18               0.19  0.98
>        annotate-user-time               0.51               0.51  0.88
>        annotate-wall-time               3.17               2.97  0.58
>                           annotate-c-ref.csv annotate-c-new.csv     p
> annotate-avg-resident-MiB              11.74              11.68  0.71
>     annotate-avg-size-MiB             103.83             103.33  0.53
> annotate-max-resident-MiB              18.28              18.26  0.00
>     annotate-max-size-MiB             114.93             114.93   nan
>      annotate-num-samples             608.60             588.40  0.40
>      annotate-system-time               0.28               0.25  0.04
>        annotate-user-time               0.72               0.76  0.05
>        annotate-wall-time               3.28               3.24  0.70
>                           annotate-d-ref.csv annotate-d-new.csv     p
> annotate-avg-resident-MiB              27.23              26.97  0.36
>     annotate-avg-size-MiB             123.17             122.94  0.48
> annotate-max-resident-MiB              36.12              36.09  0.00
>     annotate-max-size-MiB             132.78             132.78   nan
>      annotate-num-samples            2705.70            2786.20  0.53
>      annotate-system-time               1.08               1.07  0.81
>        annotate-user-time               7.82               7.88  0.22
>        annotate-wall-time              13.98              14.52  0.36




reply via email to

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