mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Single thread support (#4988)
This commit is contained in:
parent
59d65bbdc0
commit
8d38bd4066
@ -225,7 +225,7 @@ pub struct SharedArgs {
|
|||||||
pub package_storage_args: PackageStorageArgs,
|
pub package_storage_args: PackageStorageArgs,
|
||||||
|
|
||||||
/// Number of parallel jobs spawned during compilation,
|
/// Number of parallel jobs spawned during compilation,
|
||||||
/// defaults to number of CPUs.
|
/// defaults to number of CPUs. Setting it to 1 disables parallelism.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
pub jobs: Option<usize>,
|
pub jobs: Option<usize>,
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,11 @@ impl SystemWorld {
|
|||||||
pub fn new(command: &SharedArgs) -> Result<Self, WorldCreationError> {
|
pub fn new(command: &SharedArgs) -> Result<Self, WorldCreationError> {
|
||||||
// Set up the thread pool.
|
// Set up the thread pool.
|
||||||
if let Some(jobs) = command.jobs {
|
if let Some(jobs) = command.jobs {
|
||||||
rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global().ok();
|
rayon::ThreadPoolBuilder::new()
|
||||||
|
.num_threads(jobs)
|
||||||
|
.use_current_thread()
|
||||||
|
.build_global()
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the system-global input path.
|
// Resolve the system-global input path.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user