Static Maps API format size comparison

Sod’s Law, I realised after the deadline that the loading of the environment’s texture could have been sped up! So I’m fixing it now.

The Static Maps API request still has to go through a PHP proxy due to cross-origin issues, however instead of also using the PHP’s GD libary to convert the image from a PNG to a JPG, which is notoriously slow, we can just request the specific format straight from the API using the format parameter.

I have tested all the formats to check which is the smallest:

staticmaps-size-comparison

As expected, the progressive jpg provides the smallest file size.

Changing the format to jpg cut around 1 second off the request time.

Before:before

 

After:after

It might not seem like much, but considering this request actually freezes the page, it is important that it is as quick as possible.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>