jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
The idea of browsers supporting protocol relative URLs (e.g. <img src="//domain.com/img/logo.png">) is intriguing for linking to an external assets like JS and images when a site could be optionally loaded in an SSL or clear-text session. I wanted to test a wide variety of browsers for support of this method and any impact on load times this might have in comparison to traditional methods of client-side solutions.
Traditional methods of solving this problem on the client side require all assets to be on the same server (e.g. <img src="/img/logo.png">) or require a modification of the protocol with Javascript via an if/then or ternary test.
Google Analytics handles this via a JS ternary test:
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'
or as I have in the past:
document.write('\x3Cscript src="'+document.location.protocol+'//www.example.com/somefile.js"\x3E\x3C/script\x3E');}
This topic has been discussed at length by Paul Irish: http://paulirish.com/2010/the-protocol-relative-url/
and the creator of jsperf, Mathias Bynens: http://mathiasbynens.be/notes/async-analytics-snippet
I am going to test loading a JS & IMG files via various methods and test for their success.
Ready to run.
Test | Ops/sec | |
---|---|---|
Direct Link Control |
| ready |
Ternary Test |
| ready |
Protocol Relative Test |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.