Add benchmark for filling at ceiling level, to test skylight performance

This commit is contained in:
David Vierra 2016-02-02 14:08:18 -10:00
parent 4389c4640d
commit b089d6f871

View File

@ -0,0 +1,25 @@
from benchmarks import bench_temp_level
from mceditlib.selection import BoundingBox
from mceditlib.util import exhaust
import logging
logging.basicConfig(level=logging.INFO)
size = 50
def timeFillCeiling():
temp = bench_temp_level("AnvilWorld")
editor = temp
dim = editor.getDimension()
bounds = dim.bounds
x, y, z = bounds.center
y = 254
x -= size//2
z -= size//2
bounds = BoundingBox((x, y, z), (size, 1, size))
exhaust(dim.fillBlocksIter(bounds, editor.blocktypes["planks"]))
if __name__ == "__main__":
import timeit
time = timeit.timeit(timeFillCeiling, number=1)
print "Filled in %.02f (%0.3f per block" % (time, (time / (size * size)))