Linked by Thom Holwerda on Sat 28th Jun 2008 22:09 UTC, submitted by diegocg
Thread beginning with comment 320535
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
Why not cache a few larger XShm segments and parcel out pieces of them for small images? That would save a lot of the setup costs.
I wondered the same. (I have zero experience with xlib; I'm just guessing)
In general you can do one of two things:
A. Create slab cache management for Shm (within xlib; E.g. 1KB, 2KB, 8KB, 16Kb). Use lazy release for unused blocks.
B. Allocate a huge shared buffer and cut it into small random-size pieces.
(B.) has the obvious down side of concurrency that may negate any performance advantage you get by reducing the number of share memory blocks to 1.
(A.) will increase the memory footprint of your application and fragment your memory. (Especially in browsers - where image size tend to vary radically)
- Gilboa






Member since:
2006-01-02
Why not cache a few larger XShm segments and parcel out pieces of them for small images? That would save a lot of the setup costs.