From 4534fcacb37879fb69019b2d29e6a51a06370433 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Thu, 27 Apr 2023 15:46:11 -0700 Subject: [PATCH] Remove string allocatio from hot path --- pgml-extension/src/bindings/venv.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pgml-extension/src/bindings/venv.rs b/pgml-extension/src/bindings/venv.rs index e29872a94..68a0c0e40 100644 --- a/pgml-extension/src/bindings/venv.rs +++ b/pgml-extension/src/bindings/venv.rs @@ -7,6 +7,8 @@ use pyo3::prelude::*; use pyo3::types::PyTuple; use std::ffi::CStr; +static CONFIG_NAME: &'static str = "pgml.venv"; + static PY_MODULE: Lazy> = Lazy::new(|| { Python::with_gil(|py| -> Py { let src = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bindings/venv.py")); @@ -28,8 +30,7 @@ pub fn activate_venv(venv: &str) -> bool { pub fn activate() -> bool { unsafe { - let config_name = "pgml.venv".to_string(); - let option = pgrx_pg_sys::GetConfigOption(config_name.as_pg_cstr(), true, false); + let option = pgrx_pg_sys::GetConfigOption(CONFIG_NAME.as_pg_cstr(), true, false); if option.is_null() { false } else { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy