Jump to content

Package Compression Speed


SpiderPig
 Share

Recommended Posts

Enough theory!  Let's get real!  ?  I tested this.

I created a 2048x2048 DXT5 texture (with mipmaps) and copied it to create 90 textures, totaling 480MB.  I then zipped them in both storage (uncompressed) mode (480MB) and "best" mode (246MB).  I then wrote a quick program:

#include "Leadwerks.h"
#include "conio.h"

using namespace Leadwerks;

Texture* texture[90];

int main(int argc,const char *argv[])
{
    //Load any zip files in main directory
    Leadwerks::Directory* dir = Leadwerks::FileSystem::LoadDir(".");
    if (dir)
    {
        for (int i=0; i<dir->files.size(); i++)
        {
            std::string file = dir->files[i];
			std::string ext = Leadwerks::String::Lower(Leadwerks::FileSystem::ExtractExt(file));
            if (ext=="zip" || ext=="pak")
            {
                Leadwerks::Package::Load(file);
            }
        }
        delete dir;
    }

	long starttime = Leadwerks::Time::Millisecs();

	for(int i=0; i<90; i++)
	{
		string filename=std::to_string(i)+".tex";
		cout << filename << endl;
		texture[i]=Texture::Load(filename);
	}

	float totaltime = ((float)Leadwerks::Time::Millisecs()-(float)starttime)/1000;

	printf("\nLoad time: %f\n",totaltime);
	getch();
}

I then put in only the uncompressed zip, ran the program, then swapped it with the compressed and ran it again, multiple times.  Here are the results:

uncompressed (SSD)
2.284 seconds
2.257
2.238
2.236
2.232
2.241
2.235
2.231
2.241
2.250

"best" compressed (SSD)
3.748
3.865
3.811
3.871
3.603
3.650
3.802
3.790
3.668
3.748

uncompressed (HD)
2.145
2.150
2.136

"best" compressed (HD)
3.619
3.646
3.661

Couldn't tell you why the non-SSD is slightly faster.  Out of curiosity I also rebooted my computer to run the program clean and uncompressed+HD came in at over 8 seconds but I'm not confident that the computer stopped loading everything in the background (task manager was calm though).

Edit: I just did two more reboot tests.  Obviously when you first run the program, nothing is already in memory so things take longer.  Compressed: 7.254 seconds. Rebooted again and did uncompressed: 9.310 seconds (yes, compressed was faster here).

  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...