Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 4.06 KB

README.md

File metadata and controls

28 lines (24 loc) · 4.06 KB

Time it

Small bookmarklet that will help to test a web page performance. depends on Navigation Timing draft

Usage

  1. Create a new bookmark targeting an arbitrary url
  2. Edit the target url to this:
`````javascript javascript:(function(a,b){if(!performance.timing)throw Error("There is no performance.timing");var c=performance.timing,d=Math.round(c.connectEnd-c.connectStart);dns=Math.round(c.domainLookupEnd-c.domainLookupStart),ttfb=Math.round(c.responseStart-c.connectEnd),basePage=Math.round(c.responseEnd-c.responseEnd),loadTime=Math.round(c.loadEventStart-c.connectEnd),frontEnd=Math.round(c.loadEventStart-c.responseEnd);var e=b.createElement("style");e.innerText='*{box-sizing:border-box!important}.overly{position:fixed;background:#f1f1f1;border-bottom:1px solid #dedede;box-shadow:0 2px 5px rgba(1,1,1,0.08);width:100%;height:20%;padding:10px;top:0;left:0;z-index:999998}.overly a{color:#444;font-weight:bold;font-size:11px;text-decoration:none}.overly .project-name{font-size:16px}.overly,.timeit-modal{max-height:20%;font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif!important}.timeit-modal{position:fixed;top:0;left:25%;width:50%;min-height:25%;z-index:999999;font-weight:normal;font-style:normal;font-size:14px;line-height:1;color:#222}.block:before,.block:after{content:" ";display:table}.block:after{clear:both}.block{*zoom:1}.block{padding:0 10px;float:left;width:16.666666667%; max-height:100%;}.metric{background:#fff;border:1px solid rgba(1,1,1,0.2);border-top:0;border-radius:0 0 4px 4px;box-shadow:0 2px 5px rgba(1,1,1,0.05)}.metric--head{margin:0;color:#555;background:#f1f1f1;border-bottom:1px solid #ccc;font-weight:bold;text-transform:uppercase}.metric--body{display:block;width:100%}.metric--head,.metric--body{padding:10px;text-align:center;white-space:pre;white-space:pre-wrap;white-space:pre-line;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:-moz-pre-wrap;white-space:-hp-pre-wrap;word-wrap:break-word}';var f=b.createElement("div");f.innerHTML='
Connection time

'+(.001*d+"").slice(0,4)+"S

"+"
"+"
"+'
'+'
'+'
Load Time
'+'

'+(.001*loadTime+"").slice(0,4)+"S

"+"
"+"
"+'
'+'
'+'
DNS Lookup
'+'

'+(.001*dns+"").slice(0,4)+"S

"+"
"+"
"+'
'+'
'+'
Time to first byte
'+'

'+(.001*ttfb+"").slice(0,4)+"S

"+"
"+"
"+'
'+'
'+'
Base Page
'+'

'+(.001*basePage+"").slice(0,4)+'S

Front End

'+(.001*frontEnd+"").slice(0,4)+"S

",b.head.appendChild(e),b.body.appendChild(f)})(window,document); ````` Visit a website you want to measure and then click on the bookmark your bookmark bar. Then you should see something like this screenshot

License

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE