·············@gmail.com" <············@gmail.com> writes:
> Hi,
>
> is it a good practice to use packages to intern strings in a program?
> Or should one use a hash table instead?
If you don't need any of the special facilities provided by packages,
I think it'd be clearer to use a hashtable and an INTERN-WHATEVER
function. Also you can't make an anonymous package so if you use a
package you'll have the problem of what to name it.
-Peter
--
Peter Seibel ·····@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
············@gmail.com wrote:
> Hi,
>
> is it a good practice to use packages to intern strings in a program?
> Or should one use a hash table instead?
>
It depends on the application.
However, I just had an application where I initially stored strings as
such. It turns out that these strings really are unique identifiers
(Gene Ontology terms, for those who care.) INTERNing them in a package
was a huge win. Far less memory was used and hash table lookups on
these terms used as keys could be done with EQ.
Again, it depends on the application, my case was one where INTERNing
the strings just got me quite an improvement in time and space.
Cheers
--
Marco
>>>>> "MA" == Marco Antoniotti <·······@cs.nyu.edu> writes:
[...]
MA> However, I just had an application where I initially stored
MA> strings as such. It turns out that these strings really are
MA> unique identifiers (Gene Ontology terms, for those who care.)
MA> INTERNing them in a package was a huge win. Far less memory
MA> was used and hash table lookups on these terms used as keys
MA> could be done with EQ. [...]
Hmm, mu immediate thought: just hanging the info keyed off the string
(including a flag for whatever hash table they would have belonged to
in your scheme) from the interned symbol's plist would have worked and
would have saved you the hash table. What am I missing?
cheers,
BM