The Swift team has started to work on a new open-source implementation of the Foundation framework. To be written entirely in Swift, the new Foundation aims to improve performance by getting rid of conversion costs between Objective-C and Swift as well as to provide the opportunity for modularizing and clean it up.
With a native Swift implementation of Foundation, the framework no longer pays conversion costs between C and Swift, resulting in faster performance.
As Apple engineer Tony Parker explained on Swift forum, the performance benefit can be significant:
A reimplementation of Calendar in Swift is 1.5x to 18x as fast as the C one (calling from Swift in various synthetic benchmarks like creation, date calculation).
The Foundation framework is a cornerstone of most macOS and iOS apps, providing a large number of ubiquitous abstractions, including NSObject
, NSString
, NSArray
and NSDictionary
, and many more.
Originally written in Objective-C, and lar