[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] bad use of xml::init in LMI sources
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] bad use of xml::init in LMI sources |
Date: |
Thu, 27 Nov 2008 22:41:25 +0100 |
On Thu, 2008-11-27 at 00:51 +0000, Greg Chicares wrote:
> I don't suppose it affects startup time materially, but it wouldn't
> hurt to measure it.
In a simple test (adding xml::init to otherwise empty main() with just
one puts() in it, measuring time of running the app 1000 times, average
over three tries) added 0.02 ms to execution time, on x64_64 Linux with
Q6600 CPU and libxml2 2.7.2.
> Other random ideas:
> - a simple Meyers singleton that initializes itself only at first
> use?
That wouldn't be thread-safe. We could make xml::init itself safe using
locking, of course (at the cost of introducing MT code into xmlwrapp).
But that wouldn't help because libxml2 initializes itself on first use
and so we'd have to somehow guard _all_ access to libxml2 -- and we
can't.
> - a "nifty counter" as was used in the C++ standard library for cout?
I like this!
thanks,
Vaclav