Program Efficiency
Program Efficiency
- Subject: Program Efficiency
- From: Erik Thorteran <email@hidden>
- Date: Tue, 5 Jun 2001 20:03:40 -0700
Which of the following snippets of code will execute faster?
Snippet one:
[[NSDictionary dictionaryWithObjectsAndKeys:[[NSBundle mainBundle]
bundlePath],@"path,etc, etc.] writeToFile:@"Wherever" atomically:YES]
Snippet two:
NSMutableDictionary *dict;
dict=[[NSMutableDictionary alloc] init];
[dict setObject:[[NSBundle mainBundle] bundlePath] forKey:@"path"];
[dict setObject:continue forKey:@"irrelevant"];
etc. etc.
[dict writeToFile:@"Wherever" atomically:YES];
Basically, is it more efficient to pack everything into one line, or
multiple lines, or dies it not matter?
Erik Thorteran