On 09/06/12 22:58, Stefan Teleman wrote:
On Thu, Sep 6, 2012 at 7:31 PM, Liviu Nicoara <[email protected]> wrote:
There would be a performance degradation. IMHO, it would be minor and would
simplify the code considerably.
After finally being able to reproduce the defect with SunPro 12.3 on x86_64 I
tried to remove the lazy initialization and a (smaller) test case now passes. I
am attaching the program and the numpunct patch.
With your patches, the performance is much much better:
I didn't think about timing it, thanks! The result is somewhat expected without
the synchronization. However, the full construction-time initialization is
inappropriate if you take in consideration the delegation from the public API
to the protected virtual API of the facet class, and the possibility of
overrides in subclasses. Also, lazy initialization follows the principle of
economy of effort, and caching increases efficiency. If possible in a robust
way, I would rather have those two. :-)
Liviu
# INFO (S1) (10 lines):
# TEXT:
# COMPILER: Intel C++, __INTEL_COMPILER = 1210,
__INTEL_COMPILER_BUILD_DATE = 20111011, __EDG_VERSION__ = 403
# 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 6 2012, 20:50:13
# 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 1035.05
user 1191.76
sys 63.49
--Stefan
--
And now I see with eye serene
The very pulse of the machine.