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
commit18dea7d67d8b263dd8b49e1d44dcb09ca86ad08a (patch)
treeedd70e3445393fc6ff134d83f808f0b0e13bbc17 /Python/errors.c
parentbc2f49454c330a83373e1f00c3de717dad4070ef (diff)
downloadcpython-18dea7d67d8b263dd8b49e1d44dcb09ca86ad08a.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();