Quote:
Originally Posted by Arhowk
So we switched back to Python and this time it didnt seem to get progressively longer, but it just seemed to take a generally long time. When we were using Java there was maybe 1-2 seconds between the robot code LED turning on and off and with Python there is a good 10 seconds. Any thought?
|
My expectation is about 5-10 seconds. I haven't looked too deeply into this, but I believe it's because there's a lot of wpilib .py files that all have to be loaded, regardless of whether you use them or not. Loading the HAL ctypes wrappers is a lot of annoying overhead too.
Just did this experiment:
Code:
# time python3 -c 'import wpilib'
real 0m4.450s
user 0m3.410s
sys 0m0.430s
# time python3 -c 'import hal'
real 0m2.413s
user 0m1.250s
sys 0m0.210s
I would love to see this time go down, but I suspect it would take a lot of work to do so (one idea: cythonize everything). Pull requests welcome!