Skip to content

INTERNALS: KalDate v. NSDate

klazuka edited this page Sep 13, 2010 · 1 revision

Kal uses 2 date representations internally: KalDate and NSDate. Originally, Kal only used NSDate values, but through some profiling in Shark, I found that methods like +[NSDate dateFromComponents:] and -[NSCalendar components:fromDate:] are very expensive on the older iPhone and iPod Touch hardware. Since Kal was calling these methods at least once for each visible date, performance was adversely affected. So I introduced KalDate, which allowed me to reduce these expensive method calls to a minimum.

Kal is designed such that the external interface only exposes NSDate values, never KalDate values. This makes life simpler for clients of the Kal API.