new Audio() vs. document.createElement('audio')

Benchmark created by Tung Dao on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
new Audio
var a = new Audio();
a.src = 'http://upload.wikimedia.org/wikipedia/commons/4/47/Beethoven_Moonlight_2nd_movement.ogg';
ready
createElement
var b = document.createElement('audio');
b.src = 'http://upload.wikimedia.org/wikipedia/commons/4/47/Beethoven_Moonlight_2nd_movement.ogg';
ready
jQuery
jQuery('<audio>').attr('src', 'http://upload.wikimedia.org/wikipedia/commons/4/47/Beethoven_Moonlight_2nd_movement.ogg');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.