diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-11-11 01:13:35 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-11-11 01:13:35 (GMT) |
commit | c6944e7edcacc8960170719623c325aefaf23cac (patch) | |
tree | ba703132b9c442a61873cd6644b652641978fcf0 /Python/errors.c | |
parent | 0cae609847cccd78d3a960a70782c7b7ee891e3e (diff) | |
download | cpython-c6944e7edcacc8960170719623c325aefaf23cac.zip cpython-c6944e7edcacc8960170719623c325aefaf23cac.tar.gz cpython-c6944e7edcacc8960170719623c325aefaf23cac.tar.bz2 |
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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c index 0c38f7c..d459fae 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(); |