-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python execution takes too much time on new BBB image #245
Comments
thanks for opening this issue. i will investigate what causes the latency and followup with you. |
I can reproduce the delay that you are seeing:
I will investigate further |
Great news!!! Hopefully you can figure out what is wrong out there... Is there any way to flash to these BBB the image Debian 7.9 LXDE 2015-11-12 which is the "previously" image I quoted ?? Recently I bought a BBB on which I can not flash that image, and because of this is why I'm with the trouble of the delay. I tried to flash it using two SD cards (8GB and 32GB), and it failed. The BBB tries to start flashing but got stuck in some part because all the 4 leds remain on all the time and never turn off. In fact, the blinking process 1...2...3...4...3...2...1 never happens at all. |
I'm looking at the output of strace: I don't see anything obvious. The main activity that I see is Python searching for dependencies in the file system. For example:
I'm not quite sure what optimizations are possible as this all seems like normal activity. |
@caladfelipe How are you trying to flash the image? I would suggest that you download and install Etcher per the Getting Started guide: |
I already tried Etcher to flash the image to the SD cards, edit uEnv.txt to uncomment the init flasher script, and finally insert the SD into the BBB to turn it on and get the image flashed on the device, but it didn't work. Occurs what I just told you:
|
@RobertCNelson any suggestions for @caladfelipe? He wants to flash "Debian 7.9 LXDE 2015-11-12" onto the eMMC |
@caladfelipe that old 7.9 image uses a 3.8.13 kernel, there are a couple reasons why it would fail. It's best to plug in a usb-serial adapter into j1 to find out why it's stopping... Regards, |
@RobertCNelson so I need to buy the usb-serial adapter. ¿Can you tell me please which of following cables allow me to connect to the BBB? https://www.adafruit.com/product/70 or https://www.amazon.com/Converter-Terminated-Galileo-BeagleBone-Minnowboard/dp/B06ZYPLFNB/ref=sr_1_1_sspa. |
@caladfelipe both those linked cables should work ok at they are 3.3V logic which is what the BeagleBone uses. I do personally use that Adafruit cable with my BeagleBone. |
@caladfelipe is this still an issue? thanks |
@pdp7 Yes, still having the same problem... :( What else do you suggest me to do? Did you figure out something I can do to speed up python execution? |
@caladfelipe I'll run some benchmarks on the current Debian 9.x image and try to determine where that delay happens. Have you tried using Python 3.x instead of Python 2.7? |
@pdp7 yes, the delay happens on both python versions |
@RobertCNelson Any thoughts on the best way to investigate this issue? |
@caladfelipe I have found on
Please download the latest Debian Stretch image: bone-debian-9.5-iot-armhf-2018-08-23-4gb.img.xz and test if Python is still slow. |
@caladfelipe any feedback? |
@pdp7 let me run some tests with it. Once I have some results I would let you know - Hope to tell you good news! :) |
@pdp7 just downloaded the image of the link, but it appears to be different than the one you mentioned. Even with the difference, I flashed the image on the BBB, but sadly the slowness still happening on python3.
|
@caladfelipe Are you saying the delay is 1 second?
stop:
|
@caladfelipe I notice that there is a 0.986 second difference. Is that too much of a delay for your use case? Python 2:
Duration: 0.539298607 Python 3:
Duration: 1.524880141 |
@pdp7 the fact is that the real code I need to run has to import some packages, and the time spent during only the import takes too much time. The following code includes all the imports I have to make on my code: `import time print('Hello') import logging from daemons.prefab import step print('World') When you execute that code on a BBB, using the image you provided me, these are the results:
It spends 3 seconds just in the import phase, which is a lot. If I run the same code in my laptop, it takes at most 1 second. |
@caladfelipe thanks for the update @RobertCNelson any suggestions on how I can troubleshoot the increased latency to execute Python 3 code? thanks! |
Couple Suggestions: limit the number of imports Regards, |
Thank you all the help! You're right @RobertCNelson , I can not compare it against a normal laptop... |
Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): Beaglebone Black Rev C, with image Debian 9.3 IoT 2018-03-05
Python version (run
python -version
orpython3 -version
): (python) Python 2.7.13 or (python3) Python 3.5.3List the steps to reproduce the problem below (if possible attach code or commands
to run):
I've updated the image of my BBB (previously used builtin image Debian 7.9 LXDE 2015-11-12) to Debian 9.3 IoT 2018-03-05, and I don't know why the execution of every python script take about 2 seconds to start running. I executed the following command:
date; python test.py; date
where test.py is:And the output is:
As you can see, it takes nearly 2 seconds to really execute the python code, situation which doesn't occur on the builtin image Debian 7.9. On that image executing python is nearly realtime, with no delays at all. I tried to optimize my scripts by a lot of ways but nothing seems to work.
Please help me to understand what is the issue on that image (it also happens on Debian 9.3 LXQT
2018-01-28) or what am I doing bad.
Useful information:
cat /etc/dogcat
: BeagleBoard.org Debian Image 2018-03-05cat /etc/debian_version
: 9.3lscpu
:sudo /opt/scripts/tools/version.sh
:sudo python -c "import Adafruit_BBIO; print Adafruit_BBIO"
: <module 'Adafruit_BBIO' from '/usr/local/lib/python2.7/dist-packages/Adafruit_BBIO-1.0.10-py2.7-linux-armv7l.egg/Adafruit_BBIO/init.py'>sudo pip install --upgrade Adafruit_BBIO
: Requirement already up-to-date: Adafruit_BBIO in /usr/local/lib/python2.7/dist-packages/Adafruit_BBIO-1.0.10-py2.7-linux-armv7l.eggstrace -f -o strace.log python test.py
: ('time to complete 100 sets = ', 0.06898188591003418)The text was updated successfully, but these errors were encountered: