Writing to INI every step at runtime slows down

For questions about using Classic.

Post » Mon Feb 06, 2012 11:06 am

Could someone explain to me why writing to an INI file every step (adding string) slows down the application significantly, while doing the same thing with a hash table causes almost no change in Framerate?
The string added every step is basically just the number of the .X position of a sprite and a comma.

The Framerate doesn't drop instantly either (testing in Unlimited FPS mode), but after a while. So I thought it might have something to do with the INI file getting too large? And that every consecutive time it needs to search longer for the end-position to to add the next string to.

Thank You in advance.Shindoh2012-02-06 11:11:35
B
3
G
1
Posts: 70
Reputation: 615

Post » Mon Feb 06, 2012 4:05 pm

INI writes to disk, and you should never constantly write to disk like that! It's far too slow to be practical. You should only save to INI once, like at the end of the layout, or when the user clicks save. Hash table is all done in memory so there's no slowdown from going to disk at all.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Tue Feb 07, 2012 10:47 am

[QUOTE=Ashley] INI writes to disk, and you should never constantly write to disk like that! It's far too slow to be practical. You should only save to INI once, like at the end of the layout, or when the user clicks save. Hash table is all done in memory so there's no slowdown from going to disk at all.[/QUOTE]
Thank You, Ashley. Gives me some clues as to what to research next, the difference in disk memory and RAM, and how exactly they work.
B
3
G
1
Posts: 70
Reputation: 615

Post » Wed Feb 08, 2012 7:29 pm

@Ashley, I have a little question with the save to ini thing.
Here's an image from a .cap, I found on the russian construct forum:



How does it exactly work? Couldn't find any file on the folder I've chosen at the start, but it works. I have 2 .cap files for both player. Just couldn't figure out how :P. And it saves every tick the position?
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Wed Feb 08, 2012 9:30 pm

[QUOTE=zyblade]How does it exactly work? Couldn't find any file on the folder I've chosen at the start, but it works. I have 2 .cap files for both player. Just couldn't figure out how :P. And it saves every tick the position?[/QUOTE] The file that is written to, is defined in "Start of layout" as "sety.dat". Yes, it writes to disk on every tick. I wouldn't recommend copying such a method.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Feb 08, 2012 10:18 pm

Couldn't find any "sety" file on my computer. I choose "desktop" for the location. That's the thing I was wondering about. I started both applications, for player 1 and player 2. Selected the same directory and they didn't created the file there.
B
24
S
9
G
2
Posts: 294
Reputation: 3,160


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests