Skip to content

v2.5.0

Closed Aug 23, 2023 100% complete

v2.5.0 is larger than usual. It adds new features, bug fixes, and new contributors. Please review notable changes before upgrading.

Notable Features and Bug Fixes:

  • PR 370: Add SimpleValue type to more fully support CBOR Simple Values, including values not unassigned by IANA and...

  • PR 376: Add ByteString type to support CBOR maps with byte string keys …

v2.5.0 is larger than usual. It adds new features, bug fixes, and new contributors. Please review notable changes before upgrading.

Notable Features and Bug Fixes:

  • PR 370: Add SimpleValue type to more fully support CBOR Simple Values, including values not unassigned by IANA and...

  • PR 376: Add ByteString type to support CBOR maps with byte string keys because Go doesn't allow []byte as map keys and...

  • PR 342: Add DecOptions.UTF8 to decode invalid UTF-8. Default is unchanged (reject invalid UTF-8 and return error).

  • PR 377: Add EncOptions.NilContainersMode to encode nil Go maps and slices as CBOR nil (default) or empty container.

  • PR 381: Add Decoder.Skip() to skip CBOR data item in CBOR Sequences (RFC 8742).

  • PR 379: Make Decoder.Decode() return io.ErrUnexpectedEOF instead of io.EOF on EOF if current CBOR data item is incomplete.

  • PR 380: Make Unmarshal() and Valid() return io.ErrUnexpectedEOF (instead of ignoring extraneous data if any remain).

  • PR 382: Return buffer to pool in Encode(). Some overhead in Encode() for a lot more efficient NewEncoder().Encode().

Benchmarks that use NewEncoder() for each call to Encode() will improved speed and memory. Benchmarks that reuse same Encoder will see some smaller overhead as the tradeoff.

Benchmarks for PR #382

name                                                   old time/op    new time/op    delta
NewEncoderEncode/Go_bool_to_CBOR_bool-20                 128ns ± 2%      39ns ± 3%   -69.25%  (p=0.000 n=9+10)
NewEncoderEncode/Go_uint64_to_CBOR_positive_int-20       135ns ± 2%      42ns ± 1%   -68.81%  (p=0.000 n=10+10)
NewEncoderEncode/Go_int64_to_CBOR_negative_int-20        134ns ± 1%      39ns ± 7%   -70.50%  (p=0.000 n=10+10)
NewEncoderEncode/Go_float64_to_CBOR_float-20             130ns ± 2%      33ns ± 2%   -74.45%  (p=0.000 n=9+10)
NewEncoderEncode/Go_[]uint8_to_CBOR_bytes-20             137ns ± 2%      42ns ± 1%   -69.78%  (p=0.000 n=10+9)
NewEncoderEncode/Go_string_to_CBOR_text-20               135ns ± 1%      40ns ± 2%   -70.43%  (p=0.000 n=10+9)
NewEncoderEncode/Go_[]int_to_CBOR_array-20               304ns ± 1%     197ns ± 0%   -35.29%  (p=0.000 n=10+10)
NewEncoderEncode/Go_map[string]string_to_CBOR_map-20    1.08µs ± 1%    1.01µs ± 1%    -7.22%  (p=0.000 n=9+9)

name                                                   old alloc/op   new alloc/op   delta
NewEncoderEncode/Go_bool_to_CBOR_bool-20                  128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_uint64_to_CBOR_positive_int-20        128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_int64_to_CBOR_negative_int-20         128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_float64_to_CBOR_float-20              128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_[]uint8_to_CBOR_bytes-20              128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_string_to_CBOR_text-20                128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_[]int_to_CBOR_array-20                128B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_map[string]string_to_CBOR_map-20      544B ± 0%      416B ± 0%   -23.53%  (p=0.000 n=10+10)

name                                                   old allocs/op  new allocs/op  delta
NewEncoderEncode/Go_bool_to_CBOR_bool-20                  2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_uint64_to_CBOR_positive_int-20        2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_int64_to_CBOR_negative_int-20         2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_float64_to_CBOR_float-20              2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_[]uint8_to_CBOR_bytes-20              2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_string_to_CBOR_text-20                2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_[]int_to_CBOR_array-20                2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
NewEncoderEncode/Go_map[string]string_to_CBOR_map-20      28.0 ± 0%      26.0 ± 0%    -7.14%  (p=0.000 n=10+10)

This milestone is closed.

No open issues remain. View closed issues or see open milestones in this repository.