Monday, August 25, 2014

FastCoding

Nick Lockwood:

FastCoder is a high-performance binary serialization format for Cocoa objects and object graphs. It is intended as a replacement for NSPropertyList, NSJSONSerializer, NSKeyedArchiver/Unarchiver and Core Data.

The design goals of the FastCoder library are to be fast, flexible and secure.

FastCoder is already faster (on average) for reading than any of the built-in serialization mechanisms in Cocoa, and is faster for writing than any mechanism except for JSON (which doesn’t support arbitrary object types). File size is smaller than NSKeyedArchiver, and comparable to the other methods.

This is potentially very useful because NSArchiver is essentially deprecated and NSKeyedArchiver is much slower and produces larger files. Binary property lists are decently fast but don’t support objects or references.

The API looks nice, except that I wish it used NSError rather than exceptions. It’s compatible with ARC, but he recommends compiling with -fno-objc-arc for better performance. This, despite lots of __unsafe_unretained annotations in the code.

Update (2014-09-03): Version 3 of FastCoding has a new file format that’s faster and smaller.

Comments RSS · Twitter

Leave a Comment