Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String array deserialization #178

Open
KGOH opened this issue Jun 20, 2024 · 4 comments
Open

String array deserialization #178

KGOH opened this issue Jun 20, 2024 · 4 comments
Milestone

Comments

@KGOH
Copy link

KGOH commented Jun 20, 2024

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

@ptaoussanis ptaoussanis added this to the vNext milestone Jun 20, 2024
@ptaoussanis
Copy link
Member

@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.

@ptaoussanis
Copy link
Member

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 👍

@KGOH
Copy link
Author

KGOH commented Oct 29, 2024

@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?

@ptaoussanis
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants