Fork me on GitHub
#datomic
<
2024-05-09
>
jasonjckn19:05:41

are db.type/keywords more memory efficient for datomic indexes ? or i’m wondering if strings get interned too either at JVM level or otherwise . I think the value i want to represent in datomic is compliant with clojure keyword syntax , but only 95% certain about it and want some reason to justify that risk over using db.type/string

favila21:05:24

Because of fressian caching there’s little to no difference on-disk, and repeated runs of any value in a segment will likely (but not guaranteed) be the same object instance either way

👍 2
favila21:05:19

unless these are actual dev-entered code literals I would stick to strings

favila21:05:47

Do you know about Jvm string deduplication?

👍 1
1
favila21:05:18

It’s a Jvm option some gcs provide

👍 1
ghadi21:05:01

in-memory keywords are always interned (e.g. always a single instance for the same keyword)

ghadi21:05:42

strings are not - and jvm string deduplication has costs comparable to those of keyword interning

ghadi21:05:04

(but string dedup has poor interaction with gc, IIRC)

1