Search code examples
pythonpython-3.xprofilingperfpython-internals

What is _PyEval_EvalFrameDefault?


When I'm profiling with perf _PyEval_EvalFrameDefault is at the top for CPU usage.

But I don't know what it is. How can I avoid this function?


Solution

  • You are running your Python program in the CPython interpreter. While the Python code gets translated to bytecode, this bytecode doesn't run on the CPU itself but is executed by a program itself. The core of this interpreter program is _PyEval_EvalFrameDefault. Since perf profiles the instructions of the CPU, it only sees this function being executed all the time.

    In order to understand which Python functions take up most of the time, you need to use a native Python performance analysis tool.