What are some possible optimizations for NSDateFormatter's stringFromDate?

回眸只為那壹抹淺笑 提交于 2020-01-05 04:14:20

问题


I am currently profiling my iPhone application start-up in an attempt to get it to start as quickly as possible. In the first 19 seconds of my application being started I call NSDateFormatter's stringFromDate method 6 times with the following format string: @"h:mm a zzz"

The NSDateFormatter instance itself is shared by all calls and I only set the date format once, but those 6 calls to stringFromDate amount to 17.3% of my start-up CPU time.

Note: The dates are dynamic so I can't just save the strings.

Any suggestions as to how I could make this faster?

来源:https://stackoverflow.com/questions/4221732/what-are-some-possible-optimizations-for-nsdateformatters-stringfromdate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!