简体   繁体   中英

Why does my code run faster in Eclipse console than in Eclipse's PyDev Python Console?

Can anyone help me understand why the PyDev Console in Eclipse is slower than the Eclipse console?

Example:

I run the following code in the PyDev console:

import time
start = time.time()
a = range(100000)
b = []
for i in a:
    b.append(i*2)
end = time.time()
print(end - start)

PyDev的

The same code running in the Eclipse console:

日食

There is quite a big difference in the time needed to run the code. Why is that?

Eclipse console is an overlay to pure system terminal and doesn't contain Java overhead for parsing a Python Console output. Try to do something similar after going to python interactive mode in system terminal (simply type python -> Enter). Probably you will see time somewhere in between your Console and PyDev Console time. Generally, your code will run in a terminal alike environment so don't bother that your PyDev Console is slow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM