This is attempting to proof the idea that making big changes to a DOM offscreen is faster than doing them onscreen. So far results are not conclusive, whether due to SVG or something else.
xxxxxxxxxx
<meta charset="utf-8">
<title>SVG Swarm</title>
<style>
svg {
position: absolute;
top: 0;
}
path {
fill:none;
stroke-width:1;
stroke:#000;
}
#fps {
font-size:50px;
background:#fff;
}
</style>
<div id='chart'></div>
<div id="fps">FPS: <span>?</span></div>
<script src="https://d3js.org/d3.v2.min.js?2.9.1"></script>
<script>
var data = d3.range(10000);
var width = 960,
height = 500;
var x = d3.scale.linear()
.domain([0, 1])
.range([0, width]);
var y = d3.scale.linear()
.domain([0, 1])
.range([100, height]);
var time0 = Date.now(),
time1;
var fps = d3.select("#fps span");
var svg = d3.select("#chart").append("svg")
.attr("width", width)
.attr("height", height);
var g = svg.append('g').attr('width', 500).attr('height', 960);
var p = g.selectAll("circle")
.data(data)
.enter()
.append('circle')
.attr('r', 2)
.attr('transform', function(d, i) { return 'translate(' + [x(Math.random()), y(Math.random())] + ')'; });
var fpsqueue = [];
var rb = d3.interpolateRgb('#FF0000', '#0080FF');
d3.timer(function() {
p.attr('transform', function(d, i) { return 'translate(' + [x(Math.random()), y(Math.random())] + ')'; });
time1 = Date.now();
if (fpsqueue.length === 100) { fps.text(d3.mean(fpsqueue).toFixed(3)); fpsqueue = []; }
fpsqueue.push(Math.round(1000 / (time1 - time0)));
time0 = time1;
});
</script>
Modified http://d3js.org/d3.v2.min.js?2.9.1 to a secure url
https://d3js.org/d3.v2.min.js?2.9.1