mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-03 06:09:07 +02:00
minedmap: add support for parallel processing
For now, only RegionProcessor and TileMipmapper are run in parallel.
This commit is contained in:
parent
c1260a63b5
commit
78fe1ec50e
6 changed files with 191 additions and 11 deletions
|
@ -1,8 +1,9 @@
|
|||
use std::{ffi::OsStr, path::Path, time::SystemTime};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use minedmap::{
|
||||
io::{fs, storage},
|
||||
resource::{self, Biome},
|
||||
|
@ -183,11 +184,11 @@ impl<'a> RegionProcessor<'a> {
|
|||
fs::create_dir_all(&self.config.processed_dir)?;
|
||||
fs::create_dir_all(&self.config.tile_dir(TileKind::Lightmap, 0))?;
|
||||
|
||||
for &coords in ®ions {
|
||||
regions.par_iter().for_each(|&coords| {
|
||||
if let Err(err) = self.process_region(coords) {
|
||||
eprintln!("Failed to process region {:?}: {:?}", coords, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ok(regions)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue