On 09/05/2012 08:20 PM, Stefan Teleman wrote:
On Wed, Sep 5, 2012 at 4:20 PM, Stefan Teleman<stefan.tele...@gmail.com> wrote:
But then there's another aspect -- which I probably failed to
highlight in my previous email: the per-object mutex implementation is
20% *slower* than the class-static mutex implementation.
I suspect the difference is due to the overhead of the repeated
initialization and destruction of the per-object mutex in the
test. The test repeatedly creates (and discards) named locale
objects.
The per-class mutex is initialized just once in the process, no
matter how many facet objects (how many distinct named locales)
the test creates. But the per-object mutex must be created (and
destroyed) for each named locale.
What the test does is pretty artificial. There aren't too many
programs that will do something like that. I wouldn't ascribe
too much importance to the timing differences.
Martin
class-static implementation:
real 2139.31
user 2406.09
sys 155.61
pe-object implementation:
real 2416.75
user 2694.64
sys 159.49
The above results are for the Intel compiler. Now here are the results
with GCC 4.7.0:
1. with the static per-class mutex:
# INFO (S1) (10 lines):
# TEXT:
# COMPILER: gcc 4.7.0, __VERSION__ = "4.7.0 20120507 (Red Hat 4.7.0-5)"
# ENVIRONMENT: pentiumpro running linux-elf (Fedora release 17 (Beefy
Miracle) (3.5.0-2.fc17.x86_64)) with glibc 2.15
# FILE: 22.locale.numpunct.mt.cpp
# COMPILED: Sep 5 2012, 06:21:18
# COMMENT: thread safety
############################################################
[ ... ]
# +-----------------------+----------+----------+----------+
# | DIAGNOSTIC | ACTIVE | TOTAL | INACTIVE |
# +-----------------------+----------+----------+----------+
# | (S1) INFO | 11 | 11 | 0% |
# | (S2) NOTE | 1 | 1 | 0% |
# | (S8) ERROR | 0 | 3 | 100% |
# | (S9) FATAL | 0 | 1 | 100% |
# +-----------------------+----------+----------+----------+
real 2165.06
user 2428.08
sys 151.30
2. With the per-object mutex:
# INFO (S1) (10 lines):
# TEXT:
# COMPILER: gcc 4.7.0, __VERSION__ = "4.7.0 20120507 (Red Hat 4.7.0-5)"
# ENVIRONMENT: pentiumpro running linux-elf (Fedora release 17 (Beefy
Miracle) (3.5.0-2.fc17.x86_64)) with glibc 2.15
# FILE: 22.locale.numpunct.mt.cpp
# COMPILED: Sep 5 2012, 21:29:56
# COMMENT: thread safety
############################################################
# CLAUSE: lib.locale.numpunct
[ ... ]
# +-----------------------+----------+----------+----------+
# | DIAGNOSTIC | ACTIVE | TOTAL | INACTIVE |
# +-----------------------+----------+----------+----------+
# | (S1) INFO | 11 | 11 | 0% |
# | (S2) NOTE | 1 | 1 | 0% |
# | (S8) ERROR | 0 | 3 | 100% |
# | (S9) FATAL | 0 | 1 | 100% |
# +-----------------------+----------+----------+----------+
real 2438.70
user 2726.44
sys 155.79
About the same percentage difference as the Intel compiler.
--Stefan
---
Stefan Teleman
KDE e.V.
stefan.tele...@gmail.com