summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-11-11 02:13:35 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-11-11 02:13:35 +0100
commitc6944e7edcacc8960170719623c325aefaf23cac (patch)
treeba703132b9c442a61873cd6644b652641978fcf0 /Python/errors.c
parent0cae609847cccd78d3a960a70782c7b7ee891e3e (diff)
downloadcpython-git-c6944e7edcacc8960170719623c325aefaf23cac.tar.gz
Issue #28618: Make hot functions using __attribute__((hot))
When Python is not compiled with PGO, the performance of Python on call_simple and call_method microbenchmarks depend highly on the code placement. In the worst case, the performance slowdown can be up to 70%. The GCC __attribute__((hot)) attribute helps to keep hot code close to reduce the risk of such major slowdown. This attribute is ignored when Python is compiled with PGO. The following functions are considered as hot according to statistics collected by perf record/perf report: * _PyEval_EvalFrameDefault() * call_function() * _PyFunction_FastCall() * PyFrame_New() * frame_dealloc() * PyErr_Occurred()
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 0c38f7cf0c..d459fae622 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -158,7 +158,7 @@ PyErr_SetString(PyObject *exception, const char *string)
}
-PyObject *
+PyObject* _Py_HOT_FUNCTION
PyErr_Occurred(void)
{
PyThreadState *tstate = PyThreadState_GET();