Archive for October 13, 2014

Monday, October 13, 2014


Stephen Celis’s SQLite.swift is a pure Swift wrapper for SQLite. There are also several other projects that do this, listed at the bottom of the page. As with JSON, I think database access is a fertile area for case studies about Swift’s type system.

NSCoder, NSArchiver, and NSKeyedArchiver


If I chain 40000 Foo objects together, all NSCoders crash on archiving, keyed or unkeyed, because of stack exhaustion. Surprising!


There are likely very few applications, where it pays off to use NSKeyedArchiver to cache an object graph. It’s neither a compact format, nor a fast coding method. You might be better off just reparsing the source. I parse my templates just about as fast as NSArchiver can unarchive. I can see where the added compression and the lack of need for extra I/O to read included files may give NSArchiver an advantage. NSKeyedArchiver though, just makes everything worse for me.

It looks like FastCoding is subject to the same stack limitation.