Script Preparation code:
x
 
$sourceWidth = 100;
$sourceHeight = 100;
$sourceCanvas = document.createElement("canvas");
$sourceCanvas.width = $sourceWidth;
$sourceCanvas.height = $sourceHeight;
$sourceContext = $sourceCanvas.getContext("2d");
$sourceContext.fillStyle = "rgba(0,100,200,1)";
$sourceContext.fillRect(0, 0, $sourceWidth, $sourceHeight);
$destCanvas = document.createElement("canvas");
$destCanvas.width = 3000;
$destCanvas.height = 3000;
$destContext = $destCanvas.getContext("2d");
Tests:
  • Scaling from a small canvas area to a small canvas area (no scaling)

     
    $destContext.drawImage($sourceCanvas, 0, 0, $sourceWidth, $sourceHeight, 0, 0, $sourceWidth, $sourceHeight);
    // Force the drawImage call to be evaluated within this benchmark code:
    $destContext.getImageData(0, 0, 1, 1);
  • Scaling from a small canvas area to a medium canvas area

     
    $destContext.drawImage($sourceCanvas, 0, 0, $sourceWidth, $sourceHeight, 0, 0, 600, 600);
    // Force the drawImage call to be evaluated within this benchmark code:
    $destContext.getImageData(0, 0, 1, 1);
  • Scaling from a small canvas area to a large canvas area

     
    $destContext.drawImage($sourceCanvas, 0, 0, $sourceWidth, $sourceHeight, 0, 0, 3000, 3000);
    // Force the drawImage call to be evaluated within this benchmark code:
    $destContext.getImageData(0, 0, 1, 1);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Scaling from a small canvas area to a small canvas area (no scaling)
    Scaling from a small canvas area to a medium canvas area
    Scaling from a small canvas area to a large canvas area

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 9 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Chrome 124 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Scaling from a small canvas area to a small canvas area (no scaling) 154.7 Ops/sec
Scaling from a small canvas area to a medium canvas area 930.3 Ops/sec
Scaling from a small canvas area to a large canvas area 45.7 Ops/sec