Re: [boost] Enhanced call_once()
by Andrew J Bromage other posts by this author
Aug 9 2002 12:13AM messages near this date
Re: [boost] Enhanced call_once()
|
Re: [boost] Enhanced call_once()
G'day all.
On Thu, Aug 08, 2002 at 02:31:34PM +0300, Peter Dimov wrote:
> The system call is important - if it prevents inlining. Most of the
> remaining overhead is caused by the memory synchronization, and there is no
> way to avoid it. Even an atomic_counter must synchronize memory in order to
> be useful.
That's true on some platforms but not on others. For example, GCC has
the "volatile asm" construct which prevents code reordering.
Also, on some architectures, all memory accesses are synchronised
(definitely IA-32, and from memory I think 32-bit SPARCs might be too,
but don't sue me if that's not true), so all it would cost is the SMP
lock. Oh, and the cost of optimisations which can't be performed due
to code reordering.
For the record, once again, I don't claim that an operation like this
would be a win everywhere. It is at worst no better and at best an
optimisation.
Cheers,
Andrew Bromage
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Andrew J Bromage
Peter Dimov
Andrew J Bromage
William E. Kempf
Andrew J Bromage
William E. Kempf
Alexander Terekhov
Pete Becker
Andrew J Bromage
Peter Dimov
Andrew J Bromage
William E. Kempf
Andrew J Bromage
William E. Kempf
Rene Rivera
William E. Kempf
Andrew J Bromage
Jason Stewart
Andrew J Bromage
Andrew J Bromage
Rob Stewart
William E. Kempf
William E. Kempf
Alexander Terekhov
Peter Dimov
Peter Dimov
Pete Becker
William E. Kempf
William E. Kempf
Pete Becker
|