[PATCH xserver 2/7] EXA: Use round robin instead of rand() for choosing eviction position.

Michel Dänzer michel at daenzer.net
Wed May 18 08:19:13 PDT 2011


On Die, 2011-05-17 at 13:08 -0400, Owen Taylor wrote:
> On Tue, 2011-05-17 at 18:32 +0200, Michel Dänzer wrote:
> > On Die, 2011-05-17 at 11:53 -0400, Owen Taylor wrote: 
> > > 
> > > If libc rand() is too slow, then some inlined linear-congruential
> > > generator could shave a few cycles.
> > 
> > I'm afraid I'm not really interested in working on that though.
> 
> Add an unsigned int evictionRand to ExaGlyphCacheRec, then when
> updating:
> 
>  cache->evictionRand = cache->evictionRand * 1103515245 + 12345;
>  cache->evictionPosition = cache->evictionRand % cache->size;
> 
> would be good enough. (Things could be done to improve the quality,
> but just doesn't matter here)

Looks like you're right; I wasn't able to measure a significant
difference with my patch or your change above anymore. Not sure what was
going on when I wrote the patch, maybe a side effect of something else. 


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list