Page 1 of 1

[SOLVED] Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 10:28 am
by Modeler
Hi all,

Sorry for the long post. I've had the new Pi Zero Wireless for a couple of days now, running Arch and everything's working fine apart from one thing. I found apps that worked well on the original Pi Zero are noticeably slower. In order to make this make reproducible, I installed and ran sysbench (never used this before, don't know if this is regarded as a good tool or not) on both. I ran the following:

Code: Select all

$ sysbench --test=cpu --cpu-max-prime=20000 run
Both Pis were booted from the same SD card, so there can be no difference in the OS configuration, clock speed and such. I went as far as to stop / remove the Wi-Fi and Bluetooth services / kernel modules on the Zero W prior to running the test, i.e. so the output from "systemctl status" and "lsmod" was identical to the original Zero.

Pi Zero W reported:
total time: 873.9604s

Original Pi Zero reported:
total time: 608.9308s

That's a massive difference and it was consistent when I ran the tests; I also have a later non-wireless Pi Zero which also completed the test in ~612 seconds. The Zero W's specs are the same, it just adds Wi-Fi and Bluetooth. So I really can't explain this. I'm using a good power supply that works fine for a Pi 3, so I don't think that's the issue.

I have been able to borrow a second Pi Zero W from a friend so I can rule out a fault with my own board. Also planning to re-run the test on the original Pi Zero with a USB Wi-Fi dongle attached. I'll also repeat the test with Raspbian, just to rule out any issues with Arch.

In the meantime, can anyone help to explain what I'm seeing here?

Thanks!

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 11:00 am
by SteveSpencer
Certainly with Raspbian (sorry, I don't use ARCH), there was a firmware issue to resolve a problem where the Zero W was being clocked at 700MHz, not 1GHz.
The latest updates to Raspbian fixed that, according to the Zero W I have here on my desk recompiling a kernel.

Don't know, however, if you can fix it just with a firmware update, or if there was a change to the kernel, although I guess looking through the git commits would give you a better idea...

/Steve

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 3:00 pm
by mattmiller
I just checked my PiZeroW (as I did an apt-get dist-upgrade on it a week ago) and the cpu freq applet was indeed indicating only 700Mhz

So I wrote a simple loop benchmark that took 22 secs

I then did another dist-upgrade and the cpu applet now shows 1000MHz

Re-ran the loop benchmark - same result as before! (Never trust computers is what I say!) :)

Tried same card in old PiZero - same result

[edit]Just for completeness - ran same benchmark on my Pi3 - took 22 secs :) (Although it booted a lot faster - it just shows that single processor bound tasks take same time on a PiZeroW compared to Pi3 but at < 1/2 the cost :) [/edit]

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 8:02 pm
by HawaiianPi
mattmiller wrote:I just checked my PiZeroW (as I did an apt-get dist-upgrade on it a week ago) and the cpu freq applet was indeed indicating only 700Mhz

So I wrote a simple loop benchmark that took 22 secs

I then did another dist-upgrade and the cpu applet now shows 1000MHz

Re-ran the loop benchmark - same result as before! (Never trust computers is what I say!) :)

Tried same card in old PiZero - same result

[edit]Just for completeness - ran same benchmark on my Pi3 - took 22 secs :) (Although it booted a lot faster - it just shows that single processor bound tasks take same time on a PiZeroW compared to Pi3 but at < 1/2 the cost :) [/edit]
There is something seriously wrong with your test. There is no way a Pi3 will not beat a Pi-Zero, even when using only a single core. Not only is the Pi3 clocked higher, it uses a newer, more efficient core design.

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 9:56 pm
by mattmiller
There is something seriously wrong with your test. There is no way a Pi3 will not beat a Pi-Zero, even when using only a single core. Not only is the Pi3 clocked higher, it uses a newer, more efficient core design.
the original benchmark I was using was simple scratch empty 1000 loop

Just tried a python empty 10000000 loop and Pi3 took 9 secs and pizerow took 14 so that did see a 50% improvement

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 10:08 pm
by Modeler
SteveSpencer wrote:Certainly with Raspbian (sorry, I don't use ARCH), there was a firmware issue to resolve a problem where the Zero W was being clocked at 700MHz, not 1GHz.
Thanks Steve, I thought it must be something like that but it seemed too unlikely to just assume. My friend's Pi Zero W behaves the same as mine.

700 MHz vs. 1 GHz would tie up with the figures I'm seeing. I've tried the latest Raspbian and it looks better. Need to figure out what's going on with Arch now, will ask over at the Arch Linux ARM forum.

Cheers.

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Tue Mar 07, 2017 10:43 pm
by peterlite
The Pi Zero also had variations, 1.2, 1.3. Which version are you using?

My Pi 3 is noticeably faster than my Pi Zero 1.3 when using one core. When I run a program that uses just one core, the other bits of Raspbian step out of that core and run elsewhere.

If you are using the one microSD card in both machines, there might be a setting limiting the speed.

Re: Pi Zero W slower CPU than original Pi Zero?

Posted: Wed Mar 08, 2017 10:13 am
by Modeler
peterlite wrote:The Pi Zero also had variations, 1.2, 1.3. Which version are you using?
I tested a Pi Zero 1.2 (original board I think?) and 1.3 (later revision with the camera ribbon connector). Both appeared to be running at the correct speed, only the Pi Zero W was slower.
peterlite wrote:My Pi 3 is noticeably faster than my Pi Zero 1.3 when using one core. When I run a program that uses just one core, the other bits of Raspbian step out of that core and run elsewhere.
That makes sense; Pi 3 is clocked at 1.2 GHz by default so single thread performance would be greater than a Pi Zero @ 1.0 GHz.

Found the problem; looks like Steve was right. For some reason the clock speed was limited to 700 MHz by default:

Code: Select all

[[email protected] ~]$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 
700000
I re-imaged my SD card using the Arch Linux ARM image dated 1st March and the issue appears to have been fixed. I'm not sure what determines these parameters, there's nothing in config.txt but perhaps it didn't recognise the board as a Pi Zero and defaulted to the Pi 1's clock speed?

Calling this resolved, thanks all.

Re: [SOLVED] Pi Zero W slower CPU than original Pi Zero?

Posted: Thu Mar 09, 2017 8:06 am
by Modeler
Well now I'm totally confused. I switched to Raspbian to try and make life a bit easier for myself, but now getting Wi-Fi problems and the benchmark results are the worst yet, over 900 seconds total time.

This is (thankfully?) consistent when run on my original Pi Zero 1.3, so who knows why this is happening. /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq and cpi_cur_freq both read 1000000 in this case. So annoying.

Re: [SOLVED] Pi Zero W slower CPU than original Pi Zero?

Posted: Thu Mar 09, 2017 9:53 am
by mattmiller
Just to confirm that your benchmark on my PiZeroW
(up to date Raspbian)

Code: Select all

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
    total time:                          923.0442s
    total number of events:              10000
    total time taken by event execution: 922.9952
    per-request statistics:
         min:                                 90.57ms
         avg:                                 92.30ms
         max:                                263.99ms
         approx.  95 percentile:              97.26ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   922.9952/0.00

Re: [SOLVED] Pi Zero W slower CPU than original Pi Zero?

Posted: Thu Mar 09, 2017 10:41 am
by Modeler
Thank you mattmiller for posting that, it's good to know. I don't have any real-world evidence to suggest that my Pi Zero W is actually running slowly under Raspbian yet, but I will know one way or the other later this evening.

Thanks again.

Re: [SOLVED] Pi Zero W slower CPU than original Pi Zero?

Posted: Thu Mar 09, 2017 11:42 am
by mattmiller
Just tried on a PiZero (not W) that I haven't updated for 6 months and got this
Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
total time: 989.3460s
total number of events: 10000
total time taken by event execution: 989.2877
per-request statistics:
min: 92.95ms
avg: 98.93ms
max: 275.14ms
approx. 95 percentile: 106.08ms

Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 989.2877/0.00
I wonder if your just seeing the effect of Arch being more uptodate with better running software package than Jessie Raspbian?

or maybe it can't tell the time :) #Joke

[edit] I'd remove solved from thread title BTW[/edit]