Skip to content

Commit

Permalink
chore: Update examples to use PolarsAllocator
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Jul 23, 2024
1 parent 92ad53f commit f3bb9d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 0 additions & 3 deletions example/derive_expression/expression_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ pyo3 = { version = "0.21", features = ["abi3-py38"] }
pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["derive"] }
rayon = "1.7.0"
serde = { version = "1", features = ["derive"] }

[target.'cfg(target_os = "linux")'.dependencies]
jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] }
8 changes: 3 additions & 5 deletions example/derive_expression/expression_lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use pyo3_polars::PolarsAllocator;

mod distances;
mod expressions;

#[cfg(target_os = "linux")]
use jemallocator::Jemalloc;

#[global_allocator]
#[cfg(target_os = "linux")]
static ALLOC: Jemalloc = Jemalloc;
static ALLOC: PolarsAllocator = PolarsAllocator::new();
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use polars_lazy::frame::IntoLazy;
use polars_lazy::prelude::LazyFrame;
use pyo3::prelude::*;
use pyo3_polars::error::PyPolarsErr;
use pyo3_polars::{PyDataFrame, PyLazyFrame};
use pyo3_polars::{PolarsAllocator, PyDataFrame, PyLazyFrame};

#[global_allocator]
static ALLOC: PolarsAllocator = PolarsAllocator::new();

#[pyfunction]
fn parallel_jaccard(pydf: PyDataFrame, col_a: &str, col_b: &str) -> PyResult<PyDataFrame> {
Expand Down

0 comments on commit f3bb9d2

Please sign in to comment.