lazy import for uuid module

From: Marko Kreen <markokr(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: lazy import for uuid module
Date: 2011-06-28 15:12:43
Message-ID: BANLkTi=hMPFVUEv0X-UHTgFD61HDdCJkZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

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 Content-Type Size
lazy.uuid.diff text/x-diff 3.4 KB

Responses

Browse psycopg by date

  From Date Subject
Next Message Federico Di Gregorio 2011-06-28 15:32:00 Re: lazy import for uuid module
Previous Message Federico Di Gregorio 2011-06-28 07:34:00 Re: Listing in Software Catalogue