CSS rgb vs hex codes (v12)

Revision 12 of this benchmark created on


Preparation HTML

<div id="1"></div>
<div id="2"></div>
<div id="3"></div>

Setup

var div1 = document.getElementById('1');
    var div2 = document.getElementById('2');
    var div3 = document.getElementById('3');

Test runner

Ready to run.

Testing in
TestOps/sec
rgb color
div1.style.backgroundColor = 'rgb(100,0,0)';
div2.style.backgroundColor = 'rgb(0,100,0)';
div3.style.backgroundColor = 'rgb(0,0,100)';
ready
hex codes
div1.style.backgroundColor = '#F00';
div2.style.backgroundColor = '#0F0';
div3.style.backgroundColor = '#00F';
ready
name
div1.style.backgroundColor = 'red';
div2.style.backgroundColor = 'blue';
div3.style.backgroundColor = 'green';
ready
full hex
div1.style.backgroundColor = '#FF0000';
div2.style.backgroundColor = '#00FF00';
div3.style.backgroundColor = '#0000FF';
ready

Revisions

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