From 95409da87d009c352f27c737621972c2225796c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 29 Apr 2017 20:36:09 +0200 Subject: Optimize updateFastFaceRow processing by removing some TileSpec copy (#5678) * Optimize updateFastFaceRow processing by removing some TileSpec copy It permit to decrease this function from 54% runtime to 45% and reduce copy from 14% runtime to 12.5% getTileInfo also reduced from 27% to 23% * makeFastFace should use a const ref too this trigger a const pointer need in the underlying function Also fix some code style and prevent calculating 4 times the same position at a point * Reduce a comparison cost for lights in updateFastFaceRow --- src/mapblock_mesh.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mapblock_mesh.h') diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index f32df3958..93d932a7b 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -267,8 +267,10 @@ void final_color_blend(video::SColor *result, // Retrieves the TileSpec of a face of a node // Adds MATERIAL_FLAG_CRACK if the node is cracked -TileSpec getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data); -TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data); +// TileSpec should be passed as reference due to the underlying TileFrame and its vector +// TileFrame vector copy cost very much to client +void getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data, TileSpec &tile); +void getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data, TileSpec &tile); #endif -- cgit v1.2.3