Author serhiy.storchaka
Recipients brett.cannon, eric.smith, eric.snow, ncoghlan, pitrou, serhiy.storchaka
Date 2014-10-05.14:26:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <3302796.27zqVUnYJV@raxxla>
In-reply-to <>
I'm not experienced in import machinery. Here is preliminary patch which 
implements my idea for particular case.

Performance effect is almost so good as manual caching in a global.

>>> import timeit
>>> def f():
...      import locale
>>> min(timeit.repeat(f, number=100000, repeat=10))

Of course it breaks tests.

> It's possible there is room for other optimisations that don't break the
> import override semantics (such as a fast path for when __import__ is the
> standard import function).

Good idea.
File name Uploaded
faster_import.patch serhiy.storchaka, 2014-10-05.14:26:33
Date User Action Args
2014-10-05 14:26:34serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, ncoghlan, pitrou, eric.smith, eric.snow
2014-10-05 14:26:34serhiy.storchakalinkissue22557 messages
2014-10-05 14:26:34serhiy.storchakacreate