Last active
February 20, 2020 21:16
-
-
Save arce/ed9ba15059f7ee122a492aab8e005261 to your computer and use it in GitHub Desktop.
Graphics Benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas,ctx; | |
var width,height; | |
function loop(timestamp) { | |
draw(); | |
window.requestAnimationFrame(loop); | |
} | |
function main() { | |
canvas = document.getElementById('canvas'); | |
ctx = canvas.getContext("2d"); | |
w = canvas.width; | |
h = canvas.height; | |
setup(); | |
loop(); | |
} | |
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
write = io.write | |
function Array(arg1) | |
local table = (type(arg1) == "table") and arg1 or {} | |
local _table = table | |
table = {} | |
local metatable = { | |
__newindex = function(table,k,v) | |
_table[k+1] = v | |
end, | |
__index = function(table,k) | |
return _table[k+1] | |
end | |
} | |
table.length = function() | |
return #_table | |
end | |
setmetatable(table,metatable) | |
return table | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chromium-browser GraphicsBenchRects.html --enable-precise-memory-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm salida_lua.csv | |
./bin/Diököl GraphicsBenchCircles.lua 10000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 500 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 1000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 5000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 10000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 50000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 100000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 500000 >> salida_lua.csv | |
# ./bin/Diököl GraphicsBenchCircles.lua 1000000 >> salida_lua.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x | |
var y | |
var c | |
var n = 1000000 | |
var w = 1024 | |
var h = 768 | |
var start_time | |
function setup() { | |
x = new Array(); | |
y = new Array(); | |
c = new Array(); | |
for (var i=0; i<n; i++) { | |
x[i] = Math.random()*w; | |
y[i] = Math.random()*h; | |
c[i] = 'rgba('+Math.random()*255+','+Math.random()*255+','+Math.random()*255+')'; | |
} | |
} | |
function draw() { | |
ctx.fillStyle = "white"; | |
ctx.fillRect(0, 0, w,h); | |
start_time = Date.now(); | |
for (var i=0; i<n; i++) { | |
ctx.strokeStyle = c[i]; | |
ctx.beginPath(); | |
ctx.arc(x[i],y[i],3,0,2*Math.PI,true); | |
ctx.stroke(); | |
} | |
window.performance.memory(); | |
console.log("ok:",(Date.now()-start_time)/1000.0); | |
console.log(performance.memory.totalJSHeapSize); | |
console.log(performance.memory.usedJSHeapSize); | |
console.log(performance.memory.jsHeapSizeLimit); | |
window.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "Array" | |
local x | |
local y | |
local c | |
local n = 0 | |
local m = 0 | |
local w = 1024 | |
local h = 768 | |
local t | |
function setup() | |
size(1024,768) | |
if (args ~= null) then | |
n = args[1] | |
end | |
x = Array() | |
y = Array() | |
c = Array() | |
for i=0,n-1 do | |
x[i] = math.random()*w | |
y[i] = math.random()*h | |
c[i] = color(math.random()*255,math.random()*255,math.random()*255,0) | |
end | |
t = time() | |
end | |
function draw() | |
background(255); | |
for i=0,n-1 do | |
fill(c[i]) | |
rect(x[i],y[i],6,6) | |
end | |
print("rects,"..n..","..(time()-t)..","..collectgarbage("count")) | |
t = time() | |
m = m + 1 | |
if (m==10) then exit() end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x[]; | |
int y[]; | |
int c[]; | |
int n = 0; | |
int m = 0; | |
int width = 1024; | |
int height = 768; | |
long time1; | |
long time2; | |
void setup() { | |
if (args != null) { | |
n = int(args[0]); | |
} | |
//size(1280,1024); // SXGA | |
// size(1024,768,P3D); // XGA | |
size(1024,768); // XGA | |
x = new int[n]; | |
y = new int[n]; | |
c = new int[n]; | |
for (int i=0; i<n; i++) { | |
x[i] = (int)(random(1)*width); | |
y[i] = (int)(random(1)*height); | |
c[i] = color(random(1)*255,random(1)*255,random(1)*255); | |
} | |
time1 = System.nanoTime(); | |
long maxMemory = Runtime.getRuntime().maxMemory(); | |
long allocatedMemory = Runtime.getRuntime().totalMemory(); | |
long freeMemory = Runtime.getRuntime().freeMemory(); | |
} | |
void draw() { | |
background(255); | |
stroke(0); | |
fill(255); | |
for (int i=0; i<n; i++) { | |
fill(c[i]); | |
ellipse(x[i],y[i],5,5); | |
} | |
time2 = System.nanoTime(); | |
println("circles,"+n+","+(time2-time1)/1000000000.0); | |
time1 = time2; | |
m++; | |
if (m==10) exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x1[]; | |
int y1[]; | |
int x2[]; | |
int y2[]; | |
int c[]; | |
int n = 1000; | |
int width = 1024; | |
int height = 768; | |
long time1; | |
long time2; | |
void setup() { | |
if (args != null) { | |
n = int(args[1]); | |
} | |
//size(1280,1024); // SXGA | |
// size(1024,768,P3D); // XGA | |
size(1024,768,P3D); // XGA | |
x1 = new int[n]; | |
y1 = new int[n]; | |
x2 = new int[n]; | |
y2 = new int[n]; | |
c = new int[n]; | |
for (int i=0; i<n; i++) { | |
x1[i] = (int)(random(1)*width); | |
y1[i] = (int)(random(1)*height); | |
x2[i] = (int)(random(1)*height); | |
y2[i] = (int)(random(1)*height); | |
c[i] = color(random(1)*255,random(1)*255,random(1)*255); | |
} | |
time1 = System.nanoTime(); | |
} | |
void draw() { | |
background(255); | |
stroke(0); | |
fill(255); | |
long startTime = System.nanoTime(); | |
for (int i=0; i<n; i++) { | |
stroke(c[i]); | |
line(x1[i],y1[i],x2[i],y2[i]); | |
} | |
time2 = System.nanoTime(); | |
println("n: "+n+",time: "+(time2-time1)/1000000000.0 + " seconds."); | |
time1 = time2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x[]; | |
int y[]; | |
int c[]; | |
int n = 0; | |
int m = 1000000; | |
int width = 1024; | |
int height = 768; | |
long time1; | |
long time2; | |
int[] nitems = { 0, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000 }; | |
int l = -1; | |
void setup() { | |
//size(1280,1024); // SXGA | |
// size(1024,768,P3D); // XGA | |
size(1024,768,P3D); // XGA | |
x = new int[m]; | |
y = new int[m]; | |
c = new int[m]; | |
for (int i=0; i<m; i++) { | |
x[i] = (int)(random(1)*width); | |
y[i] = (int)(random(1)*height); | |
c[i] = color(random(1)*255,random(1)*255,random(1)*255); | |
} | |
time1 = System.nanoTime(); | |
} | |
void drawCirc() { | |
background(255); | |
stroke(0); | |
fill(255); | |
long startTime = System.nanoTime(); | |
for (int i=0; i<n; i++) { | |
fill(c[i]); | |
ellipse(x[i],y[i],5,5); | |
} | |
time2 = System.nanoTime(); | |
println("n: "+n+",time: "+(time2-time1)/1000000000.0 + " seconds."); | |
time1 = time2; | |
} | |
void finish() { | |
exit(); | |
} | |
void draw() { | |
l++; | |
if (l == nitems.length-1) | |
finish(); | |
n = nitems[l]; | |
drawCirc(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x[]; | |
int y[]; | |
int c[]; | |
int n = 0; | |
int m = 1000000; | |
int width = 1024; | |
int height = 768; | |
long time1; | |
long time2; | |
int[] nitems = { 0, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000 }; | |
int l = -1; | |
void setup() { | |
//size(1280,1024); // SXGA | |
// size(1024,768,P3D); // XGA | |
size(1024,768,P3D); // XGA | |
x = new int[m]; | |
y = new int[m]; | |
c = new int[m]; | |
for (int i=0; i<m; i++) { | |
x[i] = (int)(random(1)*width); | |
y[i] = (int)(random(1)*height); | |
c[i] = color(random(1)*255,random(1)*255,random(1)*255); | |
} | |
time1 = System.nanoTime(); | |
} | |
void drawCirc() { | |
background(255); | |
stroke(0); | |
fill(255); | |
long startTime = System.nanoTime(); | |
for (int i=0; i<n; i++) { | |
fill(c[i]); | |
ellipse(x[i],y[i],5,5); | |
} | |
time2 = System.nanoTime(); | |
println("n: "+n+",time: "+(time2-time1)/1000000000.0 + " seconds."); | |
time1 = time2; | |
} | |
void finish() { | |
exit(); | |
} | |
void draw() { | |
l++; | |
if (l == nitems.length-1) | |
finish(); | |
n = nitems[l]; | |
drawCirc(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x[]; | |
int y[]; | |
int c[]; | |
int n = 0; | |
int m = 1000000; | |
int width = 1024; | |
int height = 768; | |
long time1; | |
long time2; | |
int[] nitems = { 0, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000 }; | |
int l = -1; | |
void setup() { | |
//size(1280,1024); // SXGA | |
// size(1024,768,P3D); // XGA | |
size(1024,768,P3D); // XGA | |
x = new int[m]; | |
y = new int[m]; | |
c = new int[m]; | |
for (int i=0; i<m; i++) { | |
x[i] = (int)(random(1)*width); | |
y[i] = (int)(random(1)*height); | |
c[i] = color(random(1)*255,random(1)*255,random(1)*255); | |
} | |
time1 = System.nanoTime(); | |
} | |
void drawCirc() { | |
background(255); | |
stroke(0); | |
fill(255); | |
long startTime = System.nanoTime(); | |
for (int i=0; i<n; i++) { | |
fill(c[i]); | |
ellipse(x[i],y[i],5,5); | |
} | |
time2 = System.nanoTime(); | |
println("n: "+n+",time: "+(time2-time1)/1000000000.0 + " seconds."); | |
time1 = time2; | |
} | |
void finish() { | |
exit(); | |
} | |
void draw() { | |
l++; | |
if (l == nitems.length-1) | |
finish(); | |
n = nitems[l]; | |
drawCirc(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<body> | |
<canvas id="canvas" width="1024" height="768" ></canvas> | |
<script src='GraphicsBench.js'></script> | |
<script src='animate.js'></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 100 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 500 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 1000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 5000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 10000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 50000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 100000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 500000 >> salida.csv | |
processing-java --sketch=/Users/armando/Desktop/Benchmark/GraphicsBench/GraphicsBenchCircles --run 1000000 >> salida.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment