Template caching to improve performance?

Would utilising something like this: https://github.com/karlgoldstein/grunt-html2js increase the performance of Ionic apps?

Given that all the HTML files are on the device already and there is no network HTTP requests being made I am unsure of the impact of caching all the HTML templates. It might be awesome! Or it might make no difference.

Anyone got an opinions / evidence / experience with this?

2 Likes

Hi. I was thinking about doing the same thing.

Have you tried it yet? How do you suggest we test the app performance?

Maybe use ui-router, create a parent and a child controller/view. Save the timestamp and reload the route many times first with the pure html template and after with the html/js template.

I don’t know how ionic/phonegapp works but I think that angular still retrives the html template using a http request so the solution will probably improve the performance.

http://www.html5rocks.com/en/tutorials/webperformance/usertiming/

Might provide timings with a couple of lines…unsure of browser support though. I haven’t tested it

I’ll benchmark this in the next days.

I’ve tested it. It doesn’t change anything… HTML2JS uses the templateCacheProvider and Angular does one HTTPrequest per url. On the first request the template is cached by templateCacheProvider too, so using html2js to deliver the app with the template already cached has no impact since the first request is local.