(Message circle:90) Received: from QUCDN.QueensU.CA by spinach.mscc.huji.ac.il (AIX 3.2/UCB 5.64/4.03) id AA229839; Sat, 24 Aug 1996 04:30:19 +0300 Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP; Fri, 23 Aug 96 21:37:16 EDT Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4) id VAA06880; Fri, 23 Aug 1996 21:02:46 -0500 Received: from mail.Clark.Net by cspo.queensu.ca (SMI-8.6/SMI-SVR4) Received: from clark.net (samedi@clark.net [168.143.0.7]) by mail.Clark.Net (8.7.3/8.6.5) with ESMTP id VAA20381 for <circle@cspo.queensu.ca>; Fri, 23 Aug 1996 21:02:56 -0400 (EDT) Received: (from samedi@localhost) by clark.net (8.7.1/8.7.1) id VAA25087; Fri, 23 Aug 1996 21:02:54 -0400 (EDT) Date: Fri, 23 Aug 1996 21:02:54 -0400 (EDT) From: Sammy <samedi@clark.net> To: circle@cspo.queensu.ca Subject: [Circle] [CODE] Search buffering Message-Id: <Pine.SOL.3.91.960823202354.19235A-100000@clark.net> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-circle@cspo.queensu.ca Precedence: bulk In case anybody else out there is stuck on a terribly slow server and have noticed zone reset lag (I've seen a certain zone take 2-3 minutes to reset during busy hours), here's a simple fix to speed things up a little. All it does is buffer the last mob, object, and room so if you load the same mob twice it doesn't search the whole index again. Add these three variables to db.c somewhere around the top: /* search buffereing */ sh_int mob_sbuf = NOBODY; sh_int obj_sbuf = NOTHING; sh_int room_sbuf = NOWHERE; And replace real_room, real_object, and real_mobile with these (if anyone out there is still using obuild just change the xxx_sbuf parts). PLease excuse any typos. If there's trouble just copy the buffering lines. Sam int real_room(int virtual) { int bot, top, mid; bot = 0; top = top_of_world; if((world + room_sbuf)->number == virtual) return room_sbuf; for (;;) { mid = (bot + top) >> 1; if ((world + mid)->number == virtual) { room_sbuf = mid; return mid; } if (bot >= top) break; if ((world + mid)->number > virtual) top = mid - 1; else bot = mid + 1; } return(NOWHERE); } int real_mobile(int virtual) { int bot, top, mid; bot = 0; top = top_of_mobt; if((mob_index + mob_sbuf)->virtual == virtual) return mob_sbuf; for (;;) { mid = (bot + top) >> 1; if ((mob_index + mid)->virtual == virtual) { mob_sbuf = mid; return mid; } if (bot >= top) break; if ((mob_index + mid)->virtual > virtual) top = mid - 1; else bot = mid + 1; } return(NOBODY); } int real_object(int virtual) { int bot, top, mid; bot = 0; top = top_of_objt; if((obj_index + obj_sbuf)->virtual == virtual) return obj_sbuf; for (;;) { mid = (bot + top) >> 1; if ((obj_index + mid)->virtual == virtual) { obj_sbuf = mid; return mid; } if (bot >= top) break; if ((obj_index + mid)->virtual > virtual) top = mid - 1; else bot = mid + 1; } return(NOTHING); } +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/07/00 PST