Welcome to the Builder Academy

Question Trigger Lag

More
13 Oct 2017 13:28 #6990 by Gahan
Replied by Gahan on topic Trigger Lag
So I was able to narrow the lag down to two functions in the code (which are called both in extract_obj and free_obj) for whatever reason.

The two functions can be found in dg_handler.c extract_script and free_proto_script. Both of these functions are almost identical. At either rate, I commented out both of these calls, and instantly lag is gone. However, this is obviously not a solution and will create wildly out of control memory leaks especially when dealing with this volume of items. Anyways, I thought I'd share my findings thus far here.

Please Log in or Create an account to join the conversation.

More
14 Oct 2017 20:39 #6992 by Gahan
Replied by Gahan on topic Trigger Lag
Found the issue: In dg_handler.c in the extract_script and free_proto_script the follow code resides in both:

#if 1 /* debugging */
{
struct char_data *i = character_list;
struct obj_data *j = object_list;
room_rnum k;
if (sc) {
for ( ; i ; i = i->next)
assert(sc != SCRIPT(i));
for ( ; j ; j = j->next)
assert(sc != SCRIPT(j));
for (k = 0; k < top_of_world; k++)
assert(sc != SCRIPT(&world[k]));
}
}
#endif

#if 1 will always return as true. Funny why compiler doesn't pick that up. This should be changed to allow for debugging mode, or not. This amount of assertions really slow things down when dealing with a for loop with several thousand objects with triggers.

Just thought I'd point this out. I fixed this issue on my MUD and everything works much better now. Its still not perfect, and a more efficient routine to handle objects is a must.
The following user(s) said Thank You: zusuk

Please Log in or Create an account to join the conversation.

Time to create page: 0.169 seconds