diff --git a/.gitignore b/.gitignore index c5054d7fd..da1ca5509 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ jsdoc-toolkit dist tests/js/unitTests.js +analysis # Numerous always-ignore extensions *.diff diff --git a/tests/js/performanceTests.js b/tests/js/performanceTests.js index 6aad34ff3..34f920fff 100644 --- a/tests/js/performanceTests.js +++ b/tests/js/performanceTests.js @@ -1,5 +1,5 @@ Test.Modules.PERFORMANCE = { - '*draw 1000 cropped images': function(containerId) { + 'draw 1000 cropped and scaled images': function(containerId) { var imageObj = new Image(); imageObj.onload = function() { var stage = new Kinetic.Stage({ @@ -25,13 +25,75 @@ Test.Modules.PERFORMANCE = { layer.add(darth); } + stage.add(layer); + endTimer('draw 1000 cropped and scaled images'); + + }; + imageObj.src = '../assets/darth-vader.jpg'; + }, + 'draw 1000 cropped images': function(containerId) { + var imageObj = new Image(); + imageObj.onload = function() { + var stage = new Kinetic.Stage({ + container: containerId, + width: 578, + height: 200 + }); + var layer = new Kinetic.Layer(); + + startTimer(); + for(var n = 0; n < 1000; n++) { + var darth = new Kinetic.Image({ + x: 200, + y: 75, + image: imageObj, + width: 53, + height: 37, + crop: [186, 211, 292 - 186, 285 - 211], + draggable: true + }); + + layer.add(darth); + } + stage.add(layer); endTimer('draw 1000 cropped images'); }; imageObj.src = '../assets/darth-vader.jpg'; }, - '*draw 1000 pre-processed cropped images': function(containerId) { + 'draw 1000 scaled images': function(containerId) { + var imageObj = new Image(); + imageObj.onload = function() { + var stage = new Kinetic.Stage({ + container: containerId, + width: 578, + height: 200 + }); + var layer = new Kinetic.Layer(); + + startTimer(); + for(var n = 0; n < 1000; n++) { + var darth = new Kinetic.Image({ + x: 200, + y: 75, + image: imageObj, + width: 107, + height: 75, + draggable: true, + scale: 0.5 + }); + + layer.add(darth); + } + + stage.add(layer); + endTimer('draw 1000 scaled images'); + + }; + imageObj.src = '../assets/darth-vader.jpg'; + }, + '*draw 1000 pre-processed cropped and scaled images': function(containerId) { var imageObj = new Image(); imageObj.onload = function() { var stage = new Kinetic.Stage({