Loading png vs bmp

BlitzPlus Forums/BlitzPlus Programming/Loading png vs bmp

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Well I just wrote a simple benchmarking program to find out the answer here. I'm using a 2.4GHz P4 with 512MB RAM with a 7200 RPM hard disk so bear in mind that PNGs and JPEGs are relatively less disk intensive and more CPU intensive.

I started with four high resolution digital photographs 1800x1350 or so (they started as JPEGs) and exported them to PNG and BMP. The JPEGs ended up being roughly 1.5MB, the PNGs 4-5MB, and the BMPs 11MB each.

Total load times were:
BMPs 1.1s
JPEGs 1.79s
PNGs 3.215s

Note that since these were photographs, this is a considerable disadvantage for the PNG file format (which does not do a great job compressing photographs). However, it's interesting to note that a 2.4GHz processor doing the crunching does not help the JPEGs to load faster than the far larger BMPs.

Edit:

I got 7 PNG files from an old multimedia project. These vary in size (they're pretty "realistic" kinds of images since they combine photographs with computer graphics and are reasonably small).

BMPs 0.038s
JPEGs 0.061s
PNGs 0.103s

Note that these PNGs have alpha channels, so loading the JPEGs and BMPs is less work to begin with -- but here we see PNGs falling further behind.

So -- my immediate inclination would be to always use PNGs and JPEGs, but if performance is an issue it looks like BMPs win hands down.