Boost logo

Boost :

Subject: Re: [boost] [convert] Performance
From: Matus Chochlik (chochlik_at_[hidden])
Date: 2014-06-10 01:01:09


> str-to-int spirit: raw/cnv=1.44/1.41 seconds.
> str-to-int spirit: raw/cnv=1.44/1.41 seconds.
>
> That is, gcc-4.8 applies some magic so that that same code wrapped in a
> converter is 2% faster(!) than "raw" code. Is anyone curious and capable to
> solve the puzzle? I am admittedly the former but not the latter. :-(
>
> https://github.com/yet-another-user/boost.convert/
> blob/master/test/performance.cpp
>

IMHO this could have something to do with paging or the caching of the
strings.
You should test the two cases by two separate programs and try to run them
both in the raw then cnv and cnv then raw orders.
Or you could at least try to run

    for (int k = 0; k < 3; ++k)
        printf("str-to-int spirit: raw1/raw2=%.2f/%.2f seconds.\n",
               performance_string_to_int_spirit(strings),
               performance_string_to_int_spirit(strings));

to try it out.


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