I took the time to refine the previous code I had to make it use less disk space and save more memory. This is provided with no guarantee and is known to be incompatible with all existing OLC systems. If you're serious about using this, it might be a good idea to not fopen/fclose the file constantly as I do here. fopen() it once in the world_init() function and fclose() it in the world_end() function. This will reduce the overhead, but possibly increase the memory usage by a little bit. If you do this, remember to fseek() to 0 where the current fclose() calls are. It is, of course, possible to extend this relatively easily... ftp://ftp.circlemud.org/pub/CircleMUD/contrib/code/wldswp.patch ------------------------------------------------------------------------------- Offline Room String Database This patch places all room titles and descriptions in a separate file that is accessed every time they are needed. This differs from the other patch that unloads room descriptions when they aren't needed. This patch saved about 600 KB on a stock CircleMUD. Profiling this code showed that the new functions take little time compared to some of the other functions. This patch is based on stock CircleMUD bpl14. The SIZE field is the important one, in KB. With this patch: USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND greerga 13818 35.7 4.1 3352 2636 4 S 13:47 0:02 bin/circle Stock CircleMUD: USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND greerga 13864 47.2 5.1 3988 3276 4 S 14:04 0:01 bin/circle All of the resulting strings are packed into the database as tightly as possible, even without a terminating NUL. The stock CircleMUD one ends up being 453,201 bytes large. The extra 150 KB savings I surmise to be from the saved malloc() overhead and ~15 KB saved from removing the 'name' and 'description' pointers. -- George Greer, greerga@circlemud.org | Genius may have its limitations, but http://patches.van.ml.org/ | stupidity is not thus handicapped. http://www.van.ml.org/CircleMUD/ | -- Elbert Hubbard +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST