mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-01 09:40:38 +02:00
Remove test/bench/*
Benchmarking is a good idea and we should do it, but this stuff hasn't run in >5 years.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,62 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Event binding cost</title>
|
||||
<style>
|
||||
#frame {
|
||||
width:100px;
|
||||
height:100px;
|
||||
background:black;
|
||||
}
|
||||
.dot {
|
||||
height:100px;
|
||||
width:100px;
|
||||
color:blue;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:120px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='frame'>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<script src="https://raw.github.com/bestiejs/benchmark.js/v1.0.0/benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
// add tests
|
||||
suite
|
||||
.add('with events', function() {
|
||||
d3.select('#frame').html('')
|
||||
.append('div')
|
||||
.attr({ 'class': 'dot' })
|
||||
.on('click', function() {});
|
||||
})
|
||||
.add('without events', function() {
|
||||
d3.select('#frame').html('')
|
||||
.append('div')
|
||||
.attr({ 'class': 'dot' });
|
||||
})
|
||||
.add('using remove', function() {
|
||||
d3.select('.dot').remove();
|
||||
d3.select('#frame')
|
||||
.append('div')
|
||||
.attr({ 'class': 'dot' })
|
||||
.on('click', function() {});
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,99 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Node XML</title>
|
||||
<style>
|
||||
#mover {
|
||||
width:10px;
|
||||
height:10px;
|
||||
background:black;
|
||||
}
|
||||
#moved {
|
||||
width:5px;
|
||||
height:5px;
|
||||
background:red;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:120px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='mover'>
|
||||
<div id='moved'></div>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<div style="display: none" id="xml" lat="12.34" lon="12.34" version="0" user="foo">
|
||||
</div>
|
||||
<script src="benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
var obj = document.getElementById("xml");
|
||||
var fns = {
|
||||
lon: function(o, v) { o.loc[0] = parseFloat(v); },
|
||||
lat: function(o, v) { o.loc[1] = parseFloat(v); }
|
||||
},
|
||||
def = function(o, v, k) { o[k] = v; };
|
||||
|
||||
// add tests
|
||||
suite
|
||||
.add('one', function() {
|
||||
var o = { type: 'node' },
|
||||
attrs = obj.attributes;
|
||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||||
var attr = attrs[i];
|
||||
o[attr.nodeName] = attr.nodeValue;
|
||||
}
|
||||
if (o.lon && o.lat) {
|
||||
o.loc = [parseFloat(o.lon), parseFloat(o.lat)];
|
||||
delete o.lon; delete o.lat;
|
||||
}
|
||||
})
|
||||
.add('two', function() {
|
||||
var o = { type: 'node', loc: [0, 0] },
|
||||
attrs = obj.attributes;
|
||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||||
var attr = attrs[i],
|
||||
k = attr.nodeName,
|
||||
v = attr.nodeValue;
|
||||
if (k === 'lon') {
|
||||
o.loc[0] = parseFloat(v);
|
||||
} else if (k === 'lat') {
|
||||
o.loc[1] = parseFloat(v);
|
||||
} else {
|
||||
o[k] = v;
|
||||
}
|
||||
}
|
||||
})
|
||||
.add('three', function() {
|
||||
var o = { type: 'node', loc: [0, 0] },
|
||||
attrs = obj.attributes;
|
||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||||
var attr = attrs[i];
|
||||
(fns[attr.nodeName] || def)(o, attr.nodeValue, attr.nodeName);
|
||||
}
|
||||
})
|
||||
.add('four', function() {
|
||||
var o = { type: 'node', loc: [0, 0] },
|
||||
attrs = obj.attributes;
|
||||
o.id = attrs.iD.osmNodeValue;
|
||||
o.loc[0] = parseFloat(attrs.lon.nodeValue);
|
||||
o.loc[1] = parseFloat(attrs.lat.nodeValue);
|
||||
o.version = attrs.version.nodeValue;
|
||||
o.user = attrs.user.nodeValue;
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,55 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Event binding cost</title>
|
||||
<style>
|
||||
#frame {
|
||||
width:100px;
|
||||
height:100px;
|
||||
background:black;
|
||||
}
|
||||
.dot {
|
||||
height:100px;
|
||||
width:100px;
|
||||
color:blue;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:120px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='frame'>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<script src="https://raw.github.com/bestiejs/benchmark.js/v1.0.0/benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
// add tests
|
||||
suite
|
||||
.add('#html', function() {
|
||||
d3.select('#frame').html('')
|
||||
.append('div')
|
||||
.attr({ 'class': 'dot' });
|
||||
})
|
||||
.add('#remove', function() {
|
||||
d3.select('.dot').remove();
|
||||
d3.select('#frame')
|
||||
.append('div')
|
||||
.attr({ 'class': 'dot' });
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,61 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rounded coordinates</title>
|
||||
<style>
|
||||
#mover {
|
||||
width:10px;
|
||||
height:10px;
|
||||
background:black;
|
||||
}
|
||||
#moved {
|
||||
width:5px;
|
||||
height:5px;
|
||||
background:red;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:120px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='mover'>
|
||||
<div id='moved'></div>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<script src="https://raw.github.com/bestiejs/benchmark.js/v1.0.0/benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
// add tests
|
||||
suite
|
||||
.add('translate', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate(' +
|
||||
(Math.random() * 100) + 'px,' + (Math.random() * 100) + 'px)';
|
||||
})
|
||||
.add('translate-rounded', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate(' +
|
||||
(~~(Math.random() * 100)) + 'px,' + (~~(Math.random() * 100)) + 'px)';
|
||||
})
|
||||
.add('translate3d', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate3d(' +
|
||||
((Math.random() * 100)) + 'px,' + ((Math.random() * 100)) + 'px, 0px)';
|
||||
})
|
||||
.add('translate3d-rounded', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate3d(' +
|
||||
(~~(Math.random() * 100)) + 'px,' + (~~(Math.random() * 100)) + 'px, 0px)';
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,75 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rounded coordinates</title>
|
||||
<style>
|
||||
#mover {
|
||||
width:10px;
|
||||
height:10px;
|
||||
background:black;
|
||||
}
|
||||
#moved {
|
||||
width:5px;
|
||||
height:5px;
|
||||
background:red;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:220px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='mover'>
|
||||
<div id='moved'></div>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<script src="benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
// add tests
|
||||
suite
|
||||
.add('translate', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate(' +
|
||||
~~(Math.random() * 200) + 'px,' + ~~(Math.random() * 200) + 'px)';
|
||||
})
|
||||
.add('translate3d', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate3d(' +
|
||||
~~((Math.random() * 200)) + 'px,' + ~~((Math.random() * 200)) + 'px, 0px)';
|
||||
})
|
||||
.add('translate + scale', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate(' +
|
||||
~~(Math.random() * 200) + 'px,' + ~~(Math.random() * 200) + 'px) scale(1, 1)';
|
||||
})
|
||||
.add('translate3d + scale', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'translate3d(' +
|
||||
~~((Math.random() * 200)) + 'px,' + ~~((Math.random() * 200)) + 'px, 0px) scale(1, 1)';
|
||||
})
|
||||
.add('matrix3d', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'matrix3d(' +
|
||||
[1,0,0,0,
|
||||
0,1,0,0,
|
||||
0,0,1,0,
|
||||
~~(Math.random() * 200),
|
||||
~~(Math.random() * 200),0,1].join(',') + ')';
|
||||
})
|
||||
.add('matrix3d-string', function() {
|
||||
document.getElementById('mover').style.webkitTransform = 'matrix3d(' +
|
||||
'1,0,0,0,0,1,0,0,0,0,1,0,' +
|
||||
(~~(Math.random() * 200)) + ',' +
|
||||
(~~(Math.random() * 200)) + ',0,1)';
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,67 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rounded coordinates</title>
|
||||
<style>
|
||||
#mover {
|
||||
width:10px;
|
||||
height:10px;
|
||||
background:black;
|
||||
}
|
||||
#moved {
|
||||
width:5px;
|
||||
height:5px;
|
||||
background:red;
|
||||
}
|
||||
pre {
|
||||
position:absolute;
|
||||
top:120px;
|
||||
width:500px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='mover'>
|
||||
<div id='moved'></div>
|
||||
</div>
|
||||
<pre id='report'></pre>
|
||||
<script src="benchmark.js"></script>
|
||||
<script>
|
||||
var suite = new Benchmark.Suite;
|
||||
// add tests
|
||||
suite
|
||||
.add('translate', function() {
|
||||
document.getElementById('mover').style.MozTransform = 'translate(' +
|
||||
~~(Math.random() * 100) + 'px,' + ~~(Math.random() * 100) + 'px)';
|
||||
})
|
||||
.add('translate3d', function() {
|
||||
document.getElementById('mover').style.MozTransform = 'translate3d(' +
|
||||
~~((Math.random() * 100)) + 'px,' + ~~((Math.random() * 100)) + 'px, 0px)';
|
||||
})
|
||||
.add('matrix3d', function() {
|
||||
document.getElementById('mover').style.MozTransform = 'matrix3d(' +
|
||||
[1,0,0,0,
|
||||
0,1,0,0,
|
||||
0,0,1,0,
|
||||
~~(Math.random() * 100),
|
||||
~~(Math.random() * 100),0,1].join(',') + ')';
|
||||
})
|
||||
.add('matrix3d-string', function() {
|
||||
document.getElementById('mover').style.MozTransform = 'matrix3d(' +
|
||||
'1,0,0,0,0,1,0,0,0,0,1,0,' +
|
||||
(~~(Math.random() * 100)) + ',' +
|
||||
(~~(Math.random() * 100)) + ',0,1)';
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
document.getElementById('report').innerHTML +=
|
||||
String(event.target) + '\n';
|
||||
})
|
||||
.on('complete', function() {
|
||||
document.getElementById('report').innerHTML +=
|
||||
'Fastest is ' + this.filter('fastest').pluck('name') + '\n';
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
</script>
|
||||
</body>
|
||||
Reference in New Issue
Block a user