This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: print opcode stats at the end of pybench runs
Type: enhancement Stage: resolved
Components: Demos and Tools Versions: Python 3.2
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, lemburg, pitrou
Priority: normal Keywords: patch

Created on 2008-12-21 21:37 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pybench-opcodestats.patch pitrou, 2008-12-21 21:37
Messages (4)
msg78157 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-21 21:37
This patch prints opcode statistics at the end of a pybench run if
DYNAMIC_EXECUTION_PROFILE has been enabled when compiling the interpreter.

Is it ok? Is it better to add it to the Benchmark class?
msg78167 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2008-12-22 10:05
On 2008-12-21 22:37, Antoine Pitrou wrote:
> New submission from Antoine Pitrou <pitrou@free.fr>:
> 
> This patch prints opcode statistics at the end of a pybench run if
> DYNAMIC_EXECUTION_PROFILE has been enabled when compiling the interpreter.
> 
> Is it ok? Is it better to add it to the Benchmark class?

I don't think it's worth doing this for low-level and highly
artificial benchmarks like the ones run by pybench.

Opcode statistics are much better taken in real life applications,
e.g. let Django, Zope, etc. run for a day or two and then look
at the opcode statistics.

If at all, then opcode statistics should be an optional feature
enabled by a command line switch. I'd then create new methods
bench.start_opcode_stats(), bench.stop_opcode_stats() and
bench.get_opcode_stats().

Also note that this line will result in wrong results:

+            if opstats:
+                opstats = [new - old
+                    for new, old in zip(sys.getdxp(), opstats)]

It should be:

start_opstats = sys.getdxp()
...
stop_opstats = sys.getdxp()
opstats = [new_value - old_value
           for new_value, old_value in zip(stop_opstats, start_opstats]
msg78168 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-22 10:15
> I don't think it's worth doing this for low-level and highly
> artificial benchmarks like the ones run by pybench.

Well, it can help to know which opcodes are executed when running a
particular bunch of sub-tests :)

> If at all, then opcode statistics should be an optional feature
> enabled by a command line switch. I'd then create new methods
> bench.start_opcode_stats(), bench.stop_opcode_stats() and
> bench.get_opcode_stats().
> 
> Also note that this line will result in wrong results:
> 
> +            if opstats:
> +                opstats = [new - old
> +                    for new, old in zip(sys.getdxp(), opstats)]

You are right, my assumption was simply that the error would be in the
noise.
msg221242 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-22 10:04
@Antoine/Marc-Andre are either of you interested in taking this forward?
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 48964
2021-01-05 00:10:45gvanrossumsetstatus: languishing -> closed
resolution: out of date
stage: patch review -> resolved
2014-06-22 10:04:01BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221242
2010-07-21 12:09:37BreamoreBoysetstatus: open -> languishing
versions: + Python 3.2, - Python 3.0
2008-12-22 10:15:12pitrousetmessages: + msg78168
2008-12-22 10:05:52lemburgsetmessages: + msg78167
2008-12-21 21:37:36pitroucreate