Export to GitHub

pyglet - issue #367

Resource indexing too slow when running a one-file project


Posted on Nov 20, 2008 by Massive Hippo

What steps will reproduce the problem? 1. Create your program through a single file 2. Run the file at a directory with lots of directories and files

What is the expected output? What do you see instead?

Resources should not try to index every file found starting at ".", i.e, importing pyglet should be instantaneous, I would like not to wait for a 2 minutes importing to be finished.

Maybe it could be the developer responsability to start this indexing (let the developer call reindex instead of running it when the pyglet is imported).

Comment #1

Posted on Nov 22, 2008 by Massive Hippo

This patch solves the problem by avoiding the use of the current directory as search path; related docstrings were fixed as well.

Attachments

Comment #2

Posted on Nov 22, 2008 by Quick Bird

This change cannot be accepted as it breaks a release. The correct fix is either to perform the indexing lazily
or as an option to pyglet.options.

Comment #3

Posted on Nov 22, 2008 by Massive Hippo

How do you think the lazy indexing should be done? I'll fix the patch to include a "delayed_resource_loading" option meanwhile.

Comment #4

Posted on Nov 22, 2008 by Massive Hippo

Here it goes, now using delayed_resource_loading to decide if reindex is needed or not when the class is instantiated.

Attachments

Comment #5

Posted on Nov 23, 2008 by Quick Bird

I've implemented lazy indexing in r2385 (the index is created only after a resource is requested, not at import time; giving you a chance to change the path).

Status: Fixed