在Objective-C中创建文件

在Objective-C中创建文件,objective-c,cocoa-touch,file,nsdata,nsfilemanager,Objective C,Cocoa Touch,File,Nsdata,Nsfilemanager,这两种情况中哪一种创建文件更快 Case 1: ====== NSData *data = [Some data]; [data writeToFile:filePath atomically:YES]; Case 2: ======= NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager createFileAtPath:filePath contents:data attributes:nil]

这两种情况中哪一种创建文件更快

Case 1:
======
NSData *data = [Some data];
[data writeToFile:filePath atomically:YES];

Case 2:
=======
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager createFileAtPath:filePath  contents:data attributes:nil];
谢谢
比兰奇。

你为什么要担心这个。。。你会经常写数据吗。。以每秒60帧的速度?。。或60 SP(每秒存储):D


使用上面的任何一个

找到答案的最佳方法是自己测试。也就是说,第二个(包含
内容:nil
)更有意义。