Benchmarking Codable

1 · Mattt · May 1, 2018, midnight
Swift Codable can automatically synthesize initializers that decode models from JSON. But how does this generated code compare to what it replaces? To find out, let’s benchmark the performance of JSONDecoder against equivalent hand-written code that uses JSONSerialization instead. #Defining a Sample Model In order to establish a baseline, we’ll create a model that reasonably approximates ...