msg00626.html

1999Q1/msg00626.html · 9.5 KB

From the archive 1999Q1.zip

Download the archive   « Back to the archive contents

<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Naming and Directories? -->
<!--X-From-R13: Vnaf&#45;Vraevx Egnresryqg <uufNpof.qgh.qx> -->
<!--X-Date: Tue, 16 Mar 1999 18:48:46 &#45;0800 -->
<!--X-Message-Id: Pine.SGI.3.95.990317104226.7759A&#45;100000#genome,cbs.dtu.dk -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199903170846.CAA09676@dfw&#45;ix7.ix.netcom.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Naming and Directories?</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:hhs#cbs,dtu.dk">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00625.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00627.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00625.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00628.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00626">Author</A>
&nbsp;|&nbsp;<A HREF="#00626">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00626">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Naming and Directories?</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Naming and Directories?</LI>
<LI><em>From</em>: Hans-Henrik Staerfeldt &lt;<A HREF="mailto:hhs#cbs,dtu.dk">hhs#cbs,dtu.dk</A>&gt;</LI>
<LI><em>Date</em>: Wed, 17 Mar 1999 11:28:42 +0100 (MET)</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Wed, 17 Mar 1999, Jon A. Lambert wrote:

&gt; On 16 Mar 99, Mik Clarke wrote:
&gt; &gt; Ummm. Yick. 26 4 byte pointers by, say 16 characters long just to index 100-200 names?
&gt; &gt; Even with a sensible implementation you're going to end up wasting 90% of the storage you
&gt; &gt; allocate (and a ten letter name means you have to allocate 1K pointers, each different
&gt; &gt; name then requires another 900 bytes or so).
&gt; 
&gt; But you have changed your requirements above from speed to memory. 
&gt; No fair. ;)
&gt; 
&gt; The alphabet trie above has some pros and cons:
&gt; 
&gt; 1) avoids the overhead of string hashing 
&gt; 2) provides intrinsic support for abbreviations
&gt; 
&gt; 1) based on English and may not support blanks, puntuation, or other 
&gt; characters   (of course this can be altered or enforced)
&gt; 2) distribution of names may tend to cluster in certain nodes 
&gt; 

Some additional pros and cons on a search trie (for large problems) are:

pro : distribution of names may tend to cluster in certain nodes
 its a pro, because storing names with the same prefix does not make the
 trie grow linearly with name length, so storing "green bottle" and 
 "green dragon" would require the same space for "green ", only "bottle"
 and "dragon" would be distinct.

pro : for the large _static_ case, you can easily store the trie on disk,
 using file pointers instead of memory pointers. I did this for lookups 
 in a large genetic database (Genbank, size ~11 Gb) with much success, 
 the trie (of ~3 million keywords) taking up 82Mb. Note that since
 the namespace is well filled (or clustered), the memory usage is about 
 30 bytes pr. word, since the trie 'reuses' the common prefixes (words 
 are approx 6-10 characters long). (the trie is a bit compressed, so 
 lookup actually takes O(m * sigma), m being the keyword length, with 
 O(m) disk reads.)

con : it _also_ takes time to insert/delete entries in the trie, so
 you may get another drag on load, as you ease lookup time. You really
 should only use a trie (compared to linear search), if 
 #lookups*#objects &gt; #movements*sizeof(names) for the locality in 
 which you use the trie. Most usefull, will probably be to apply it to 
 global lookups only, since 'movement' here is limited to 
 creation / deletion. 


Some optimizations i have heard about (but not trie-d):

memory saver: Instead of a full 26 letter alfabet, you could 
 cluster individual letters, say 'ab' 'cd' ... such that the number of 
 pointers is reduced, making a (small)hash or linear search in the end
 (of a greatly reduced number of objects) to see which actually match.

As mentioned earlier (i forget who *blush*): compressing the trie (long 
 chains that does not branch) is a sure memory saver.
 
Another compression is possible (it has some girls name): if some (any)
 subtree of the trie is fully 'filled', say f.inst. that the 4 letter 
 prefixes of your used names covers all combinations, then you can 
 compress this to a simple list, doing direct lookup, instead of 4 
 lookups.


Hans Henrik Stærfeldt         |  
email: bombman#diku,dk        |  voice:      +45 40383492 
  hhs#cbs,dtu.dk              |  voice work: +45 45252425
phone-mail:                   |  address:
  40383492#sms,tdm.dk         |       Hans Henrik Stærfeldt,
WWW-home                      |       Dybendalsvej 74 2. th,
  <A  HREF="http://www.cbs.dtu.dk/hhs/">http://www.cbs.dtu.dk/hhs/</A>  |       2720 Vanløse, Danmark.
                              |
Student of Computer Science   | Scientific programmer at Center for
  and Information Psychology. |   Biological Sequence Analysis,
  at University of Copenhagen |   Technical University of Denmark.




_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00625" HREF="msg00625.html">Re: [MUD-Dev] Naming and Directories?</A></STRONG>
<UL><LI><EM>From:</EM> "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00625.html">Re: [MUD-Dev] Naming and Directories?</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00627.html">Re: [MUD-Dev] Re: pet peeves</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00625.html">Re: [MUD-Dev] Naming and Directories?</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00628.html">Re: [MUD-Dev] Naming and Directories?</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00626"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00626"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] Naming and Directories?</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00594" HREF="msg00594.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Nathan F Yospe <a href="mailto:yospe#hawaii,edu">yospe#hawaii,edu</a>, Mon 15 Mar 1999, 15:37 GMT
</LI>
</ul>
</ul>
<LI><strong><A NAME="00607" HREF="msg00607.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Mik Clarke <a href="mailto:mikclrk#ibm,net">mikclrk#ibm,net</a>, Tue 16 Mar 1999, 12:27 GMT
<UL>
<LI><strong><A NAME="00613" HREF="msg00613.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Mark Gritter <a href="mailto:mark#erdos,Stanford.EDU">mark#erdos,Stanford.EDU</a>, Tue 16 Mar 1999, 13:46 GMT
</LI>
<LI><strong><A NAME="00625" HREF="msg00625.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Wed 17 Mar 1999, 00:54 GMT
<UL>
<LI><strong><A NAME="00626" HREF="msg00626.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Hans-Henrik Staerfeldt <a href="mailto:hhs#cbs,dtu.dk">hhs#cbs,dtu.dk</a>, Wed 17 Mar 1999, 02:48 GMT
</LI>
<LI><strong><A NAME="00628" HREF="msg00628.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Wed 17 Mar 1999, 08:43 GMT
<UL>
<LI><strong><A NAME="00638" HREF="msg00638.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Mark Gritter <a href="mailto:mark#erdos,Stanford.EDU">mark#erdos,Stanford.EDU</a>, Wed 17 Mar 1999, 18:03 GMT
<UL>
<LI><strong><A NAME="00652" HREF="msg00652.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Thu 18 Mar 1999, 17:54 GMT
<UL>
<LI><strong><A NAME="00656" HREF="msg00656.html">Re: [MUD-Dev] Naming and Directories?</A></strong>, 
Mark Gritter <a href="mailto:mark#erdos,Stanford.EDU">mark#erdos,Stanford.EDU</a>, Thu 18 Mar 1999, 18:58 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>

Site Stats

Snippets: 1791
Codebases: 571