Fast file access?

Fast file access?
0.0 0


I have started a new project, and would like to load/save a small amount of data a few times per second, give or take. I only need to load or save about 20-30 float values, but it has to happen often and fast. Long story as to why. I attempted to use the built in XML writer/reader, but I am not able to get the speed I am looking for. I dont “honestly” believe this task is going to be possible, but I figured I would ask the question, before giving up. Does anyone have a suggestion? Thanks!

Target platforms are iOS and android…


you can try using sqlite.
I would have suggested CCUserDefaults, but it seems to be not working in the current build.


The CCUserDefault android issue has just been fixed.
but I think it’s using XML and could be relatively slow in your case.

How about storing the data in memory, and regularly writing to a persistence storage?


iOS use a separate thread to save the data, but it may be too complex for cocos2d-x to implement it.
And I think, the programe will not save/load it frequently.


Thanks. That was kind of my thoughts, and after some experimentation I have decided to do things another way… Read/write access is WAY to slow on iOS to do what I want to do either with core data, or cocos2-x. Thanks for the ideas though. :slight_smile: