()
| 122 | }; |
| 123 | |
| 124 | fn get_runtime() -> &'static Runtime { |
| 125 | use std::sync::OnceLock; |
| 126 | static RUNTIME: OnceLock<Runtime> = OnceLock::new(); |
| 127 | RUNTIME.get_or_init(|| { |
| 128 | // Optimized runtime configuration for I/O-intensive workloads |
| 129 | tokio::runtime::Builder::new_multi_thread() |
| 130 | .worker_threads(num_cpus::get() * 2) // 2x CPU cores for better I/O handling |
| 131 | .max_blocking_threads(512) // More blocking threads for CPU-intensive tasks |
| 132 | .thread_name("a3s-code-worker") |
| 133 | .enable_all() |
| 134 | .build() |
| 135 | .expect("Failed to create tokio runtime") |
| 136 | }) |
| 137 | } |
| 138 | |
| 139 | fn json_string_to_py(py: Python<'_>, json: &str) -> PyResult<PyObject> { |
| 140 | let json_module = py.import("json")?; |
no test coverage detected