mirror of
https://github.com/emmett-framework/granian.git
synced 2025-07-07 11:25:36 +00:00
Gate jemalloc behind feature (#618)
Some checks are pending
test / linux (3.11) (push) Waiting to run
test / linux (3.10) (push) Waiting to run
test / macos (3.9) (push) Waiting to run
test / linux (3.12) (push) Waiting to run
test / linux (3.13) (push) Waiting to run
test / linux (3.14) (push) Waiting to run
test / linux (3.9) (push) Waiting to run
test / linux (pypy3.11) (push) Waiting to run
test / linux (3.13t) (push) Waiting to run
test / linux (3.14t) (push) Waiting to run
test / macos (3.10) (push) Waiting to run
test / macos (3.11) (push) Waiting to run
test / macos (3.12) (push) Waiting to run
test / macos (3.13) (push) Waiting to run
test / macos (3.14) (push) Waiting to run
test / macos (3.13t) (push) Waiting to run
test / macos (3.14t) (push) Waiting to run
test / windows (3.10) (push) Waiting to run
test / windows (3.11) (push) Waiting to run
test / windows (3.12) (push) Waiting to run
test / windows (3.13) (push) Waiting to run
test / windows (3.13t) (push) Waiting to run
test / windows (3.14) (push) Waiting to run
test / windows (3.14t) (push) Waiting to run
test / windows (3.9) (push) Waiting to run
Some checks are pending
test / linux (3.11) (push) Waiting to run
test / linux (3.10) (push) Waiting to run
test / macos (3.9) (push) Waiting to run
test / linux (3.12) (push) Waiting to run
test / linux (3.13) (push) Waiting to run
test / linux (3.14) (push) Waiting to run
test / linux (3.9) (push) Waiting to run
test / linux (pypy3.11) (push) Waiting to run
test / linux (3.13t) (push) Waiting to run
test / linux (3.14t) (push) Waiting to run
test / macos (3.10) (push) Waiting to run
test / macos (3.11) (push) Waiting to run
test / macos (3.12) (push) Waiting to run
test / macos (3.13) (push) Waiting to run
test / macos (3.14) (push) Waiting to run
test / macos (3.13t) (push) Waiting to run
test / macos (3.14t) (push) Waiting to run
test / windows (3.10) (push) Waiting to run
test / windows (3.11) (push) Waiting to run
test / windows (3.12) (push) Waiting to run
test / windows (3.13) (push) Waiting to run
test / windows (3.13t) (push) Waiting to run
test / windows (3.14) (push) Waiting to run
test / windows (3.14t) (push) Waiting to run
test / windows (3.9) (push) Waiting to run
This commit is contained in:
parent
010d364b79
commit
52de19afd6
5 changed files with 33 additions and 60 deletions
27
.github/workflows/build.yml
vendored
27
.github/workflows/build.yml
vendored
|
@ -11,10 +11,10 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu, macos, windows]
|
||||
os: [ubuntu, macos]
|
||||
target: [x86_64, aarch64]
|
||||
manylinux: [auto]
|
||||
allocator: [auto]
|
||||
allocator: [jemalloc]
|
||||
include:
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
|
@ -29,6 +29,7 @@ jobs:
|
|||
platform: linux
|
||||
target: i686
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
|
||||
allocator: jemalloc
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
target: aarch64
|
||||
|
@ -46,6 +47,7 @@ jobs:
|
|||
platform: linux
|
||||
target: armv7
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
|
||||
allocator: jemalloc
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
target: x86_64
|
||||
|
@ -77,14 +79,8 @@ jobs:
|
|||
allocator: mimalloc
|
||||
- os: windows
|
||||
target: x86_64
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10 pypy3.11
|
||||
- os: windows
|
||||
target: x86_64
|
||||
interpreter: 3.13t 3.14t
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.13t 3.14 3.14t pypy3.9 pypy3.10 pypy3.11
|
||||
allocator: mimalloc
|
||||
exclude:
|
||||
- os: windows
|
||||
target: aarch64
|
||||
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
steps:
|
||||
|
@ -94,21 +90,10 @@ jobs:
|
|||
run: |
|
||||
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
|
||||
- uses: pyo3/maturin-action@v1
|
||||
if: matrix.allocator != 'mimalloc'
|
||||
with:
|
||||
rust-toolchain: stable
|
||||
command: build
|
||||
args: --release --out dist --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
target: ${{ matrix.target }}
|
||||
manylinux: ${{ matrix.manylinux || 'auto' }}
|
||||
container: ${{ matrix.container }}
|
||||
docker-options: -e CI
|
||||
- uses: pyo3/maturin-action@v1
|
||||
if: matrix.allocator == 'mimalloc'
|
||||
with:
|
||||
rust-toolchain: stable
|
||||
command: build
|
||||
args: --release --out dist --features mimalloc --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
args: --release --out dist --features ${{ matrix.allocator }} --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
target: ${{ matrix.target }}
|
||||
manylinux: ${{ matrix.manylinux || 'auto' }}
|
||||
container: ${{ matrix.container }}
|
||||
|
|
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
|
@ -30,10 +30,10 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu, macos, windows]
|
||||
os: [ubuntu, macos]
|
||||
target: [x86_64, aarch64]
|
||||
manylinux: [auto]
|
||||
allocator: [auto]
|
||||
allocator: [jemalloc]
|
||||
include:
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
|
@ -48,6 +48,7 @@ jobs:
|
|||
platform: linux
|
||||
target: i686
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
|
||||
allocator: jemalloc
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
target: aarch64
|
||||
|
@ -65,6 +66,7 @@ jobs:
|
|||
platform: linux
|
||||
target: armv7
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
|
||||
allocator: jemalloc
|
||||
- os: ubuntu
|
||||
platform: linux
|
||||
target: x86_64
|
||||
|
@ -96,14 +98,8 @@ jobs:
|
|||
allocator: mimalloc
|
||||
- os: windows
|
||||
target: x86_64
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10 pypy3.11
|
||||
- os: windows
|
||||
target: x86_64
|
||||
interpreter: 3.13t 3.14t
|
||||
interpreter: 3.9 3.10 3.11 3.12 3.13 3.13t 3.14 3.14t pypy3.9 pypy3.10 pypy3.11
|
||||
allocator: mimalloc
|
||||
exclude:
|
||||
- os: windows
|
||||
target: aarch64
|
||||
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
steps:
|
||||
|
@ -113,21 +109,10 @@ jobs:
|
|||
run: |
|
||||
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
|
||||
- uses: pyo3/maturin-action@v1
|
||||
if: matrix.allocator != 'mimalloc'
|
||||
with:
|
||||
rust-toolchain: stable
|
||||
command: build
|
||||
args: --release --out dist --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
target: ${{ matrix.target }}
|
||||
manylinux: ${{ matrix.manylinux || 'auto' }}
|
||||
container: ${{ matrix.container }}
|
||||
docker-options: -e CI
|
||||
- uses: pyo3/maturin-action@v1
|
||||
if: matrix.allocator == 'mimalloc'
|
||||
with:
|
||||
rust-toolchain: stable
|
||||
command: build
|
||||
args: --release --out dist --features mimalloc --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
args: --release --out dist --features ${{ matrix.allocator }} --interpreter ${{ matrix.interpreter || env.PY_ALL }}
|
||||
target: ${{ matrix.target }}
|
||||
manylinux: ${{ matrix.manylinux || 'auto' }}
|
||||
container: ${{ matrix.container }}
|
||||
|
|
24
.github/workflows/test.yml
vendored
24
.github/workflows/test.yml
vendored
|
@ -11,20 +11,25 @@ on:
|
|||
|
||||
jobs:
|
||||
linux:
|
||||
name: linux (${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
allocator: [jemalloc]
|
||||
python-version:
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
- '3.12'
|
||||
- '3.13'
|
||||
- '3.13t'
|
||||
- '3.14'
|
||||
- '3.14t'
|
||||
- pypy3.11
|
||||
include:
|
||||
- python-version: 3.13t
|
||||
allocator: mimalloc
|
||||
- python-version: 3.14t
|
||||
allocator: mimalloc
|
||||
|
||||
env:
|
||||
UV_PYTHON: ${{ matrix.python-version }}
|
||||
|
@ -38,26 +43,31 @@ jobs:
|
|||
uv python install ${{ env.UV_PYTHON }}
|
||||
uv venv .venv
|
||||
uv sync --group all
|
||||
uv run --no-sync maturin develop --uv
|
||||
uv run --no-sync maturin develop --uv --features ${{ matrix.allocator }}
|
||||
- name: Test
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
make test
|
||||
|
||||
macos:
|
||||
name: macos (${{ matrix.python-version }})
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
allocator: [jemalloc]
|
||||
python-version:
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
- '3.12'
|
||||
- '3.13'
|
||||
- '3.13t'
|
||||
- '3.14'
|
||||
- '3.14t'
|
||||
include:
|
||||
- python-version: 3.13t
|
||||
allocator: mimalloc
|
||||
- python-version: 3.14t
|
||||
allocator: mimalloc
|
||||
|
||||
env:
|
||||
UV_PYTHON: ${{ matrix.python-version }}
|
||||
|
@ -71,7 +81,7 @@ jobs:
|
|||
uv python install ${{ env.UV_PYTHON }}
|
||||
uv venv .venv
|
||||
uv sync --group all
|
||||
uv run --no-sync maturin develop --uv
|
||||
uv run --no-sync maturin develop --uv --features ${{ matrix.allocator }}
|
||||
- name: Test
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
|
@ -104,7 +114,7 @@ jobs:
|
|||
uv python install ${{ env.UV_PYTHON }}
|
||||
uv venv .venv
|
||||
uv sync --group all
|
||||
uv run --no-sync maturin develop --uv
|
||||
uv run --no-sync maturin develop --uv --features mimalloc
|
||||
- name: Test
|
||||
run: |
|
||||
uv run --no-sync pytest -v tests
|
||||
|
|
|
@ -50,19 +50,18 @@ pyo3 = { version = "=0.25", features = ["anyhow", "extension-module", "generate-
|
|||
pyo3-log = "=0.12"
|
||||
rustls-pemfile = "2.2"
|
||||
socket2 = { version = "=0.5.10", features = ["all"] }
|
||||
tikv-jemallocator = { version = "0.6.0", default-features = false, features = ["disable_initial_exec_tls"], optional = true }
|
||||
tls-listener = { version = "=0.11", features = ["rustls-ring"] }
|
||||
tokio = { version = "1.45", features = ["full"] }
|
||||
tokio-stream = "0.1"
|
||||
tokio-tungstenite = "=0.26"
|
||||
tokio-util = { version = "0.7", features = ["codec", "rt"] }
|
||||
|
||||
[target.'cfg(not(any(target_env = "musl", target_os = "freebsd", target_os = "openbsd", target_os = "windows")))'.dependencies]
|
||||
tikv-jemallocator = { version = "0.6.0", default-features = false, features = ["disable_initial_exec_tls"] }
|
||||
|
||||
[build-dependencies]
|
||||
pyo3-build-config = "=0.25"
|
||||
|
||||
[features]
|
||||
jemalloc = ["dep:tikv-jemallocator"]
|
||||
mimalloc = ["dep:mimalloc"]
|
||||
|
||||
[profile.release]
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -1,14 +1,8 @@
|
|||
#[cfg(not(any(
|
||||
target_env = "musl",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "windows",
|
||||
feature = "mimalloc"
|
||||
)))]
|
||||
#[cfg(all(feature = "jemalloc", not(feature = "mimalloc")))]
|
||||
#[global_allocator]
|
||||
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||
|
||||
#[cfg(feature = "mimalloc")]
|
||||
#[cfg(all(feature = "mimalloc", not(feature = "jemalloc")))]
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue