Click here to Skip to main content
15,883,901 members
Articles / Mobile Apps

How speedy.js is Your Web Site?

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
29 Aug 2014CPOL2 min read 7.6K   4  
How speedy.js is your web site?

As a performance officer, I recently watched a presentation by Lara Callender Swanson about how Etsy moved towards a culture of performance and mobile web by educating, incentivizing and empowering everyone who works at Etsy.

Inspired by a repo on github and StackExchange‘s Miniprofiler, I’ve created a very simple script to display Navigation Timing stats at the top of a web page.

Navigation Timing is a JavaScript API for accurately measuring performance on the web. The API provides a simple way to get accurate and detailed timing statistics—natively—for page navigation and load events. It has always been a small challenge to measure the time it takes to fully load a page, but Navigation Timing API now makes this easy for all of us.

It’s important to understand that Navigation Timing data is very similar to network stats in developer tools.

speedy.js

Can I Use …?

Navigation Timing API is now supported by all major browsers (Can I use …?). Google Analytics and RUM services use it since a long time ago. In case it’s not supported by your browser, an error message will be displayed.

nospeedy.js

No message => don’t hesitate to create an issue on github.

Mobile Ready?

This is maybe the most interesting part. Developer tools are not available on mobile/tablet version so you don’t have any chance to evaluate page load time and to explain why it may be slow.

On Production?

Of course, it’s not recommended to display this kind of data to your users, but you may find several ways to use it on production. There are browser extensions to inject custom JavaScripts into any website (Cjs, Greasemonkey) ; Fiddler allows you to automatically inject scripts into a page (stackoverflow).

Here is an example on my stackoverflow profile:

speedyonso

To conclude, don’t forget that Performance is a feature! Displaying page load time on each page and to everyone is a great chance to detect performance issues early. Does a page violate your SLA? I think it’s now a little easier with this script.


Image 4 Image 5

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
France France
Yet another proof of concept

Comments and Discussions

 
-- There are no messages in this forum --