1 May 2003 04:13
RE: Dictionary tuning
Tim Peters <tim.one <at> comcast.net>
2003-05-01 02:13:46 GMT
2003-05-01 02:13:46 GMT
[Raymond Hettinger] > ... > I worked on similar approaches last month and found them wanting. > The concept was that a 64byte cache line held 5.3 dict entries and > that probing those was much less expensive than making a random > probe into memory outside of the cache. > > The first thing I learned was that the random probes were necessary > to reduce collisions. Checking the adjacent space is like a single > step of linear chaining, it increases the number of collisions. Yes, I believe that any regularity will. > That would be fine if the cost were offset by decreased memory > access time; however, for small dicts, the whole dict is already > in cache and having more collisions degrades performance > with no compensating gain. > > The next bright idea was to have a separate lookup function for > small dicts and for larger dictionaries. I set the large dict lookup > to search adjacent entries. The good news is that an artificial > test of big dicts showed a substantial improvement (around 25%). > The bad news is that real programs were worse-off than before. You should qualify that to "some real programs", or perhaps "all real programs I've tried". On the other side, I have real programs that access large dicts in random order, so if you tossed those into your mix, a 25% gain on those would more than wipe out the 1-2% losses you saw elsewhere. > A day of investigation showed the cause. The artificial test(Continue reading)
RSS Feed