String array deserialization
KGOH opened this issue ยท 4 comments
Please add [Ljava.lang.String;
class to the deserialization list
Array of strings serializes more compact
(count (nippy/fast-freeze (into-array String (repeat 1000 "hello")))) #_5071
(count (nippy/fast-freeze (object-array (repeat 1000 "hello")))) #_7005
@KGOH Hi there! Sure, will add this (and maybe long arrays) in the next release ๐
In the meantime, please note that you might want to avoid fast-freeze
if you're concerned about compactness since it skips compression.
v3.5.0 will add read support for native arrays of strings, longs, ints, doubles, and floats.
v3.6.0 will follow shortly after to add write support ๐
@ptaoussanis I briefly glanced at your commits and the class name handling looks good, but just in case: in Clojure 1.12 a new array class syntax was added:
https://clojure.org/news/2024/09/05/clojure-1-12-0#_2_7_array_class_syntax
(= (Class/forName "[Ljava.lang.String;")
java.lang.String/1) #_true
And out of curiosity: as a library developer, do you stick with older Clojure versions to support more projects, or do you always update to the latest version?
@KGOH Thanks for checking in about this ๐ The new syntax is nice, but I do intentionally keep compatibility with at least the last 3 major version of Clojure.
In practice this usually isn't a problem since there's rarely anything super important in newer versions - and it's often possible to use the new stuff conditioned on its availability.
Nippy's unit tests currently check against Clojure 1.9, 1.10, 1.11, and 1.12.