msgpack-swift

2.0.6

An efficient, full-featured, and compliant MessagePack implementation for Swift. / msgpack.org[Swift]
fumoboy007/msgpack-swift

What's New

2.0.6

2024-06-23T09:05:53Z

Full Changelog: 2.0.5...2.0.6

msgpack-swift

An efficient, full-featured, and compliant MessagePack implementation for Swift.

Swift 5.9 Linux, visionOS 1, macOS 13, iOS 16, tvOS 16, watchOS 9 MIT License Automated Tests Workflow Status

Basic Usage

import MessagePack

struct MyMessage: Codable {
   // ...
}
let myMessage = MyMessage(
   // ...
)

// Serialization
let encoder = MessagePackEncoder()
let serializedMessage = try encoder.encode(myMessage)

// Deserialization
let decoder = MessagePackDecoder()
let deserializedMessage = try decoder.decode(MyMessage.self, from: serializedMessage)

See the documentation for examples of more advanced use cases.

Features

  • Full integration with Swift’s Codable serialization system.
  • Support for standard Foundation value types such as Date, URL, Data, and Decimal.
  • Support for MessagePack extension types like timestamp and application-specific extension types.
  • Automated tests verify compliance with the MessagePack specification by testing against the msgpack-c reference implementation.
  • Highly optimized for performance.

Compared to the Competition

(As of September 2023.)

Functionality

Other Library Remarks
nnabeyang/swift-msgpack ⚠️ No tailored support for Date, URL, or Decimal.
hirotakan/MessagePacker ⚠️ Does not support complex nested container setups.
⚠️ Missing some validation logic.
⚠️ No tailored support for Decimal.
Flight-School/MessagePack ⚠️ Does not support complex nested container setups.
⚠️ Does not have a timestamp type to preserve precision.
⚠️ No tailored support for URL or Decimal.
⚠️ Does not support application-specific MessagePack extension types.
swiftstack/messagepack ❌ Timestamp type is not Codable.
malcommac/SwiftMsgPack ❌ Does not support Codable.
a2/MessagePack.swift ❌ Does not support Codable.
michael-yuji/YSMessagePack ❌ Does not support Codable.
briandw/SwiftPack ❌ Does not have a Swift package manifest.

Performance

Other Library Compared to This Library
nnabeyang/swift-msgpack Up to 3× slower.
hirotakan/MessagePacker Up to 2× slower.
Flight-School/MessagePack Up to 6× slower.

Tested using real-world messages that are involved in high throughput or low latency use cases. Pull requests to Benchmarks.swift are welcome if you know of similar use cases!

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Fri Nov 01 2024 23:22:02 GMT-0900 (Hawaii-Aleutian Daylight Time)