0

Shuffle around wall IDs, change wall check

Previously, walls were all numbered at 21000+. This is bad because
our blockmap is an array, so this caused our blockmap to take up
80 MiB of RAM in each worker process.

This commit changes the wall numbering, and exploits some bitmasking
to have the wall check run in constant time no matter how many walls
there are. This is done with a simple mask and xor to check the prefix.

RAM usage for the blockmap thus drops to like 44 MiB.

This is in preparation for adding more walls for 1.16.
This commit is contained in:
Nicolas F
2020-07-13 19:15:47 +02:00
parent a3e4812ca9
commit fcb3f2644d
6 changed files with 60 additions and 68 deletions

View File

@@ -814,21 +814,20 @@ class RegionSet(object):
'minecraft:campfire': (11506, 0),
'minecraft:bell': (11507, 0),
# adding a gap in the numbering of walls to keep them all
# in one numbering block starting at 21000
'minecraft:andesite_wall': (21000, 0),
'minecraft:brick_wall': (21001, 0),
'minecraft:cobblestone_wall': (21002, 0),
'minecraft:diorite_wall': (21003, 0),
'minecraft:end_stone_brick_wall': (21004, 0),
'minecraft:granite_wall': (21005, 0),
'minecraft:mossy_cobblestone_wall': (21006, 0),
'minecraft:mossy_stone_brick_wall': (21007, 0),
'minecraft:nether_brick_wall': (21008, 0),
'minecraft:prismarine_wall': (21009, 0),
'minecraft:red_nether_brick_wall': (21010, 0),
'minecraft:red_sandstone_wall': (21011, 0),
'minecraft:sandstone_wall': (21012, 0),
'minecraft:stone_brick_wall': (21013, 0),
'minecraft:andesite_wall': (1792, 0),
'minecraft:brick_wall': (1793, 0),
'minecraft:cobblestone_wall': (1794, 0),
'minecraft:diorite_wall': (1795, 0),
'minecraft:end_stone_brick_wall': (1796, 0),
'minecraft:granite_wall': (1797, 0),
'minecraft:mossy_cobblestone_wall': (1798, 0),
'minecraft:mossy_stone_brick_wall': (1799, 0),
'minecraft:nether_brick_wall': (1800, 0),
'minecraft:prismarine_wall': (1801, 0),
'minecraft:red_nether_brick_wall': (1802, 0),
'minecraft:red_sandstone_wall': (1803, 0),
'minecraft:sandstone_wall': (1804, 0),
'minecraft:stone_brick_wall': (1805, 0),
}
colors = [ 'white', 'orange', 'magenta', 'light_blue',