Loading saved world slow?
Posted: Tue Jul 02, 2013 1:59 pm
I'm using the Cocos2d sample loader for saving a world, and reloading it. The code is straightforward:
This works fine, but I'm noticing that when I have many bodies in the world (maybe over 50) it slows down, even considerably, and can take several seconds to reload.
Is there any rule of thumb for doing this right? Is it related to the size of the images? Anything else I should look for? Going over my code I can't see anything obvious, like calling it several times or something like that. It all looks clean. But slow
Code: Select all
-(void) loadSavedFile: (id) sender {
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *fileName = [NSString stringWithFormat:@"%@/newWorld.json", documentsDirectory];
[super loadWorld:nil andJsonFile:fileName];
}
Is there any rule of thumb for doing this right? Is it related to the size of the images? Anything else I should look for? Going over my code I can't see anything obvious, like calling it several times or something like that. It all looks clean. But slow
