Performance of embedding resource files in an executable file

I recently found here how to embed resource files inside an executable. There is also an xxd method. Given this new toy that I first used to insert GLSL shader text into my game, now I want to insert every resource file needed for the game.

At the moment I have only a few kilobytes of three-dimensional grid data, but before this number grows, I would like to know how much data can be embedded inside the executable file? If I put a couple of gigabytes of texture data inside, would that be nice? What are the performance penalties for abusing this feature?

+4
source share
1 answer

The disadvantage of this resource allocation method is that all resources will be present in virtual memory for the duration of your application.

For example, if you have 10 levels in your game, using the more common file-based storage solution, you only load the data to the level you are going to play. By loading all the game data at run time, you allocate more RAM than necessary. A solution that uses an optimally minimal amount of RAM will load only the resources it needs for the required time.

However, if you used a file-based file storage solution for your resources and loaded them all at the beginning of execution, your RAM usage would be the same as the statically assigned resource method.

In addition, if your target machine is a simple game console that does not perform multitasking, you can usually freely use available resources in any way that suits you. There is no requirement to β€œplay well,” as usual, only one game works at a time.

If you are dealing with several megabytes in a modern system, the penalty is negligible, but the penalty for performance when using several gigabytes of data is that you create an unnecessary load on the available system memory resources.

edit: don't forget to see the points raised in the comments

0
source

All Articles