[Python-Dev] Dictionary sparseness

Jeremy Hylton jeremy@zope.com
05 May 2003 13:11:50 -0400


On Mon, 2003-05-05 at 12:42, Alex Martelli wrote:
> On Monday 05 May 2003 05:43 pm, Skip Montanaro wrote:
> >     Jack> I was thinking of something analogous to madvise(): ...
> >
> > Quick, everyone who's used madvise() please raise your hand...  I'll bet a
> > beer most people (even on this list) have never put it to good use.  We all
> > know Tim probably has just because he's Tim, and apparently Jack has.
> 
> I used madvise extensively (and quite successfully) back when I was the
> senior software consultant responsible for the lower-levels of a variety of
> Unix-system ports of a line of mechanical CAD products.  And I loved and
> still love the general concept -- let me advise an optimizer (so it can do
> whatever -- be it a little or a lot -- rather than spend energy trying to 
> guess what in blazes I may be doing:-).

Have you seen the work on gray-box systems?

http://www.cs.wisc.edu/graybox/

The philosophy of this project seems to be "You can observe an awful lot
just by watching."  (Apologies to Yogi.)  The approach is to learn how a
particular service is implemented, e.g. what buffer-replacement
algorithm is used, by observing its behavior.  Then write an application
that exploits that knowledge to drive the system into optimized behavior
for  the application.  No madvise() necessary.

I wonder if the same can be done for dicts?  My first guess would be no,
because the sparseness is a fixed policy.

Jeremy