Skip to content

Commit 9c4ac35

Browse files
JoeOsbornLibretroAdmin
authored andcommitted
Increase save state chunk size for all platforms
A rationale is given in the comments, but even a class 6 or class 10 SD card can handle reads and writes on the order of MB/s, which means a 4KB chunk size is just wasting time in syscalls. This could maybe be fixed with a buffering reader but I don't feel comfortable tweaking libretro-common's VFS to handle that. Instead, I thought it would be good to both remove an ifdef and increase the chunk size to 128KB. For cores with small states this will should make state saving virtually instantaneous, and for cores with large states it should be a 32x speedup.
1 parent 3a56b73 commit 9c4ac35

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tasks/task_save.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@
5353
/* Filesystem is in-memory anyway, use huge chunks since each
5454
read/write is a possible suspend to JS code */
5555
#define SAVE_STATE_CHUNK 4096 * 4096
56-
#elif defined(HAVE_LIBNX) || defined(_3DS)
57-
#define SAVE_STATE_CHUNK 4096 * 10
5856
#else
59-
#define SAVE_STATE_CHUNK 4096
57+
/* A low common denominator write chunk size. On a slow
58+
(speed class 6) SD card, we can write 6MB/s. That gives us
59+
roughly 100KB/frame, which is rounded up to 128 KB/s.
60+
This means we can write savestates with one syscall for cores
61+
with less than 128KB of state. Class 10 is the standard now
62+
even for lousy cards and supports 10MB/s, so you may prefer
63+
to double this. */
64+
#define SAVE_STATE_CHUNK 128 * 1024
6065
#endif
6166

6267
#define RASTATE_VERSION 1

0 commit comments

Comments
 (0)