Gin-gonic improvements

While writing simple web applications using gin-gonic web framework, there are some things that should be improved, in my opinion:

Ideas

  1. Static file serving: it should be improved to use browser caching, according to https://developers.google.com/speed/docs/insights/LeverageBrowserCaching
  2. Default values for templates rendering: there are some values that I am going to need in pretty much every template i am rendering. It would be nice to be able to set them once and for all so that when I render a template, the values i want to be always present are added to the ones i am passing on the fly.

Implementation strategy

Idea 1

For idea 1, well, not much, I should probably just patch the gin source tree. The interesting part is how to generate ETags and how to do it efficiently.

Idea 2

Idea number 2 is a bit more interesting, because it has some algorithmic problems underlying: basically, I will have to merge two maps, and I will have to do it as quickly as possible.

Rationale

When developing web application, I like to get insights on web performance using Google’s PageSpeed Insight service. Such service is awesome because it points out precisely what is wrong with your page and how to fix it.

Currently, I am using a template I pulled off the internet with my server-side code, and I managed to raise the speed index from 32/100 to 63/100 on the mobile, and from 38/100 to 77/100 on the desktop.

Ideally, I should do everything I can to reach 100/100.

Note

These are just ideas, likely to be implemented in the next days. I could have opened an issue on Github, but first I want to try implement them myself, and maybe then submit them for inclusion in the main source tree.

References

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.