This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use saturated arithmetic for overflow detection.


On Wed, Oct 30, 2013 at 12:26:04PM -0700, Paul Eggert wrote:
> On 10/30/2013 12:14 PM, OndÅej BÃlka wrote:
> > These jumps can be predicted almost perfectly as overflows do not happen. 
> > Here factors like that original comparison needs to load a large
> > constant in register start play role in evaluation.
> 
> All true.  Perhaps a benchmark would help clarify this?
> (We can easily measure code bloat, anyway.  :-)

I wrote and attached quick benchmark for v2 of patch.
When code is hot a assembly looks fastest but it migth be that 
gcc missoptimized loop.

$ time ./assembly

real	0m5.129s
user	0m5.130s
sys	0m0.000s

$ time ./generic

real	0m7.625s
user	0m7.628s
sys	0m0.000s

$ time ./current

real	0m5.961s
user	0m5.964s
sys	0m0.000s

when I use two multiplications in assembly it becomes

real	0m6.916s
user	0m6.919s
sys	0m0.000s

Attachment: assembly.c
Description: Text document

Attachment: generic.c
Description: Text document

Attachment: current.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]