Skip to content

Commit

Permalink
Fix cython performance regression (#726)
Browse files Browse the repository at this point in the history
* Add legacy_implicit_noexcept = True

* [skipci] changelog
  • Loading branch information
MarcAntoineSchmidtQC authored Nov 3, 2023
1 parent d9002c0 commit 84260eb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
Changelog
=========

2.7.0 - 2023-10-xx
------------------
Unreleased
----------

**Bug fix:**

- Added cython compiler directive legacy_implicit_noexcept = True to fix performance regression with cython 3.

**Other changes:**

Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@
glm_benchmarks_run = glum_benchmarks.cli_run:cli_run
glm_benchmarks_analyze = glum_benchmarks.cli_analyze:cli_analyze
""",
ext_modules=cythonize(ext_modules, annotate=False),
ext_modules=cythonize(
ext_modules,
annotate=False,
compiler_directives={
"language_level": "3",
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
"nonecheck": False,
"cdivision": True,
"legacy_implicit_noexcept": True,
},
),
zip_safe=False,
)
1 change: 0 additions & 1 deletion src/glum/_cd_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# License: BSD 3 clause
# Substantial modifications by Ben Thompson <[email protected]>
#
# cython: boundscheck=False, wraparound=False, cdivision=True
from libc.math cimport fabs
cimport numpy as np
import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions src/glum/_functions.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# cython: boundscheck=False, wraparound=False, cdivision=True

from cython cimport floating
from cython.parallel import prange

Expand Down

0 comments on commit 84260eb

Please sign in to comment.