[Python-Dev] String interning

Oren Tirosh oren-py-d@hishome.net
Mon, 1 Jul 2002 16:57:25 +0300


On Mon, Jul 01, 2002 at 03:19:15PM +0200, Jack Jansen wrote:
> 
> On Monday, July 1, 2002, at 08:31 , Oren Tirosh wrote:
> >   Can anyone
> > explain why Mac/Python/macimport.c is messing with ob_sinterned?
> 
> It's all explained in the comment a few lines above where ob_sinterned 
> is used:
> 	/*
> 	** If we have interning find_module takes care of interning all
> 	** sys.path components. We then keep a record of all sys.path
> 	** components for which GetFInfo has failed (usually because the
> 	** component in question is a folder), and we don't try opening these
> 	** as resource files again.
> 	*/
> 
> This code gives a considerable speedup for module searches. The reason 
> it's mac-specific is that MacPython allows files on sys.path as well as 
> directories (and these files are searched for PYC resources).

I guess the clean solution would be to add a PyString_CheckInterened macro.

	Oren