Hello Alex,

I’m investigating Python 3 performance issues on a Raspberry Pi Yocto build; I 
appreciate any insights you can provide into the problem.

In my investigation, I noticed that PGO was disabled in all cases due to a 
small bug. I fixed it in a patch submitted to OE-Core 
(#139459<https://lists.openembedded.org/g/openembedded-core/message/139459>). 
Even when PGO is indeed enabled, Python 3 runs significantly slower on 
Yocto-compiled Python 3.8.3 than the same version compiled on Raspbian.

In your patch, 
0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch<http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch>,
 I see that you override the default PROFILE_TASK, which did not explicitly 
specify test suites, to a command that explicitly provides test suites. How did 
you decide on these tests? The standard PGO command runs 43 tests, while you 
specify 7. When I compile Python 3.8.3 on Raspbian, I see no intersection 
between the 43 tests run by default and the 7 you specify. Additionally, the 
default module for PROFILE is test while you use test.regrtest.

For reference, here’s the results of a simple CPU-bound test. These tests were 
run on the same Raspberry Pi 4 with same SD card.

python3 -m timeit -r 10 --setup '
def fib(n):
 if n < 2:
   return n
 if n == 2:
   return 1
 return fib(n - 1) + fib(n - 2)
' '[fib(n) for n in range(20)]'

# Yocto Python 3.8.3
# 10 loops, best of 10: 28.9 msec per loop
# 10 loops, best of 10: 29.3 msec per loop
# 10 loops, best of 10: 27.9 msec per loop
# 10 loops, best of 10: 30.4 msec per loop
# Average result: 31.625 msec per loop

# Raspbian Python 3.8.3
# 50 loops, best of 10: 7.73 msec per loop
# 50 loops, best of 10: 7.72 msec per loop
# 50 loops, best of 10: 7.67 msec per loop
# 50 loops, best of 10: 7.74 msec per loop
# Average result: 7.715 msec per loop

# Raspbian speedup: 4.09x

Best,
Ryan Rowe
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#139464): 
https://lists.openembedded.org/g/openembedded-core/message/139464
Mute This Topic: https://lists.openembedded.org/mt/74848490/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to