Skip to content

Commit 2942b90

Browse files
authored
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574)
1 parent 0a18422 commit 2942b90

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Disable computed gotos by default for clang < 5.0. It caused significant
2+
performance regression.

Python/ceval.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,19 @@ PyObject *
689689
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
690690
{
691691
#ifdef DYNAMIC_EXECUTION_PROFILE
692-
#undef USE_COMPUTED_GOTOS
692+
#undef USE_COMPUTED_GOTOS
693693
#endif
694694
#ifdef HAVE_COMPUTED_GOTOS
695695
#ifndef USE_COMPUTED_GOTOS
696-
#define USE_COMPUTED_GOTOS 1
696+
#if defined(__clang__) && (__clang_major__ < 5)
697+
/* Computed gotos caused significant performance regression
698+
* with clang < 5.0.
699+
* https://bugs.python.org/issue32616
700+
*/
701+
#define USE_COMPUTED_GOTOS 0
702+
#else
703+
#define USE_COMPUTED_GOTOS 1
704+
#endif
697705
#endif
698706
#else
699707
#if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS

0 commit comments

Comments
 (0)