This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rosslagerwall
Recipients barry, loewis, r.david.murray, rosslagerwall
Date 2011-03-10.13:40:17
SpamBayes Score 1.4377878e-08
Marked as misclassified No
Message-id <1299764418.97.0.47378987912.issue11454@psf.upfronthosting.co.za>
In-reply-to
Content
OK, running this:
import base64
import bisect
import hashlib
import io
import os
import posixpath
import random
import re
import socket
import sys
import time
import collections

import io
import os
import socket
import collections
import warnings

import warnings
from io import StringIO, TextIOWrapper

import re
import uu
import base64
import binascii
import warnings
from io import BytesIO, StringIO

which is most of the imports that are generated when importing urllib.request takes about 0.62s.

Running this:
import email.message
import email.parser
import email
from email.feedparser import FeedParser
from email.message import Message
from email import utils
from email import errors
from email import header
from email import charset as _charset

which is the rest of the imports generated takes 0.105s.

It seems like importing the email module adds considerable time, affecting a bunch of other modules like urllib.request and http.client.

When looking at the code, it seems like a fair number of regular expressions are compiled when the email module is imported, causing the long import time. I wonder if this could be improved somehow?
History
Date User Action Args
2011-03-10 13:40:19rosslagerwallsetrecipients: + rosslagerwall, loewis, barry, r.david.murray
2011-03-10 13:40:18rosslagerwallsetmessageid: <1299764418.97.0.47378987912.issue11454@psf.upfronthosting.co.za>
2011-03-10 13:40:17rosslagerwalllinkissue11454 messages
2011-03-10 13:40:17rosslagerwallcreate