Thread: lazy import for uuid module

lazy import for uuid module

From
Marko Kreen
Date:
Attached patch moves uuid import from inside try-except
to register_uuid function.  Reason: uuid module import is *very*
heavy.  It goes into OS searching for various .dll/.so libraries,
lauches 'ldconfig' and so on...

With this patch, 200x python -c 'import psycopg2.extras'
goes from 22s to 7s.  (plain 'import psycopg2' is 6s)

--
marko

Attachment

Re: lazy import for uuid module

From
Federico Di Gregorio
Date:
On 28/06/11 17:12, Marko Kreen wrote:
> With this patch, 200x python -c 'import psycopg2.extras'
> goes from 22s to 7s.  (plain 'import psycopg2' is 6s)

Applied to devel branch, will be in 2.4.3. Thank you very much.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
Studio Associato Di Nunzio e Di Gregorio                  http://dndg.it
                             Best friends are often failed lovers. -- Me