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

Annunci

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...