Lazy evaluation of overview info
Callgrind showed recalc_mapseen was three times more expensive (in terms of instructions read) than anything else in our codebase. It was being called in every vision change, re-evaluating the last seen map terrain type for every map location in sight. Remove updating the lastseen info in the vision code, and make a small change so newsym() uses update_lastseentyp. From my short tests, this seems to work correctly ...
This commit is contained in:
@@ -152,7 +152,6 @@ static void set_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy);
|
||||
static void t_warn(struct rm *);
|
||||
static int wall_angle(struct rm *);
|
||||
|
||||
#define remember_topology(x, y) (gl.lastseentyp[x][y] = levl[x][y].typ)
|
||||
#define _glyph_at(x, y) gg.gbuf[y][x].glyphinfo.glyph
|
||||
|
||||
/*
|
||||
@@ -256,7 +255,7 @@ magic_map_background(coordxy x, coordxy y, int show)
|
||||
if (show)
|
||||
show_glyph(x, y, glyph);
|
||||
|
||||
remember_topology(x, y);
|
||||
update_lastseentyp(x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -461,7 +460,7 @@ unmap_object(register coordxy x, register coordxy y)
|
||||
else \
|
||||
map_background(x, y, show); \
|
||||
\
|
||||
remember_topology(x, y); \
|
||||
update_lastseentyp(x, y); \
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3670,7 +3669,6 @@ fn_cmap_to_glyph(int cmap)
|
||||
/* for 'onefile' processing where end of this file isn't necessarily the
|
||||
end of the source code seen by the compiler (there are lots of other
|
||||
macros defined above...) */
|
||||
#undef remember_topology
|
||||
#undef _glyph_at
|
||||
#undef DETECTED
|
||||
#undef PHYSICALLY_SEEN
|
||||
|
||||
Reference in New Issue
Block a user