Then ESP8266 and ESP32 numbers were added, and a 2.8GHz Intel number.
Later I added Pi numbers as well, updated 2 days ago with Pi 3B number:
https://forum.arduino.cc/index.php?topi ... msg3413818

So basically the Due is most performant Arduino, "only" 83 times slower than Intel.
ESPs are better than all Arduinos, and PIs are even better.
And until today all made sense, Pi 3B is 1200/900=4/3 times better than Pi 2B (34μs versus 45μs).
Today I compiled q32.c with -O3 on my new Pi 3B+ and only get the same number as for Pi 3B.
I would have expected factor 1400/1200=7/6 better than Pi 3B.
Pi 3B+ is real, see 191Mbit/s over lan below (A), although my laptop gets 386Mbit/s with same speedtest-cli.
The code is just excessive search for minimal magic 3x3 square consisting of distinct primes.
Here you can download it, or see (B) below.
https://stamm-wilbrandt.de/en/forum/q32.c
I would have expected at least search time <30μs after forcing CPU frequency to 1.4GHz and running as root ...
What am I missing here, why does 3B+ show same single core integer performance as 3B?
Code: Select all
pi@raspberrypi3Bplus:~ $ sudo su
root@raspberrypi3Bplus:/home/pi# echo 1400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
root@raspberrypi3Bplus:/home/pi# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1400000
root@raspberrypi3Bplus:/home/pi# ./q32
47| 29|101|
113| 59| 5|
17| 89| 71|
34us
root@raspberrypi3Bplus:/home/pi#
(A)
Code: Select all
pi@raspberrypi3Bplus:~ $ speedtest-cli
Retrieving speedtest.net configuration...
Testing from Kabel BW (46.223.20.147)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by PfalzKom (Ludwigshafen) [11.73 km]: 24.753 ms
Testing download speed................................................................................
Download: 191.04 Mbit/s
Testing upload speed....................................................................................................
Upload: 19.59 Mbit/s
pi@raspberrypi3Bplus:~ $
(B)
Code: Select all
/* determine minimal prime 3x3 magic square; for more details see bottom */
#include <stdio.h>
#include <sys/time.h>
#include <stdint.h>
uint32_t B[]={0x35145105,0x4510414,0x11411040,0x45144001};
#define Prime(i) ((B[(i)>>5] & (0x80000000UL >> ((i)%32))) != 0)
#define forall_odd_primes_less_than(p, m, block) \
for((p)=3; (p)<(m); (p)+=2) \
if (Prime((p))) \
block
uint8_t p,a,b,c,d;
struct timeval tv0,tv1;
int main(void)
{
gettimeofday(&tv1, NULL); // wait for usec change
do gettimeofday(&tv0, NULL); while (tv0.tv_usec == tv1.tv_usec);
forall_odd_primes_less_than(p, 64,
forall_odd_primes_less_than(a, p,
if Prime(2*p-a)
{
forall_odd_primes_less_than(b, p,
if ( (b!=a) && Prime(2*p-b) )
{
c= 3*p - (a+b);
if ( (c<2*p) && (2*p-c!=a) && (2*p-c!=b) && Prime(c) && Prime(2*p-c) )
{
if (2*a+b>2*p)
{
d = 2*a + b - 2*p; // 3*p - (3*p-(a+b)) - (2*p-a)
if ( (d!=a) && (d!=b) && (d!=2*p-c) && Prime(d) && Prime(2*p-d) )
{
gettimeofday(&tv1, NULL);
printf("%3u|%3u|%3u|\n%3u|%3u|%3u|\n%3u|%3u|%3u|\n",
a,b,c,2*p-d,p,d,2*p-c,2*p-b,2*p-a);
printf("\n%ldus\n",
1000000*(tv1.tv_sec-tv0.tv_sec)+tv1.tv_usec-tv0.tv_usec);
return 0;
}
}
}
}
)
}
)
)
}
/*
it always exists this by rotation and flippings (= is p, -/+ is less/greater p)
--?
?=?
???
proof by enumeration of all possibilities
++
=
--
+- +-+ +-+
= = +=-
+- -+- -+-
+-+
-=
-+-
+--
=
+-
-+ -+ -++
= +=- +=-
-+ -+ --+
-+-
+=-
-+
-+
-=
-+
--
=
++
row/column/diagonal sum is 3*p
a b 3*p-(a+b)=c - - +
p 2*a+b-2*p=d + = -
2*p-a - + +
*/