Bug 16128

Summary: optimize swap functions/speed improvement possible
Product: cairo Reporter: Arnaud Charlet <charlet>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: enhancement    
Priority: medium    
Version: 1.6.4   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: test program with various byteswap implementations

Description Arnaud Charlet 2008-05-28 01:56:43 UTC
In cairo-xlib-surface.c, it should be possible to get a 2x to 4x speed improvement
for _swap_ximage_[24]bytes by using facilities provided in <byteswap.h> (under
glibc systems), or by using recent GCC's builtin __builtin_bswap32.

Arno
Comment 1 Arnaud Charlet 2008-05-28 02:06:37 UTC
Created attachment 16783 [details]
test program with various byteswap implementations

The test program itself is too simple minded, but this attachment shows
several possible implementations of byteswapping which can be of interest.

$ gcc -O2 byteswap.c -o byteswap
$ ./byteswap 
UINT32_GCC_SWAP
time spent: 1114
cairo code
time spent: 2247
UINT32_SWAP
time spent: 2225
UINT32_GLIBC_SWAP
time spent: 747
Comment 2 Behdad Esfahbod 2008-05-28 08:32:43 UTC
commit 5de0650dbbed7a44789f25b0a5226593931a8ce8
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Wed May 28 10:43:47 2008 -0400

    [cairo-xlib] Add recently-added byteswap macros (#16128)

commit dd8f3a5690e92ac3421e5bbc475cc3e78865d8ef
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Wed May 28 10:43:22 2008 -0400

    Add support for byteswap macros bswap_16 and bswap_32

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.