Boost logo

Boost :

Subject: Re: [boost] [boost::endian] Request for comments/interest
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-06-03 13:26:43

----- Original Message -----
From: "Terry Golubiewski" <tjgolubi_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, June 03, 2010 5:38 PM
Subject: Re: [boost] [boost::endian] Request for comments/interest

> Tomas Puverle wrote:
>>> > Swap Based: 18 seconds
>>> > Type Based 14 seconds
>> This is unexpected...
> Swap-then-copy is less efficient than just a reverse copy (in the general
> case).
> These differences are more significant than I expected. If we allow 9
> seconds for the disk i/o and memcmp, then the overhead is approximately
> Type-based: 36% overhead (14-9)/14
> Swap-based: 50% overhead (18-9)/18.
Been a little more conservative: If we allow 6 seconds for the disk i/o and memcmp

Type-based: (14-6)=8
Swap-based: (18-6)=12.

Ii.e; Swap-based spends 50% more time than Type-based.

>> Thanks again. If there is a performance discrepancy between swap (soon to
>> be
>> endian_cast<>) and the object-based approach, I will make sure to fix it,
>> of course.
> If you implement endian_cast<> using a reverse-copy instead of swapping, you
> will see a performance improvement.

You are right. Swap should make 50% more copies as a temporary is needed. This is in line with the figures.


Boost list run by bdawes at, gregod at, cpdaniel at, john at