Ross Lagerwall <rosslagerw...@gmail.com> added the comment:

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?

----------
nosy: +barry, r.david.murray -orsenthil

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11454>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to