Monday, 26 August 2013

import module or any component in python

import module or any component in python

during code implementation, I got suggestion we should import only
specific feature which will reduce time but I got some different result.
Am I doing some thing wrong.
python -m timeit "from subprocess import call" (suggested method which is
taking more time)
1000000 loops, best of 3: 1.01 usec per loop
python -m timeit "import subprocess"
1000000 loops, best of 3: 0.525 usec per loop

No comments:

Post a Comment