Skip to content
Snippets Groups Projects
Verified Commit f220ddc6 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: improved num cpus in compilation

parent ce05bfc6
No related branches found
No related tags found
No related merge requests found
Pipeline #2201 failed
......@@ -23,7 +23,6 @@ wasm-bindgen = { version = "0.2", optional = true }
[build-dependencies]
chrono = "0.4"
num_cpus = "1"
regex = "1"
[profile.release]
......
......@@ -29,7 +29,7 @@ use std::fs::{File, OpenOptions};
use std::io::Write;
use std::path::Path;
use std::process::Command;
use std::{env, str};
use std::{env, str, thread};
const BUILD_OUT_FILE: &str = "build.rs";
const SOURCE_DIR: &str = "./src/gen";
......@@ -147,8 +147,11 @@ fn main() {
&(std::mem::size_of::<usize>() * 8).to_string(),
);
write_constant(&mut file, "DEFAULT_THREAD_POOL_SIZE", num_cpus::get());
write_constant(&mut file, "MAX_THREAD_POOL_SIZE", num_cpus::get() * 10);
write_constant(
&mut file,
"NUM_CPUS",
thread::available_parallelism().unwrap().get(),
);
}
fn write_constant<T>(file: &mut File, key: &str, val: T)
......
......@@ -13,5 +13,4 @@ pub const OPT_LEVEL: &str = "-";
pub const MAKEFLAGS: &str = "-";
pub const FEATURES: [&str; 1] = ["cpu"];
pub const PLATFORM_CPU_BITS: &str = "64";
pub const DEFAULT_THREAD_POOL_SIZE: usize = 1;
pub const MAX_THREAD_POOL_SIZE: usize = 1;
pub const NUM_CPUS: usize = 1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment