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 00:09:21 +0200
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Hi,

Zack Weinberg wrote:
Sure, but C++98 requires size() to be O(1) for every container, so
there's really no excuse for a 4-15% performance difference.

Here are the results I got from this test run. It's a debian lenny machine, comparing these revisions:

 new: 805c482bc9bb80cd393be7d3ba01a65377d91d9c
 ref: d1bd931bd76507267b99e57be07125dbb2335fd5
  (which is from nvm.cvsimport-branch-reconstruction, but
   that does only change rcs_import.cc, so annotate shouldn't
   be affected at all)

                          annotate-a-ref.csv annotate-a-new.csv     p
annotate-avg-resident-MiB              30.12              23.72  0.00
    annotate-avg-size-MiB             125.68             119.28  0.00
annotate-max-resident-MiB              40.38              34.22  0.00
    annotate-max-size-MiB             136.90             130.86  0.00
     annotate-num-samples            2089.20            1982.80  0.16
     annotate-system-time               0.82               0.85  0.11
       annotate-user-time               4.35               3.49  0.00
       annotate-wall-time              10.60              10.06  0.16
                          annotate-b-ref.csv annotate-b-new.csv     p
annotate-avg-resident-MiB              17.62              11.75  0.00
    annotate-avg-size-MiB             110.95             103.95  0.00
annotate-max-resident-MiB              24.82              18.66  0.00
    annotate-max-size-MiB             121.46             115.32  0.00
     annotate-num-samples             702.60             599.80  0.17
     annotate-system-time               0.19               0.18  0.26
       annotate-user-time               0.68               0.51  0.00
       annotate-wall-time               3.59               3.05  0.16
                          annotate-c-ref.csv annotate-c-new.csv     p
annotate-avg-resident-MiB              18.42              12.45  0.00
    annotate-avg-size-MiB             111.05             104.89  0.00
annotate-max-resident-MiB              24.48              18.30  0.00
    annotate-max-size-MiB             121.06             114.96  0.00
     annotate-num-samples             778.40             712.40  0.05
     annotate-system-time               0.25               0.24  0.67
       annotate-user-time               0.95               0.74  0.00
       annotate-wall-time               3.95               3.63  0.06
                          annotate-d-ref.csv annotate-d-new.csv     p
annotate-avg-resident-MiB              34.34              28.24  0.00
    annotate-avg-size-MiB             130.00             124.07  0.00
annotate-max-resident-MiB              42.30              35.93  0.00
    annotate-max-size-MiB             138.82             132.57  0.00
     annotate-num-samples            3443.20            3213.50  0.00
     annotate-system-time               1.02               1.02  0.84
       annotate-user-time               8.85               7.82  0.00
       annotate-wall-time              17.48              16.29  0.00


This leads me to think that the STL implementation doesn't provide an O(1) implementation for size()... savings is avg memory consumption seems to confirm this, no?

Other explanations?

Regards

Markus Wanner





reply via email to

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