taoensso / nippy

The fastest serialization library for Clojure
https://www.taoensso.com/nippy
Eclipse Public License 1.0
1.04k stars 60 forks source link

Fast serialization by default for UUIDs and Dates #22

Closed weavejester closed 11 years ago

weavejester commented 11 years ago

I was a little surprised that UUIDs and Date objects fall back to the reader. With the new custom types mechanism in version 2.1 I was easily able to provide some custom serialization (reducing the roundtrip from 2600ms to 75ms!). However, since #uuid and #inst are in Clojure core, perhaps it's also worth including efficient serialization for these types by default?

For reference, this is how I converted the dates (in case it wasn't obvious):

(nippy/extend-freeze java.util.Date 1
  [date out-stream]
  (.writeLong out-stream (.getTime date)))

(nippy/extend-thaw 1
  [in-stream]
  (java.util.Date. (.readLong in-stream)))

Would you be interested in a pull request to implement binary serialization for both java.util.Date and java.util.UUID?

ptaoussanis commented 11 years ago

Would you be interested in a pull request to implement binary serialization for both java.util.Date and java.util.UUID?

Hi James, absolutely interested. Thanks a lot!