I have a case class with a List[Long] attribute that I am converting into a token using the Scodec library. Right now, it is not efficient (space-wise) because I am using this codec:
listOfN(uint16, int64)
This is using all 64 bits even though my Longs are never more than a few thousand (as of now). Is there a built-in way in Scodec library to use only as many bits as absolutely needed?
Thanks
If your long values are non-negative, try using the
vpbcd
codec:This encodes using variable length packed binary-coded decimal format.