Go to advanced search

by SlowBro
Sat Oct 21, 2017 3:57 am
Forum: Advanced users
Topic: Speed up Raspbian boot
Replies: 10
Views: 11750

Re: Speed up Raspbian boot

I don’t have a lot of direct answers to your questions but I’ve looked into boot optimization as well. One thing I noticed is your boot time seems much longer than mine, and I’m on stretch lite as well. Do you need Samba? Out of the box on my B+ it’s about 30 seconds to boot. I do have a very fast s...
by SlowBro
Sat Oct 21, 2017 3:32 am
Forum: Advanced users
Topic: [SOLVED] Can I setup an AP with SSL without Internet access?
Replies: 6
Views: 2202

[SOLVED] Can I setup an AP with SSL without Internet access?

Can I somehow use SSL (without warnings) if my device is not connected to the internet? I’m developing an IoT device around the Pi and I want the initial setup experience to be done via a phone browser. The device gets plugged in, my device goes into WPA2 AP mode with a DHCP server and DNS capture t...
by SlowBro
Thu Oct 19, 2017 1:05 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

No, it's consistently about 7 seconds to load no matter how many times I refresh.
by SlowBro
Wed Oct 18, 2017 2:38 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

How long does the admin home page take for subsequent loads (after the first time after the server has started)? Don't have my Pi in front of me right now, but if I recall reloading the page shaved off about two seconds, so from seven to five. So maybe I ought to import my home page (and sub-pages)...
by SlowBro
Wed Oct 18, 2017 12:56 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

By switching to a pure http.server and refactoring some code in the background (switched to pigpio for one) the device admin home page loads in about seven seconds under Py 3.5, which is about half the time from before. I'm going to test it under PyPy and 2.7 but this is looking good.
by SlowBro
Wed Oct 18, 2017 11:32 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Rpi.GPIO is even faster than pigpio.

Code: Select all

[email protected]:~# time python2.7 test_pigpio.py

real    0m0.601s
user    0m0.420s
sys     0m0.080s
[email protected]:~# time python2.7 test_rpi.gpio.py

real    0m0.345s
user    0m0.240s
sys     0m0.040s
[email protected]:~#
by SlowBro
Wed Oct 18, 2017 11:02 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

For amusement I counted the machine instructions needed to execute a trivial Python program a = 1 b = 1 c = a + b My time results for your test. 2.7 wins by far. PyPy is the slowest. [email protected]:~# time python2.7 jahboater_test.py real 0m0.351s user 0m0.220s sys 0m0.070s [email protected]:~# ti...
by SlowBro
Wed Oct 18, 2017 10:56 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

I'm not convinced that your search for a brand of python that is a bit quicker to start will be anywhere near as productive as finding a way for python to stay running. (..) At this stage I think I would concentrate on the server end and do the python tuning later. That's sound advice. I think what...
by SlowBro
Wed Oct 18, 2017 10:31 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

I don't remember gpiozero taking that long to just setup it led module part. It is however designed to make life easy. If it is, bypass it and move to just pigpio direct commands. Post the code so others can see (or help speed it up) You are correct, gpiozero is the pig. I'm going to switch. And ag...
by SlowBro
Wed Oct 18, 2017 10:23 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

8-9 seconds seems a ridiculously long time to turn on and off a couple of led's. Yeah, I thought so as well. Here's some stripped-bare code. LOL Cython is actually the slowest. Leads me to conclude that the solution will be a combination of interpreters. [email protected]:~# cat test_gpiozero.py fro...
by SlowBro
Wed Oct 18, 2017 1:33 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

OK so when running some more complex code the 3.5 interpreter is only 15% slower. This code uses gpiozero which itself takes about 8 seconds to start. Now I will try PyPy and Cython. Each test was run twice to allow for caching. 2.7 interpreter: [email protected]:/SB# time tests/test_leds.py Starting...
by SlowBro
Wed Oct 18, 2017 12:33 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

You are compiling your test program with cython but then go on to time Python running the original script, at no point are you timing the running of the compiled version Ahh my mistake, I forgot I also had renamed the source .py, will try it as you said. Same difference. [email protected]:~# time ./...
by SlowBro
Tue Oct 17, 2017 8:12 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

I'm not using http.server; I would use lighttpd but even on the command line (no web server involved) it's a dog.

The CGI app I'm building is mostly for managing the Wi-Fi config, the service account, and reviewing error logs.
by SlowBro
Tue Oct 17, 2017 6:10 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

bensimmo wrote:
Tue Oct 17, 2017 5:50 pm
It seems a bit silly to have everything load on demand if you call it all the time and it has to re-setup and not just sit there idle waiting for the next python code to run.
Use the memory and gain time.
I can't think how to do that. Examples would be wonderful.
by SlowBro
Tue Oct 17, 2017 6:09 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Yes, Python3 startup time is worse than Python2. Deal with it. You're getting new features. Not on other environments. When running in Cygwin the situation is completely backwards; 3.6 is faster than 2.7. Per the initial testing it's 3x slower on Pi -- but that may be a fault with the way I am test...
by SlowBro
Tue Oct 17, 2017 6:07 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

jahboater wrote:
Tue Oct 17, 2017 5:07 pm
Just running it twice should preload much of the stuff - it will remain in the disk cache.
Not in my experience. Just as slow the first and subsequent runs.
by SlowBro
Tue Oct 17, 2017 5:59 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Would anyone be so kind as to post their real world stats? time for various scripts when run on both 2.7 and 3.5.
by SlowBro
Tue Oct 17, 2017 4:44 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Is it possible to preload the environment etc. And just test the code itself. Of course that would depend on how you'll be using it, if the setup is actually a problem. Can you give an example? The web app I'm building is mostly for managing the Wi-Fi config, the service account, and reviewing erro...
by SlowBro
Tue Oct 17, 2017 3:14 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

I'm curious to know what your program is doing that runs so much slower on python 3.5 It's several CGI scripts but it's also very slow on the command line, not even in the web server yet. Before I sought to profile and optimize it I thought I should try a simple pass command and lo, it too is far s...
by SlowBro
Tue Oct 17, 2017 3:08 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

You are compiling your test program with cython but then go on to time Python running the original script, at no point are you timing the running of the compiled version Ahh my mistake, I forgot I also had renamed the source .py, will try it as you said. Is there any particular reason you are doing...
by SlowBro
Tue Oct 17, 2017 3:06 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

That’s why I tested the same on Windows as mentioned earlier. It’s actually faster there. Thats probably because the Windows computer has a faster x86 processor, more memory, and faster disks. No no, I mean Python 3.6 is faster on Windows than 2.7, negating the idea that it's the newer version caus...
by SlowBro
Tue Oct 17, 2017 10:26 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

That’s why I tested the same on Windows as mentioned earlier. It’s actually faster there. But fair enough, I will test a slow part of my actual code to see if it makes any difference with 2.7. I am very interested in Cython though. It promises dramatic increases that go beyond downgrading. Will seek...
by SlowBro
Tue Oct 17, 2017 3:01 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Oh. Perhaps it's not loading the file in the current directory. [email protected]:~# mv pass pass.old [email protected]:~# time python3.5 -m pass real 0m0.935s user 0m0.880s sys 0m0.040s [email protected]:~# Edit: No, it is. [email protected]:~# cython3 --embed pass_test.py -o pass_test.c; gcc $(pkg-con...
by SlowBro
Tue Oct 17, 2017 2:43 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

Re: What can be done about Python 3.5 slowness?

Have you considered Cython? http://cython.org/ Hmmmmmmmmmm. So I tried to compile the following file, and it's even worse. However, my actual code may be faster. I'll try it later. [email protected]:~# cat pass.py #!/usr/bin/env python3.5 pass [email protected]:~# cython3 --embed pass.py -o pass.c; g...
by SlowBro
Tue Oct 17, 2017 1:58 am
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 43
Views: 4991

What can be done about Python 3.5 slowness?

I'm using Python 3.5 in Stretch Lite on a B+ with a 32GB Samsung Evo+ SD and it's slowwwwwww. More than three times slower than 2.7.13 when doing a simple pass statement. What can be done about this? Found some posts ( this and this ) discussing the slowness with no apparent resolution. I see from t...

Go to advanced search