Put seclist nodes in LevelPool memory

Replaces the old freelist solution with the LevelPool, which
dramatically reduces the number of allocations needed for mobj and
precip sector assignment. In measurement, this cuts down the time taken
for spawning precipitation by 50%.
This commit is contained in:
Eidolon authored and Alug committed 2025-09-12 14:06:47 +02:00
1 parent d53f25faee
commit 962ed1a364
1 file changed
+2 -15
+2 -15
View File
@@ -3824,11 +3824,8 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
Lots of new Boom functions that work faster and add functionality.
*/
static msecnode_t *headsecnode = NULL;
void P_Initsecnode(void)
{
headsecnode = NULL;
}
// P_GetSecnode() retrieves a node from the freelist. The calling routine
@@ -3836,24 +3833,14 @@ void P_Initsecnode(void)
static msecnode_t *P_GetSecnode(void)
{
msecnode_t *node;
if (headsecnode)
{
node = headsecnode;
headsecnode = headsecnode->m_thinglist_next;
}
else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
return node;
return Z_LevelPoolCalloc(sizeof(msecnode_t));
}
// P_PutSecnode() returns a node to the freelist.
static inline void P_PutSecnode(msecnode_t *node)
{
node->m_thinglist_next = headsecnode;
headsecnode = node;
Z_LevelPoolFree(node, sizeof(msecnode_t));
}
// P_AddSecnode() searches the current list to see if this sector is