Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions _benchmarks/rgb-vs-rgb2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: rgb vs rgb2
setup: |
function rand(min,max) {
return min + Math.floor(Math.random() * ((max+1)-min) );
}

function randRGB2() {
return "rgb("+rand(0,255)+", "+rand(0,255)+", "+rand(0,255)+ ")";
}

function randRGB() {
var a = [];
for (var i = 0; i < 3; i++) {
a.push(rand(0,255));
}
return "rgb("+a.join(", ")+")";
}
tests:
-
name: rgb
code: |
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
document.getElementsByTagName('h2')[0].style.color = randRGB2();
-
name: rgb2
code: |
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
document.getElementsByTagName('h2')[0].style.color = randRGB();
---