This chapter provides information about the CTR-SDK file system (FS).
It summarizes how performance is improved or degraded depending on how the CTR-SDK FS library is used. This chapter is mainly based on measurements taken using CTR-SDK 4.x, but the differences in subsequent versions are minimal.
For benchmark results and other detailed data, see Section 8.7. FS Library Performance Details.
6.1. ROM Archive
This section describes the access rates to ROM archives when using development cards (CTR flash cards) or CARD2.
6.1.1. Batch Read
Due to CTR flash card and CARD2 characteristics, batch reading of data in the ROM archives is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
6.1.2. Stream Reads
As described in Section 6.1.1. Batch Read, when reading files in the ROM archives, the most effective stream reading is performed with a buffer size of 512 KB or more. Performance decreases when batch reading in a buffer size of 256 KB or less.
6.2. Save Data
This section describes the access rates to the backup region measured with development cards (CTR flash cards) or CARD2.
Note:
Access speeds for save data improve when using CARD2. Specifically, read operations improve by approximately five times and write operations improve by approximately 30 times.
6.2.1. Reading
There are no large differences for batch reads of save data in the backup region due to the data size.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
6.2.2. Writing
For writing save data to the backup region, because efficiency is poor when the file is very small, access rates decrease when the size is 32 KB or less.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
When the application supports the auto-save feature, because the time when processing can be performed until the power is disconnected, Nintendo recommends not using save data of a large size.
6.2.3. Mounting
When formatting, mounting, and unmounting the backup region, it takes much more processing time to format a backup region when data has been written to it than when the backup region is in the factory state. The time it takes to format the region also depends on the amount of data written.
6.2.4. Deleting Files
The average time required for file deletion is 658.566 ms without automatic redundancy and 1.465 ms with automatic redundancy.
6.3. Extended Save Data
This section describes the access speeds for accessing the extended save data region on media having the same specifications and capacity as the SD Card packaged with the CTR system.
6.3.1. Mounting
The average processing times for mounting, deleting, creating, remounting, and unmounting expanded save data are 40.844 ms (mounting), 105.296 ms (deleting), 2346.382 ms (creating), 38.256 ms (remounting), and 1.842 ms (unmounting), respectively.
6.3.2. Creating Files
The average processing time to create a file on expanded save data is 766.200 ms.
6.3.3. Reading Files
For batch reading files on expanded save data, because efficiency is poor when the file is very small, performance decreases when the size is 256 KB or less.
6.3.4. Writing Files
For writing files to expanded save data, speeds tend to increase as the data size increases.
6.3.5. Deleting Files
The average processing time to delete a file from expanded save data is 196.322 ms.
6.4. ROM Archives (Downloadable Applications)
This section describes the access speeds for accessing a downloadable application’s ROM archives on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.4.1. Batch Reading
Batch reading is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
6.4.2. Stream Reads
Stream reading of files is most effective with a buffer size of 512 KB or more, similar to the characteristics described in Section 6.4.1. Batch Read. Performance decreases when batch reading in a buffer size of 256 KB or less.
6.5. Save Data (Downloadable Applications)
This section describes the access speeds for accessing a downloadable application's backup region on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.5.1. Reading
For batch read operations of save data written to the backup region of a downloadable application, performance decreases for data of 32 KB or less.
6.5.2. Writing
For writing save data to the backup region of a downloadable application, speeds tend to increase as the data size increases.
6.5.3. Mounting
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
6.5.4. Deleting Files
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
6.6. Flushing File Write Operations (Important)
We recommend flushing file write operations after writing the entire file has completed.
The time required to write files of the same size may be significantly longer in the case of an implementation in which flushing is performed at the same time as writing compared to an implementation in which flushing is performed after the entire file has been written. The difference in execution time grows larger as the amount of data written per function call becomes smaller, resulting in a difference several times larger depending on the total size.
If true
is specified in the argument flush
when using TryWrite
, flushing is performed while writing. However, note that if false
is specified in flush
, flushing is not performed unless explicitly carried out using TryFlush
or a similar function.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, true);
restSize -= writeSize;
}
Performance when writing files may be improved by making the following changes.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
// Do not flush while writing the file by specifying false for the fourth argument
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, false);
restSize -= writeSize;
}
// Flush after writing the entire file is complete
fileStream.TryFlush();
Making these changes when writing to an SD Card-equivalent product packaged with the system increases performance by about nine times (improving total write time from 11.717 seconds to 1.290 seconds) when writing two files of size 352 KB and 192 KB, respectively, and using a BUFFER_SIZE
of 8 KB.
Note:
These performance figures were measured under conditions of normal access priority (PRIORITY_APP_NORMAL
).
6.7. Performance of SD Cards Packaged With the System (Important)
The SD cards that are currently packaged with systems for resale are supplied by multiple manufacturers. This means that the systems on the market include media with different levels of performance.
The media from manufacturers that were added after the launch of the Nintendo 3DS have better performance than the media packaged at launch when writing to random locations and when writing small files. On the other hand, performance is slightly worse when writing files that are several megabytes in size directly to the SD Card. There is no significant difference in performance in terms of reading data.
Use media packaged with development hardware when debugging applications. Although the same media as packaged with development hardware in the past will continue to be used, media having different performance from conventional media may be included with development hardware in the future. If this happens, use the media packaged with the development hardware, rather than the old media.
This section describes the access rates to ROM archives when using development cards (CTR flash cards) or CARD2.
6.1.1. Batch Read
Due to CTR flash card and CARD2 characteristics, batch reading of data in the ROM archives is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
6.1.2. Stream Reads
As described in Section 6.1.1. Batch Read, when reading files in the ROM archives, the most effective stream reading is performed with a buffer size of 512 KB or more. Performance decreases when batch reading in a buffer size of 256 KB or less.
Due to CTR flash card and CARD2 characteristics, batch reading of data in the ROM archives is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
As described in Section 6.1.1. Batch Read, when reading files in the ROM archives, the most effective stream reading is performed with a buffer size of 512 KB or more. Performance decreases when batch reading in a buffer size of 256 KB or less.
This section describes the access rates to the backup region measured with development cards (CTR flash cards) or CARD2.
Access speeds for save data improve when using CARD2. Specifically, read operations improve by approximately five times and write operations improve by approximately 30 times.
6.2.1. Reading
There are no large differences for batch reads of save data in the backup region due to the data size.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
6.2.2. Writing
For writing save data to the backup region, because efficiency is poor when the file is very small, access rates decrease when the size is 32 KB or less.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
When the application supports the auto-save feature, because the time when processing can be performed until the power is disconnected, Nintendo recommends not using save data of a large size.
6.2.3. Mounting
When formatting, mounting, and unmounting the backup region, it takes much more processing time to format a backup region when data has been written to it than when the backup region is in the factory state. The time it takes to format the region also depends on the amount of data written.
6.2.4. Deleting Files
The average time required for file deletion is 658.566 ms without automatic redundancy and 1.465 ms with automatic redundancy.
There are no large differences for batch reads of save data in the backup region due to the data size.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
For writing save data to the backup region, because efficiency is poor when the file is very small, access rates decrease when the size is 32 KB or less.
For CARD2, because efficiency is poor when the file is very small, access rates decrease when the size is 128 KB or less.
When the application supports the auto-save feature, because the time when processing can be performed until the power is disconnected, Nintendo recommends not using save data of a large size.
6.2.3. Mounting
When formatting, mounting, and unmounting the backup region, it takes much more processing time to format a backup region when data has been written to it than when the backup region is in the factory state. The time it takes to format the region also depends on the amount of data written.
6.2.4. Deleting Files
The average time required for file deletion is 658.566 ms without automatic redundancy and 1.465 ms with automatic redundancy.
When formatting, mounting, and unmounting the backup region, it takes much more processing time to format a backup region when data has been written to it than when the backup region is in the factory state. The time it takes to format the region also depends on the amount of data written.
The average time required for file deletion is 658.566 ms without automatic redundancy and 1.465 ms with automatic redundancy.
6.3. Extended Save Data
This section describes the access speeds for accessing the extended save data region on media having the same specifications and capacity as the SD Card packaged with the CTR system.
6.3.1. Mounting
The average processing times for mounting, deleting, creating, remounting, and unmounting expanded save data are 40.844 ms (mounting), 105.296 ms (deleting), 2346.382 ms (creating), 38.256 ms (remounting), and 1.842 ms (unmounting), respectively.
6.3.2. Creating Files
The average processing time to create a file on expanded save data is 766.200 ms.
6.3.3. Reading Files
For batch reading files on expanded save data, because efficiency is poor when the file is very small, performance decreases when the size is 256 KB or less.
6.3.4. Writing Files
For writing files to expanded save data, speeds tend to increase as the data size increases.
6.3.5. Deleting Files
The average processing time to delete a file from expanded save data is 196.322 ms.
6.4. ROM Archives (Downloadable Applications)
This section describes the access speeds for accessing a downloadable application’s ROM archives on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.4.1. Batch Reading
Batch reading is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
6.4.2. Stream Reads
Stream reading of files is most effective with a buffer size of 512 KB or more, similar to the characteristics described in Section 6.4.1. Batch Read. Performance decreases when batch reading in a buffer size of 256 KB or less.
6.5. Save Data (Downloadable Applications)
This section describes the access speeds for accessing a downloadable application's backup region on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.5.1. Reading
For batch read operations of save data written to the backup region of a downloadable application, performance decreases for data of 32 KB or less.
6.5.2. Writing
For writing save data to the backup region of a downloadable application, speeds tend to increase as the data size increases.
6.5.3. Mounting
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
6.5.4. Deleting Files
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
6.6. Flushing File Write Operations (Important)
We recommend flushing file write operations after writing the entire file has completed.
The time required to write files of the same size may be significantly longer in the case of an implementation in which flushing is performed at the same time as writing compared to an implementation in which flushing is performed after the entire file has been written. The difference in execution time grows larger as the amount of data written per function call becomes smaller, resulting in a difference several times larger depending on the total size.
If true
is specified in the argument flush
when using TryWrite
, flushing is performed while writing. However, note that if false
is specified in flush
, flushing is not performed unless explicitly carried out using TryFlush
or a similar function.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, true);
restSize -= writeSize;
}
Performance when writing files may be improved by making the following changes.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
// Do not flush while writing the file by specifying false for the fourth argument
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, false);
restSize -= writeSize;
}
// Flush after writing the entire file is complete
fileStream.TryFlush();
Making these changes when writing to an SD Card-equivalent product packaged with the system increases performance by about nine times (improving total write time from 11.717 seconds to 1.290 seconds) when writing two files of size 352 KB and 192 KB, respectively, and using a BUFFER_SIZE
of 8 KB.
Note:
These performance figures were measured under conditions of normal access priority (PRIORITY_APP_NORMAL
).
6.7. Performance of SD Cards Packaged With the System (Important)
The SD cards that are currently packaged with systems for resale are supplied by multiple manufacturers. This means that the systems on the market include media with different levels of performance.
The media from manufacturers that were added after the launch of the Nintendo 3DS have better performance than the media packaged at launch when writing to random locations and when writing small files. On the other hand, performance is slightly worse when writing files that are several megabytes in size directly to the SD Card. There is no significant difference in performance in terms of reading data.
Use media packaged with development hardware when debugging applications. Although the same media as packaged with development hardware in the past will continue to be used, media having different performance from conventional media may be included with development hardware in the future. If this happens, use the media packaged with the development hardware, rather than the old media.
This section describes the access speeds for accessing the extended save data region on media having the same specifications and capacity as the SD Card packaged with the CTR system.
6.3.1. Mounting
The average processing times for mounting, deleting, creating, remounting, and unmounting expanded save data are 40.844 ms (mounting), 105.296 ms (deleting), 2346.382 ms (creating), 38.256 ms (remounting), and 1.842 ms (unmounting), respectively.
6.3.2. Creating Files
The average processing time to create a file on expanded save data is 766.200 ms.
6.3.3. Reading Files
For batch reading files on expanded save data, because efficiency is poor when the file is very small, performance decreases when the size is 256 KB or less.
6.3.4. Writing Files
For writing files to expanded save data, speeds tend to increase as the data size increases.
6.3.5. Deleting Files
The average processing time to delete a file from expanded save data is 196.322 ms.
The average processing times for mounting, deleting, creating, remounting, and unmounting expanded save data are 40.844 ms (mounting), 105.296 ms (deleting), 2346.382 ms (creating), 38.256 ms (remounting), and 1.842 ms (unmounting), respectively.
The average processing time to create a file on expanded save data is 766.200 ms.
6.3.3. Reading Files
For batch reading files on expanded save data, because efficiency is poor when the file is very small, performance decreases when the size is 256 KB or less.
6.3.4. Writing Files
For writing files to expanded save data, speeds tend to increase as the data size increases.
6.3.5. Deleting Files
The average processing time to delete a file from expanded save data is 196.322 ms.
For batch reading files on expanded save data, because efficiency is poor when the file is very small, performance decreases when the size is 256 KB or less.
For writing files to expanded save data, speeds tend to increase as the data size increases.
6.3.5. Deleting Files
The average processing time to delete a file from expanded save data is 196.322 ms.
The average processing time to delete a file from expanded save data is 196.322 ms.
This section describes the access speeds for accessing a downloadable application’s ROM archives on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.4.1. Batch Reading
Batch reading is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
6.4.2. Stream Reads
Stream reading of files is most effective with a buffer size of 512 KB or more, similar to the characteristics described in Section 6.4.1. Batch Read. Performance decreases when batch reading in a buffer size of 256 KB or less.
Batch reading is most effective when data sizes are 512 KB or greater. Performance decreases when batch reading in data sizes of 256 KB or less.
Stream reading of files is most effective with a buffer size of 512 KB or more, similar to the characteristics described in Section 6.4.1. Batch Read. Performance decreases when batch reading in a buffer size of 256 KB or less.
6.5. Save Data (Downloadable Applications)
This section describes the access speeds for accessing a downloadable application's backup region on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.5.1. Reading
For batch read operations of save data written to the backup region of a downloadable application, performance decreases for data of 32 KB or less.
6.5.2. Writing
For writing save data to the backup region of a downloadable application, speeds tend to increase as the data size increases.
6.5.3. Mounting
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
6.5.4. Deleting Files
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
6.6. Flushing File Write Operations (Important)
We recommend flushing file write operations after writing the entire file has completed.
The time required to write files of the same size may be significantly longer in the case of an implementation in which flushing is performed at the same time as writing compared to an implementation in which flushing is performed after the entire file has been written. The difference in execution time grows larger as the amount of data written per function call becomes smaller, resulting in a difference several times larger depending on the total size.
If true
is specified in the argument flush
when using TryWrite
, flushing is performed while writing. However, note that if false
is specified in flush
, flushing is not performed unless explicitly carried out using TryFlush
or a similar function.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, true);
restSize -= writeSize;
}
Performance when writing files may be improved by making the following changes.
size_t restSize = fileSize;
while (restSize > 0)
{
size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE;
s32 actualSize = 0;
// Do not flush while writing the file by specifying false for the fourth argument
fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, false);
restSize -= writeSize;
}
// Flush after writing the entire file is complete
fileStream.TryFlush();
Making these changes when writing to an SD Card-equivalent product packaged with the system increases performance by about nine times (improving total write time from 11.717 seconds to 1.290 seconds) when writing two files of size 352 KB and 192 KB, respectively, and using a BUFFER_SIZE
of 8 KB.
Note:
These performance figures were measured under conditions of normal access priority (PRIORITY_APP_NORMAL
).
6.7. Performance of SD Cards Packaged With the System (Important)
The SD cards that are currently packaged with systems for resale are supplied by multiple manufacturers. This means that the systems on the market include media with different levels of performance.
The media from manufacturers that were added after the launch of the Nintendo 3DS have better performance than the media packaged at launch when writing to random locations and when writing small files. On the other hand, performance is slightly worse when writing files that are several megabytes in size directly to the SD Card. There is no significant difference in performance in terms of reading data.
Use media packaged with development hardware when debugging applications. Although the same media as packaged with development hardware in the past will continue to be used, media having different performance from conventional media may be included with development hardware in the future. If this happens, use the media packaged with the development hardware, rather than the old media.
This section describes the access speeds for accessing a downloadable application's backup region on media with the same specifications and capacity as the SD Card bundled with the CTR system.
6.5.1. Reading
For batch read operations of save data written to the backup region of a downloadable application, performance decreases for data of 32 KB or less.
6.5.2. Writing
For writing save data to the backup region of a downloadable application, speeds tend to increase as the data size increases.
6.5.3. Mounting
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
6.5.4. Deleting Files
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
For batch read operations of save data written to the backup region of a downloadable application, performance decreases for data of 32 KB or less.
For writing save data to the backup region of a downloadable application, speeds tend to increase as the data size increases.
6.5.3. Mounting
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
6.5.4. Deleting Files
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
The average processing times for formatting, mounting, and unmounting the backup region of a downloadable application are 436.077 ms (formatting without automatic redundancy), 197.499 ms (formatting with automatic redundancy enabled), 24.674 ms (mounting), and 1.338 ms (unmounting), respectively.
The average processing times to delete a file from the backup region of a downloadable application are 171.093 ms without automatic redundancy and 1.546 ms with automatic redundancy enabled.
We recommend flushing file write operations after writing the entire file has completed.
The time required to write files of the same size may be significantly longer in the case of an implementation in which flushing is performed at the same time as writing compared to an implementation in which flushing is performed after the entire file has been written. The difference in execution time grows larger as the amount of data written per function call becomes smaller, resulting in a difference several times larger depending on the total size.
If true
is specified in the argument flush
when using TryWrite
, flushing is performed while writing. However, note that if false
is specified in flush
, flushing is not performed unless explicitly carried out using TryFlush
or a similar function.
size_t restSize = fileSize; while (restSize > 0) { size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE; s32 actualSize = 0; fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, true); restSize -= writeSize; }
Performance when writing files may be improved by making the following changes.
size_t restSize = fileSize; while (restSize > 0) { size_t writeSize = (restSize < BUFFER_SIZE) ? restSize : BUFFER_SIZE; s32 actualSize = 0; // Do not flush while writing the file by specifying false for the fourth argument fileStream.TryWrite(&actualSize, s_pBuffer, writeSize, false); restSize -= writeSize; } // Flush after writing the entire file is complete fileStream.TryFlush();
Making these changes when writing to an SD Card-equivalent product packaged with the system increases performance by about nine times (improving total write time from 11.717 seconds to 1.290 seconds) when writing two files of size 352 KB and 192 KB, respectively, and using a BUFFER_SIZE
of 8 KB.
These performance figures were measured under conditions of normal access priority (PRIORITY_APP_NORMAL
).
6.7. Performance of SD Cards Packaged With the System (Important)
The SD cards that are currently packaged with systems for resale are supplied by multiple manufacturers. This means that the systems on the market include media with different levels of performance.
The media from manufacturers that were added after the launch of the Nintendo 3DS have better performance than the media packaged at launch when writing to random locations and when writing small files. On the other hand, performance is slightly worse when writing files that are several megabytes in size directly to the SD Card. There is no significant difference in performance in terms of reading data.
Use media packaged with development hardware when debugging applications. Although the same media as packaged with development hardware in the past will continue to be used, media having different performance from conventional media may be included with development hardware in the future. If this happens, use the media packaged with the development hardware, rather than the old media.
The SD cards that are currently packaged with systems for resale are supplied by multiple manufacturers. This means that the systems on the market include media with different levels of performance.
The media from manufacturers that were added after the launch of the Nintendo 3DS have better performance than the media packaged at launch when writing to random locations and when writing small files. On the other hand, performance is slightly worse when writing files that are several megabytes in size directly to the SD Card. There is no significant difference in performance in terms of reading data.
Use media packaged with development hardware when debugging applications. Although the same media as packaged with development hardware in the past will continue to be used, media having different performance from conventional media may be included with development hardware in the future. If this happens, use the media packaged with the development hardware, rather than the old media.