From: Doug B. <dou...@ya...> - 2005-10-21 16:28:10
|
John: --- John Tromp <Joh...@cw...> wrote: > dear Judy developers, > > first of all a big thanks to your wonderful efforts > that have put high performance memory efficient trees within > easy reach. Thanks. > > i have used Judy to great effect in computing the > Number of legal Go positions, as you can see at > > http://www.cwi.nl/~tromp/go/legal.html A little beyond me, I never played go. > > My keys and values are both naturally 64 bit integers, so > JudyL is a perfect fit. I take it for 64 bit machine only. > However, I'd love to run the same code on some 32-bit servers. > With a long long declaration, you can get 64 bit values on such > machines, even though pointers remain 32 bits. > Is it possible to make a version of Judy that runs on 32 bit machines > while providing the 64 bit long long interface? Realistically, No. But if you use JudyHS(), the keys are an arbitrary number of bytes in length (so 64 bit keys would be 8 bytes). The values can be a pointer to an "array" of 8 bytes. However, in a 64 bit machine that would be a waste of a little memory (because the value and pointer are 8 bytes). It may be a bit tricky getting code to work on both big and little endian machines. (see below). I suggest using JudyHS, if you do not need the "neighbor" search (I.E. JudyLNext() and JudyLCount()) capability. > > I think it should be possible in principle, although perhaps a huge > undertaking, as Judy probably makes the assumption that pointer size > equals long size. I wouldn't mind even if this version wastes > space by using 64 bit pointers with the upper 32 bits all 0. I wrote JudyHS() for people that want larger than 32 bit keys. Performance (memory and speed) is still very good. But you open up pandora's box when casting a "long" to a "char array" when the machine can be either big or little endian. As I recall, JudyHS solves the problem by always moving the "long" to a byte array one byte at a time and vise-versa. Modern machines do this amazingly quickly. I hope this helps. Doug Baskins > > regards, > > %!PS % -John Tromp (http://www.cwi.nl/~tromp/) > 42 42 scale 7 9 translate .07 setlinewidth .5 setgray/c{arc clip fill > setgray}def 1 0 0 42 1 0 c 0 1 1{0 3 3 90 270 arc 0 0 6 0 -3 3 90 270 > arcn 270 90 c -2 2 4{-6 moveto 0 12 rlineto}for -5 2 5{-3 exch moveto > 9 0 rlineto}for stroke 0 0 3 1 1 0 c 180 rotate initclip}for showpage > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, > discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Judy-devel mailing list > Jud...@li... > https://lists.sourceforge.net/lists/listinfo/judy-devel > Doug Baskins <dou...@ya...> |