On Wed, 20 Aug 1997, Jeremy Elson wrote:
>George writes:
>>[...etc...]
>>print_object_location:1354 requested 8192 bytes, received 12320.
>>write_to_output:987 requested 12288 bytes, received 32384. (***)
>
>This is a good example of why the buffer-selection policy needs more
>work, though - maybe using best fit instead of first fit. Of course,
At this point, I had two 8,192 byte buffers. Do_where took the first, and
perform_immort_where took the second. That left none free for
print_object_location and I didn't have a dedicated 12288 byte buffer at
the time.
A large part of this problem is that so much of the code wants a
MAX_STRING_LENGTH buffer when they really need less. Like do_where
requested a MAX_STRING_LENGTH (8192) and uses it for one_argument which
only requires MAX_INPUT_LENGTH (256). Once I eliminate all those cases by
evaluating all the allocations, it should be a lot bteter.
>any data structures student will tell you that no matter which policy
>you use [first fit, best fit, worst fit, next fit, etc.] you can
>construct an example in which the policy is catastrophically bad; but
do_users, do_who
>for Circle I think best fit is probably best, as long as it can be
>done quickly. (Actually, since there are only a small number of
>possible sizes of buffers, maybe each size should be kept on its own
>linked list -- e.g. instead of a single list of type Buffer *, have an
A lot of functions request odd sizes like 200, 100, 32384, 12880, 300, etc.
>array of type *Buffers[], where Buffers[i] is the beginning of a
>linked list of buffers of size 2**i).
I think a system of:
buffer[x] - (typical use)
0 = 128 - log messages mostly
1 = 256 - one_argument
2 = 512 - overflows
3 = 1024 - small bufsize
4 = 2048 - keep for overflow?
5 = 4096 - keep for overflow?
6 = 8192 - max_string_length, the single most requested buffer
7 = 16384 - process_output and large buffers
8 = 32768 - load_help
Then any requests over 32,768 return error (I would prefer error unless
given a valid reason to allow such huge requests) and anything less than
128 gets a 128. Simple bit shifting (or division) would give us the size.
--
greerga@muohio.edu me@null.net | Genius may have its limitations, but stupidity
http://www.muohio.edu/~greerga | is not thus handicapped. -- 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/08/00 PST