Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.rwth-aachen.de!newsserver.rrzn.uni-hannover.de!hrz-ws11.hrz.uni-kassel.de!news.th-darmstadt.de!nntp.zit.th-darmstadt.de!fu-berlin.de!informatik.tu-muenchen.de!Germany.EU.net!main.Germany.EU.net!EU.net!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [ZMachine] Can the dictionary change?
Message-ID: <erkyrathDz2ILK.G47@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <53it53$hs7@morbius.oit.umass.edu>
Date: Thu, 10 Oct 1996 16:17:44 GMT
Lines: 36
Sender: erkyrath@netcom.netcom.com

Matt Kimmel (kimmel@nic.umass.edu) wrote:
> A quick question about the Z-Machine, the answer to which I can't seem to find 
> in the specs: Is it legal for a Z-Program to change the contents of the 
> dictionary?  In other words, will I get in trouble if I put the entries of the 
> main dictionary (and additional dictionaries, as they're referenced) into a 
> hash table or some such data structure at start time to speed up input 
> tokenizing?

I strongly suspect (without looking at the code) that non-main 
dictionaries change during play, and that this is how (for example) 
Beyond Zork implements naming things.

I'd be suspicious of assuming that the main dictionary is static, too. 
Current interpreters look at the dictionary in memory every time. If you 
write one that doesn't, it's just asking for trouble.

I guess you could watch all writes to memory, and set a dirty bit every 
time the game writes within the dictionary, and rehash whenever the dirty 
bit is set....

More to the point, this is a very small speed increase you're talking
about. One to four words get looked up every user input, *rarely* more
than that. That's *utterly* unnoticeable. Compare it to the amount of
processing the Inform libraries go through in a scope search, which
happens a handful of times each user input, and which is written in Inform
rather than the machine's native language. 

By far the slowest part of Z-machine operation is... scrolling. Improve 
that and you'll have users drooling on your shoes.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
