PyDev import time is 10 times slower than using the command line

I am new to python and use PyDev with Eclipse. I noticed a painfully slow start-up time when I try to execute the code I'm working on. I narrowed it down to importing libraries.

For example, if I run the following code

import timeit
startTime = timeit.default_timer()

import numpy as np
print("loaded numpy: ", timeit.default_timer() - startTime)

import pandas as pd
print("loaded pandas: ", timeit.default_timer() - startTime)

from pandas import ExcelWriter
print("loaded sub-pandas 1: ", timeit.default_timer() - startTime)

from pandas import DataFrame
print("loaded sub-pandas 2: ", timeit.default_timer() - startTime)

import timeit
print("loaded timeit: ", timeit.default_timer() - startTime)

from sqlalchemy.sql.expression import false
print("loaded sqlalchemy: ", timeit.default_timer() - startTime)

import os
print("loaded os: ", timeit.default_timer() - startTime)

This will be the check time for PyDev as:

    loaded numpy:  6.791420515378803
    loaded pandas:  13.315319435084618
    loaded sub-pandas 1:  13.31538835744522
    loaded sub-pandas 2:  13.315418989605488
    loaded timeit:  13.315443057731413
    loaded sqlalchemy:  13.668371856921556
    loaded os:  13.668398113058927

whereas when executing the command line it will be:

loaded numpy:  1.6967744335238362
loaded pandas:  3.7941380255968165
loaded sub-pandas 1:  3.7944563812624534
loaded sub-pandas 2:  3.795081787867914
loaded timeit:  3.795144146194173
loaded sqlalchemy:  3.915562085554165
loaded os:  3.915884087905548

Can anyone help to figure this out? Even with the 4s command line option to load several standard libraries it seems redundant.

Thank!

+4
source share
1 answer

- , . py , , , .

, anaconda 3.6 . , . , .

C .

:

loaded numpy:  0.14122337554736752
loaded pandas:  0.5681306651263066
loaded sub-pandas 1:  0.568159473943701
loaded sub-pandas 2:  0.5681747900238348
loaded timeit:  0.5681882827610955
loaded sqlalchemy:  0.6529934184615654
loaded os:  0.6530225919475344
+1

Source: https://habr.com/ru/post/1683485/


All Articles