freenode/lisp - IRC Chatlog
Search
20:02:34
thijso
I'm looking for a system/library to facilitate kind of a disk-backed memory store. Something that saves the data to disk regularly, but a little loss is acceptable. Is there something like that for Lisp already? Might cl-prevalence be a good fit? Ubiquitous looks kinda like something also, except it's documentation is about persistent _configuration_ storage. Any other suggestions?
20:03:18
thijso
I'm thinking I might just start out with plists (or maybe a hash) and just serialize that to disk with alexandria or something.
20:40:54
thijso
In the case that the id's are strings, is it better to use an eql hash or coerce the strings into keys (with intern)? Or is it basically the same difference? Or third option?
20:45:48
saturn2
interned symbols don't get garbage collected, so don't use them unless you want them to stick around forever
21:34:15
White_Flame
you can manually intern your keys using a separate string->self equal hashtable first, then your main content will have eq strings
21:54:18
thijso
Have a separate hashtable mapping the "string keys" to something else, is that what you mean?
21:55:21
White_Flame
yes, map "foo" => "foo", in a #'EQUAL hashtable. Then when you do (gethash "foo" *table*), it'll return the exact same "foo" string instance, which can be then eq compared in a table, without converting it to a symbol
21:55:49
pjb
That said, it all depends on the speed of the hash function, which should be O(1) fast anyways. So using an equal hash table should not be significantly slower than using an eq hash table.
21:56:53
White_Flame
again, it all depends on where you want the cpu to spend time, if this is an optimization issue
21:57:15
White_Flame
and depending on what you're doing, it might be advantageous to keep the data as a string
22:00:01
thijso
I'll have to look into that map "foo" => "foo" trick later, because it's late here and I'm getting a 'does-not-compute' error in my head atm... ;)
22:28:12
White_Flame
thijso: there may be many string instances of "foo". however, the one that is the value in that hashtable is the "canonical" one. by always looking up your string in that hashtable and only using the value from there (lazily adding to it if the key isn't found), you basically intern your strings to EQ-able instances