Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-24 11:09:39


> This approach - as shown - does have a drawback. If you have an array of
> 802511 32 bit lsb integers in the file, and the native int is 32 bit lsb,
> one read of 802511*4 bytes is vastly superior in performance to a loop
> that would read 4 bytes and call read_32_lsb on the byte[4]. Which is why
> the above is generally combined with
>
> void read_32_lsb_n( int * first, int * last, FILE * fp );

It occurs to me that the library could benefit from similar additions to
little_to_native et al, which are currently scalar-only and would,
therefore, depend on a Sufficiently Smart(tm) compiler to optimize out the
empty calls.

Batch endianness fixups are very common and very performance sensitive.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk