From 8bbe034aade69cacc28c92e9a9b3cb638ee929fe Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Tue, 9 Jul 2019 18:05:15 +0200 Subject: [PATCH] world: use numpy.empty instead of numpy.zeros Some arrays get completely filled anyway, so we might as well not use numpy.zeros, and instead choose numpy.empty. --- overviewer_core/world.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overviewer_core/world.py b/overviewer_core/world.py index f1261f5..94019d6 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -1174,8 +1174,8 @@ class RegionSet(object): pass # We already have initialised arrays with 0 (= air) # Turn the BlockStates array into a 16x16x16 numpy matrix of shorts. - blocks = numpy.zeros((4096,), dtype=numpy.uint16) - data = numpy.zeros((4096,), dtype=numpy.uint8) + blocks = numpy.empty((4096,), dtype=numpy.uint16) + data = numpy.empty((4096,), dtype=numpy.uint8) block_states = self._packed_longarray_to_shorts(section['BlockStates'], 4096) blocks[::1] = translated_blocks[block_states] data[::1] = translated_data[block_states]