Skip to contentSkip to conversation

Low performance with python3 compare to python2 on the same platform

Buildroot [email protected] 1 participant 3 messages Oct 27, 2023 – Jun 15, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

#1 lore raw

https://bugs.busybox.net/show_bug.cgi?id=15832

--- Comment #1 from Vincent Fazio <[email protected]> --- What's the output of python -m cProfile test_python.py 10000000 on each?

I do see some variances even in Docker containers but not to that degree. On an rpi CM3 it doesn't take anywhere near the numbers you're posting below (only 8s).

One option would be to profile the python interpreter itself. 3.12 has hooks for perf but they may not be representative of the situation you're seeing as recent interpreters try to perform opcode specialization. Otherwise you may have to build the interpreter with profiling enabled and use another external tool to collect that data.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to a message not in the archive

https://bugs.busybox.net/show_bug.cgi?id=15832

--- Comment #2 from [email protected] --- (In reply to Vincent Fazio from comment #1)

Thank you for your reply.
Here are the outputs of our test with the cProfile module:

```
# python2 -m cProfile test_python.py 10000000
         2 function calls in 18.871 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1   18.871   18.871   18.871   18.871 test_python.py:3(<module>)
        1    0.000    0.000    0.000    0.000 {method 'disable' of
'_lsprof.Profiler' objects}


# python3 -m cProfile test_python.py 10000000
         3 function calls in 53.225 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1   53.224   53.224   53.224   53.224 test_python.py:3(<module>)
        1    0.000    0.000   53.225   53.225 {built-in method builtins.exec}
        1    0.000    0.000    0.000    0.000 {method 'disable' of
'_lsprof.Profiler' objects}
```

Is the line built-in method builtins.exec relevant?

On the other hand, I am attempting to profile the cpython interpreter. I recompiled python3 with options --enable-optimizations and --enable-profiling, run my test and got the gmon.out.
I have no time accumulated when I run gprof on the output. So far I have no idea why the profiling output has no result. I need to investigate further.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to a message not in the archive

https://bugs.busybox.net/show_bug.cgi?id=15832

Yann E. MORIN <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
         Resolution|---                         |MOVED
             Status|NEW                         |RESOLVED

--- Comment #3 from Yann E. MORIN <[email protected]> --- Thank you for your report.

The issue tracker for the Buildroot project has been moved to the Gitlab.com issue tracker:
https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old tracker. If you believe your issue is still relevant, please open one in the new issue tracker.

Thank you!

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot