nicklockwood/FastCoding
FreeA faster and more flexible binary file format replacement for NSCoding, Property Lists and JSON
About nicklockwood/FastCoding
FastCoder is a high-performance binary serialization format for Cocoa objects and object graphs, designed as a replacement for NSPropertyList, NSJSONSerializer, NSKeyedArchiver/Unarchiver, and Core Data. It offers faster read performance than any built-in serialization mechanism in Cocoa and faster write performance than any except JSON, while producing smaller file sizes than NSKeyedArchiver. FastCoder supports more data types than JSON or Plist, including NSURL, NSValue, NSSet, and NSOrderedSet, and allows any supported object type to be used as a dictionary key. It can automatically serialize custom classes via property inspection or via the FastCoding/NSCoding protocols. The library is thread-safe, ARC-compatible (though better performance with ARC disabled), and includes buffer overflow protection for security. It supports iOS 9.0+/macOS 10.10+ and is open source under a permissive license.
Key Features
Pros & Cons
- Faster read performance than NSCoding, NSPropertyList, and NSJSONSerializer
- Supports a wider range of data types than JSON or Plist
- Automatic serialization of custom classes reduces boilerplate code
- Thread-safe and secure against buffer overflow attacks
- Free and open source with a permissive license
- Easy to integrate without additional dependencies or setup
- Best performance requires disabling ARC on FastCoder.m (requires compiler flag)
- Not recommended for loading arbitrary files from untrusted sources due to potential class injection risk
- Limited to Cocoa platforms (iOS/macOS/tvOS/watchOS) due to Objective-C dependency
- Write performance still slower than JSON, which may be preferred for simple data types