jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script src="https://raw.github.com/mrdoob/three.js/master/build/three.min.js"></script>
<script>
var THREEr50 = THREE;
</script>
<script>
var camera = new THREEr50.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.set( 0, 300, 50 );
scene = new THREEr50.Scene();
var cubes = new THREEr50.Object3D();
scene.add(cubes);
var geometry = new THREEr50.CubeGeometry( 20, 20, 20 );
for ( var i = 0; i < 50; i ++ ) {
var object = new THREEr50.Mesh( geometry, new THREEr50.MeshLambertMaterial( { color: (i/50) * 0xffffff } ) );
object.position.x = (i/50) * 800 - 400;
object.position.y = (i/50) * 800 - 400;
object.position.z = (i/50) * 800 - 400;
object.rotation.x = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.y = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.z = ( (i/50) * 360 ) * Math.PI / 180;
object.scale.x = (i/50) * 2 + 1;
object.scale.y = (i/50) * 2 + 1;
object.scale.z = (i/50) * 2 + 1;
cubes.add( object );
object.updateMatrixWorld();
}
var planes = new THREEr50.Object3D();
scene.add(planes);
var geometry = new THREEr50.PlaneGeometry( 20, 20);
for ( var i = 0; i < 50; i ++ ) {
var object = new THREEr50.Mesh( geometry, new THREEr50.MeshLambertMaterial( { color: (i/50) * 0xffffff } ) );
object.position.x = (i/50) * 800 - 400;
object.position.y = (i/50) * 800 - 400;
object.position.z = (i/50) * 800 - 400;
object.rotation.x = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.y = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.z = ( (i/50) * 360 ) * Math.PI / 180;
object.scale.x = (i/50) * 2 + 1;
object.scale.y = (i/50) * 2 + 1;
object.scale.z = (i/50) * 2 + 1;
planes.add( object );
object.updateMatrixWorld();
}
var combined = new THREEr50.Object3D();
scene.add(combined);
var geometry = new THREEr50.CubeGeometry( 20, 20,20);
var combGeometry = new THREEr50.CubeGeometry( 20, 20,20);
for ( var i = 0; i < 50; i ++ ) {
var object = new THREEr50.Mesh( geometry, new THREEr50.MeshLambertMaterial( { color: (i/50) * 0xffffff } ) );
object.position.x = (i/50) * 800 - 400;
object.position.y = (i/50) * 800 - 400;
object.position.z = (i/50) * 800 - 400;
object.rotation.x = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.y = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.z = ( (i/50) * 360 ) * Math.PI / 180;
object.scale.x = (i/50) * 2 + 1;
object.scale.y = (i/50) * 2 + 1;
object.scale.z = (i/50) * 2 + 1;
THREEr50.GeometryUtils.merge(combGeometry, object );
}
var object = new THREEr50.Mesh( combGeometry, new THREEr50.MeshLambertMaterial( { color: 0.5 * 0xffffff } ) );
combined.add(object);
object.updateMatrixWorld();
var vector = new THREEr50.Vector3( 0, 0, 0 );
projector = new THREEr50.Projector();
projector.unprojectVector( vector, camera );
var ray= new THREEr50.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
var spheres = new THREEr50.Object3D();
scene.add(cubes);
var geometry = new THREEr50.SphereGeometry( 20, 20, 20 );
for ( var i = 0; i < 50; i ++ ) {
var object = new THREEr50.Mesh( geometry, new THREEr50.MeshLambertMaterial( { color: (i/50) * 0xffffff } ) );
object.position.x = (i/50) * 800 - 400;
object.position.y = (i/50) * 800 - 400;
object.position.z = (i/50) * 800 - 400;
object.rotation.x = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.y = ( (i/50) * 360 ) * Math.PI / 180;
object.rotation.z = ( (i/50) * 360 ) * Math.PI / 180;
object.scale.x = (i/50) * 2 + 1;
object.scale.y = (i/50) * 2 + 1;
object.scale.z = (i/50) * 2 + 1;
spheres.add( object );
object.updateMatrixWorld();
}
var rayr50 = ray;
var cubesr50 = cubes;
var planesr50 = planes;
var spheresr50 = spheres;
var combinedr50 = combined;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
cubes r50 |
| ready |
planes r50 |
| ready |
combined r50 |
| ready |
spheres r50 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.