mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-04 06:39:07 +02:00
world/layer: avoid iproduct-based iterator in inner loop
iproduct iterators are fairly slow. As the iterator implementation is now unused, it is removed as well.
This commit is contained in:
parent
31eb92864c
commit
42cb342749
2 changed files with 17 additions and 27 deletions
|
@ -111,21 +111,25 @@ pub fn top_layer(chunk: &Chunk) -> Result<Option<LayerData>> {
|
|||
|
||||
for section in chunk.sections().rev() {
|
||||
for y in BlockY::iter().rev() {
|
||||
for xz in LayerBlockArray::<()>::keys() {
|
||||
let mut entry = ret.entry(xz);
|
||||
if entry.done() {
|
||||
continue;
|
||||
}
|
||||
for z in BlockZ::iter() {
|
||||
for x in BlockX::iter() {
|
||||
let xz = LayerBlockCoords { x, z };
|
||||
|
||||
let coords = SectionBlockCoords { xz, y };
|
||||
if !entry.fill(section, coords)? {
|
||||
continue;
|
||||
}
|
||||
let mut entry = ret.entry(xz);
|
||||
if entry.done() {
|
||||
continue;
|
||||
}
|
||||
|
||||
assert!(entry.done());
|
||||
done += 1;
|
||||
if done == N * N {
|
||||
break;
|
||||
let coords = SectionBlockCoords { xz, y };
|
||||
if !entry.fill(section, coords)? {
|
||||
continue;
|
||||
}
|
||||
|
||||
assert!(entry.done());
|
||||
done += 1;
|
||||
if done == N * N {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue