Which library loads DDS images faster

I am currently using SOIL to load DDS images , Single DDS image of size 1920 X 1080 takes about 8 milliseconds to load to the disk using SOIL_Load_Image function.

When i try to load the same image using DevIL it takes about 50 milliseconds to load , i am using ilLoadImage function.

Though i am very new to Devil Library is it slow compared to SOIL ?

You might share your timing method and code.

This is going to be primarily a disk-limited operation. If you’re not clearing the disk cache before each test, running each test many times to collect samples, running with each library in the same state each time, and asking each library to perform exactly the same operation, then your timings could be at best apples-and-oranges, or at worst meaningless.

In the main function

        int width, height, channels;
	auto start = high_resolution_clock::now();
	unsigned char* image = SOIL_load_image("D:\\RenderCubeDDS\\CubeTest000000.dds", &width, 
        &height, &channels, SOIL_LOAD_AUTO | SOIL_FLAG_DDS_LOAD_DIRECT);
	auto stop = high_resolution_clock::now();
	auto duration = duration_cast<milliseconds>(stop - start);
	std::cout << duration.count() <<   "     With SOIL" << std::endl;
	unsigned int img = LoadImage("D:\\RenderCubeDDS\\CubeTest000000.dds");

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Defination of LoadImage() function


int LoadImage(const char* filename)
{
	ILboolean success = false;
	ILuint image;

	ilGenImages(1, &image); /* Generation of one image name */
	ilBindImage(image); /* Binding of image name */
	success = ilLoadImage(filename); /* Loading of the image filename by DevIL */	
	ilLoad(IL_DDS, filename);
	ILubyte *Lump;
	ILuint Size;
	FILE *File;
	auto start = high_resolution_clock::now();
	File = fopen(filename, "rb");
	fseek(File, 0, SEEK_END);
	Size = ftell(File);

	Lump = (ILubyte*)malloc(Size);
	fseek(File, 0, SEEK_SET);
	fread(Lump, 1, Size, File);
	fclose(File);

	ilLoadL(IL_DDS, Lump, Size);
	auto stop = high_resolution_clock::now();
	auto duration = duration_cast<milliseconds>(stop - start);
	std::cout << duration.count() << " milliseconds";
	free(Lump);
}
```

If you’re not clearing the disk cache before each test, and repeating each sample collection a number of times, I’d start with that. Re disk cache, on Windows that has the non-intuitive name “Standby List”. You can use a tool such as RAMMap or Process Hacker to clear it.

Also, it’s unclear why in the DeviL case you’re doing your own file open+read+close and then just spoon-feeding the loaded memory block to the DeviL library.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.