Canvas drawImage Scaling Performance

JavaScript performance comparison

Test case created by digitarald

Preparation code

<img id="image" src="http://jsperf.com/favicon.ico" />
<canvas id="canvas" width="32" height="32"></canvas>
      
<script>
Benchmark.prototype.setup = function() {
  var image = document.getElementById("image"),
    canvas = document.getElementById("canvas"),
    context = canvas.getContext("2d"),
    w = image.width,
    h = image.height;
  
  // clear
  canvas.height = canvas.height;

};
</script>

Preparation code output

<img id="image" src="http://jsperf.com/favicon.ico" /> <canvas id="canvas" width="32" height="32"></canvas>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Scale Down
context.drawImage(image, 0, 0, w, h, 0, 0, w / 2, h / 2);
pending…
Scale Up
context.drawImage(image, 0, 0, w, h, 0, 0, w * 2, h * 2);
pending…
Scale Half Up
context.drawImage(image, 0, 0, w, h, 0, 0, w * 1.5, h * 1.5);
pending…
No Scale
context.drawImage(image, 0, 0, w, h, 0, 0, w, h);
pending…
No Scale Short
context.drawImage(image, 0, 0);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

3 Comments

Bnaya commented :

The code doesn't wait the image to load. is that a valid test?

polo2016 commented :

roshe run, juicy couture clothings, michael kors outlet online, iphone 5 cases, oakley outlet, hogan, ray ban sunglasses, michael kors outlet, kanye west shoes, salvatore ferragamo, nfl rams, replica watches, coach outlet, skechers, nfl ravens, tory burch sale, michael kors outlet online sale, jerseys from china, levis outlet store, tommy hilfiger, bcbg max azria, cheap oakley sunglasses, prada handbags, nba jerseys, coach outlet online, thomas sabo uk, michael kors bags, shop coach factory, fred perry shoes, coach bags, polo ralph, valentino shoes outlet, salomon schuhe, shoes on sale, nike.de, nfl 49ers, ray bans, nike online, prada sunglasses, scarpe hogan, kobe bryant jersey, coach factory outlet online, nfl jaguars, new balance shoes, red bottoms, swarovski, michael kors australia, nfl panthers, oakley sunglasses, air jordan shoes, nike outlet store, lunette oakley pas cher, rolex, coach outlet en ligne , timberland boots, nfl buccaneers, cheap basketball shoes, hollister co, lunette ray ban pas cher, coach factory outlet online, charlotte hornets jersey, roshe run, mia jersey, portland trail blazers, chi hair, adidas.de, ralph lauren online, longchamp taschen, adidas sneakers, true religion, nfl bills, adidas shoes outlet, true religion jeans women, mcm handbags, north face jackets, polo outlet online, ecco women shoes, michael kors outlet online, free running, kate spade outlet online, cheap glasses, pandora, uhren, cheap eyeglasses, supra footwear, nike mercurial, uggs, cheap nike shoes, cheap ray ban, designer handbags, designer handbags, nfl bears, barbour mens jackets, nike huaraches, the north face, skechers womens shoes, nfl redskins, nop jerseys, hermes outlet, ray ban sbocco, mizuno running shoes, www.tommyhilfiger.nl, dsquared2 jeans, toms outlet, chicago bulls, coach outlet online, bottega, nike mercurial vapor, converse shoes, denver nuggets , swarovski, burberry, polo ralph lauren outlet online, nfl browns, nfl colts, toms shoes, links of london bracelets, ray ban sunglasses outlet, under armour curry, womens hoodies, ray ban sunglasses, guciheaven, barbour women jackets, ray ban wayfarer, minnesota timberwolves, cheap jerseys, nfl seahawks, fendi outlet online, swarovski, birkenstock outlet, coach outlet, fake rolex, cheap jerseys, jimmy choo, moncler outlet online, louboutin shoes, knicks jerseys, ralph lauren shirts, air max 2014, hermes birkin, nba jerseys outlet, prada outlet, air max 95, philadelphia 76ers jersey, jimmy choo shoes, coach outlet sale, timberland homme, michael kors purses, jerseys from china, coach factory outlet online, longchamp, cheap michael kors, pistons jersey, hollister kids, rayban, omega watches, roshes, ed hardy clothing, louboutin, san antonio spurs, ray ban outlet, versace shoes outlet, hermes bags, nba jerseys, ferragamo outlet, christian louboutin shoes, ralph lauren factory store, birkenstock taschen deutschland, polo ralph lauren, ralph lauren polo, milwaukee bucks, polo ralph lauren, giuseppe shoes, ray ban outlet, lacoste shirts, vans outlet, ralph lauren, toms shoes outlet, polo ralph lauren outlet, kevin durant shoes, soccer outlet online, ralph lauren uk, belstaff sale, fidget spinner, swarovski jewelry, woolrich outlet online, plein outlet, michael kors bags, bottega veneta, kate spade outlet, guess bags outlet, michaelkors.com, longchamp, nike.com, suns jerseys, cheap oakley sunglasses, ferragamo shoes, christian louboutin, hollister clothing store, bos jersey, asics, nike air max, louboutin outlet, softball bats, relojes especiales, jack wolfskin, burberry handbags, michael kors canada, pandora bracelets, replica rolex, coach factory online, timberland shoes, nfl steelers, michael kors, vibram shoes, ralph lauren, toronto raptors, nfl raiders, nike air max 2015, nfl patriots, tommy hilfiger online shop, ralph lauren outlet, salvatore ferragamo, nike.dk, michael kors, nike max, utah jazz, fitflop , converse chucks, ugg australia, true religion jeans outlet, burberry outlet, versace outlet, reebok shoes, gucci womens shoes, ray ban, nike air, nfl chiefs, vans schuhe, the north face, coach outlet, ralph lauren tracksuits, chrome hearts jewelry, burberry, nike outlet, burberry outlet online, polo ralph lauren, calvin klein, michael kors bags, nfl titans, cleveland cavaliers jerseys, nfl lions, toms shoes, new balance, ralph lauren outlet online, vans shoes, nets jersey, thomas sabo, nfl jets, michael kors outlet online sale, nike free shoes, true religion outlet, replica watches, gucci mens shoes, converse, air jordan retro, cheap oakley, nike air force, memphis grizzlies, c&c beanies wholesale, ray ban sunglasses, longchamp handbags, north face, air max, armani clothing, guess jeans, prada, roche run, ray ban, nba jerseys, oakley, long champ, indiana pacers, northface, hollister, converse outlet, puma outlet store, toms outlet, cheap jerseys, moncler women jackets, cheap oakley sunglasses, toms outlet, new balance, baseball jerseys, air jordans, nfl azcardinals, the north face outlet, ferragamo, polo ralph lauren outlet, parajumpers outlet online, pandora, baseball bats, burberry sale, adidas, flat iron, cheap michael kors, nike tn requin, adidas superstar, burberry handbags, nfl saints, cheap true religion, mcm bags, hogan shoes outlet, nike air max, coach outlet, skechers, nike free 5.0, cheap oakley, huaraches, north face outlet, oakley outlet online, orlando magic, mizuno running, replica handbags, hollister, katespade outlet, michael kors handbags, replica watches, nike store, coach black friday, nfl eagles, Hermes, nfl giants, michael kors v?skor, cheap true religion, kate spade, jack wolfskin outlet online, houston rockets, longchamp outlet, mont blanc pens, michaelkors.com, nike roshe, montre pas cher, tommy hilfiger, bcbg dresses, nike air max, rolex replica, michael kors, pandora rings, new balance, oakley prescription, free run, nfl falcons, ralph lauren, oakley sunglasses outlet, tommy hilfiger outlet stores, nike air max, belstaff mens jackets, stone island store, nike roshe, fred perry, nike.se, burberry handbags, iphone 4s cases, jordan release dates, under armour ua shoes, tory burch shoes, north face backpacks, timberland outlet, marc jacobs outlet, celine handbags, ralph lauren, russell westbrook jersey, jerseys from china, coach purses, supra shoes, nfl dolphins, reebok, cheap jerseys, swarovski australia, nfl vikings, pandora rings, nfl bengals, oakley sunglasses, rayban, asics, pandora, watches, adidas.se, adidas neo, lacoste polos, givenchy bags outlet, louboutin, mcm backpack outlet, hugo boss outlet, nike air max 2014, juicy couture, pandora jewellery, babyliss, jordan shoes, philipp plein clothes, abercrombie, hollister online shop deutschland, hilfiger outlet, dallas mavericks jersey, michael kors purses, nike air force, swarovski crystal, longchamp outlet, barbour outlet, nike free run, nba jerseys outlet, air max, mbt shoes outlet, air jordan, nike huarache, michael kors, burberry outlet online, gsw jerseys, nike air, the north face, soccer shoes, michael kors purses, barbour mens jackets, giuseppe zanotti, dansko shoes, ray ban sunglasses, mcm bags, burberry online shop, air max 90, hilfiger, jordans for sale, asics gel, nfl jerseys, coach factory outlet online, ralph lauren outlet, adidas shoes, washington wizards, new balance store, gafas oakley, air max shoes, occhiali oakley, oakley sunglasses cheap, nfl cowboys, zapatillas nike, prada outlet, ralph lauren uk, christian louboutin, marc jacobs handbags, north face pas cher, barbour women jackets, dsquared2 shoes, nfl packers, nfl broncos, nfl texans, mont blanc, tods mens shoes, birkenstock taschen outlet, burberry handbags, wholesale handbags, puma, michael kors outlet online, mcm outlet, ray ban zonnebril, rayban sunglasses, belstaff, oakley, nfl chargers, thomas sabo, sac jerseys, los angeles clippers, oakley sunglasses outlet, burberry outlet online, burberry uk

linying123 commented :

2018.7.21linying

adidas

adidas outlet

vans shoes

jordans

bathing ape

stuart weitzman shoes

tommy hilfiger

nike air max

gucci outlet online

oakley outlet

oakley sunglasses sale

nike blazer

bottega veneta handbags

ray ban

basket nike

nike clothing

carrera sunglasses

dolce and gabbana

nike air max

air max 90

kobe 12

bcbg max

lunette oakley

nike air max

tommy hilfiger

michael kors outlet

pandora jewelry

barbour jackets

dolce & gabbana

longchamp handbags

cheap nfl jerseys

air jordan

air max 2017

hogan

tory burch

nike free

air zoom pegasus

guess handbags

jordans

cartier bracelet

curry 4

nike air force

mulberry handbags

mac cosmetics

ralph lauren

bijoux swarovski

instyler

timberland

montre pas cher

gucci outlet online

nike air max

kobe 9

soccer jerseys

hollister

versace sunglasses

lacoste shoes

yves saint laurent

converse chuck taylor

louboutin shoes

new balance pas cher

basketball jerseys

adidas originals

oakley sunglasses

nike air max

pandora charms

barbour jackets

kevin durant jersey

christian louboutin shoes

giannis antetokounmpo jersey

air max 95

asics shoes

beats headphones

fendi sunglasses

herve leger

armani handbags

germany world cup jersey

nike free run

nike outlet

rolex watches

jordan 12

ray ban occhiali

nike shoes

true religion jeans

champion clothing

longchamp handbags

nike air max

jordan 7s

belgium world cup jerseys

jordan

g-star jeans

fendi handbags

spain world cup jersey

nike outlet store online

balmain jeans

jordan 31

pandora bijoux

jordan 4

wedding dresses

swarovski jewelry

bottega veneta handbags

new balance

coach purse

tommy hilfiger outlet

puma shoes

curry 5

softball bats

abercrombie and fitch

cheap jerseys china

harry winston jewelry

fitflops sale

kobe 10

replica watches

michael kors handbags

kenzo clothing

marc jacobs handbags

michael kors canada

hogan shoes

nike air max

pandora rings

oakley

montre femme

adidas outlet

tod's shoes

calvin klein outlet

balenciaga shoes

nike roshe

jordan

yeezy boost

rolex watches

diesel jeans

oakley sunglasses

salvatore ferragamo shoes

nike vapor max

boy london clothing

nike free run

hermes outlet

jordan shoes

prada

nike blazer

keen sandals

beats by dre

dak prescott jersey

jordan shoes

orologi rolex

james harden jersey

chanel handbags

jordan 11

jordan shoes

guess clothing

jordan 3s

nike free

michael kors

burberry sunglasses

dyson hair dryer

jordan clothing

chrome hearts jewelry

adidas flip-flops

fendi

coach outlet

supra

karen millen

kobe 11

vibram shoes

guess clothing

toms outlet

reebok shoes

antonio brown jersey

alexander mcqueen handbags

nike shoes

kd 9

polo ralph lauren

tory burch outlet

new balance shoes

jordan 2s

air max

ray ban sunglasses

nike huarache

adidas outlet

stuart weitzman

chopard jewelry

adidas outlet

ferragamo handbags

arc'teryx jackets

insanity workout

jordan shoes

nike store

michael kors outlet

christian louboutin

karen millen dresses

burberry outlet

lebron james shoes

asics gel

prada outlet

ralph lauren

jordans

chi flat iron

louboutin outlet

bape clothing

curry 3

air max 95

cheap nfl jerseys

dior handbags

jimmy choo shoes

hermes bags

jordan 1

hogan outlet

burberry outlet online

england world cup jersey

air force 1

dsquared2 outlet

nike mercurial

clarks shoes

vans pas cher

dansko shoes

true religion outlet

salvatore ferragamo sunglasses

iphone case

nike mercurial

nike store

longchamp outlet

ralph lauren outlet

isabel marant shoes

wedding dresses

nike shoes

lacoste jeans

longchamp bags

pandora bracciali

marc jacobs handbags

jimmy choo

polo lacoste

mac cosmetics

swarovski jewelry

kate spade outlet

fossil handbags

nike air max plus

gucci bags

nike tn

salvatore ferragamo

freshjive clothing

brazil world cup jersey

air max 97

jordan xx9

converse shoes

sac longchamp

nike air force

gucci shoes

christian louboutin outlet

kobe 10

air jordan

givenchy handbags

adidas crazy 8

miu miu shoes

jordan 32

chrome hearts

prada handbags

air max 90

lebron 12

ghd hair straighteners

calvin klein jeans

reebok outlet store

pandora jewelry

jordan retro

red bottoms

jordans

michael kors

timberland boots

ray ban

nike shoes canada

10 deep clothing

roshe run

lebron 11

ed hardy

ray ban sunglasses

abercrombie outlet

air max 2017

adidas running shoes

sac vanessa bruno

louboutin pas cher

designer sunglasses

gucci bags

nike roshe

oakley sunglasses

versace handbags

babyliss pro nano titanium

converse shoes

jordan 10s

jimmy choo sunglasses

lunette ray ban

michael kors outlet

insanity workout

fitflop uk

kate spade outlet

nike roshe

oakley sunglasses

nike kyrie 2

bvlgari sunglasses

omega watches

longchamp

kd 10 elite

baseball bats

adidas slides

converse

polo ralph lauren

lululemon sale

kate spade

converse all star

mizuno running shoes

sac michael kors

new balance shoes

sac guess

michael kors handbags

louboutin pas cher

aaron rodgers jersey

mizuno

jordan shoes

ghd hair straighteners

links of london

true religion jeans

mac makeup

burberry bags

nike kyrie 4

adidas superstar

nike roshe

cheap wedding dresses

michael kors outlet

bottega veneta sunglasses

nike air max

huf clothing

dior sunglasses

air max 2018

insanity workout

furla bags

jordan 8s

jordan 6s

jordan 4s

nike outlet

argentina world cup jersey

nike roshe run

abercrombie and fitch

asics running shoes

ralph lauren

true religion jeans

bcbg outlet

jordan 9s

sac longchamp

beats pill

bally shoes

ferragamo shoes

hermes jewelry

adidas soccer cleats

nike air max

sac burberry

mac makeup

nike air more uptempo

celine handbags

ferragamo belts

true religion

replica rolex watches

abercrombie and fitch

montblanc pen

flip flops

michael kors borse

nike store

reebok outlet store

kd shoes

france world cup jersey

tory burch outlet

supra shoes

marc jacobs

adidas zx flux

montre pas cher

adidas outlet

givenchy jewelry

nike air

nike blazer

coach outlet store online

jordan 14s

nike free run

clarisonic mia 2

polo ralph lauren

timberland

chloe bags

christian louboutin

bose headphones

kyrie irving jersey

nfl jerseys

asics gel lyte

nike store

dolce & gabbana sunglasses

nike factory store

air max 90

true religion outlet

manolo blahnik

hermes birkin bag

roshe run

portugal world cup jersey

lululemon outlet

nike free run

skechers sneakers

dansko shoes

salomon shoes

curry 2

valentino shoes

mizuno running shoes

new balance outlet

lunette oakley

dolce and gabbana

chanel bags

polo ralph lauren

nike air max

air max 90

armani sunglasses

beats by dre

alife clothing

michael kors handbags

michael kors outlet

gioielli swarovski

coach outlet

soccer shoes

fitflops sale

burberry clothing

ralph lauren uk

converse

tiffany jewelry

jbl speaker

oakley sunglasses

oakley sunglasses

scarpe nike

nike air max

bulgari jewelry

hollister outlet

dsquared2 jeans

foamposite

michael kors outlet

jordan 13s

hermes uk

basket nike

air max 90

converse shoes

ray ban sunglasses

chaussure nike

basketball shoes

nike air max

jordan 3

oakley sunglasses

salvatore ferragamo shoes

chanel

kids jordans

nike outlet online

gentle monster sunglasses

pandora jewelry

ray ban

adidas trainers

ray ban sunglasses

replica watches

adidas soccer cleats

nike free 5

burberry sale

chloe sunglasses

mulberry handbags

carson wentz jersey

giuseppe zanotti

chloe handbags

jordan 5

kristaps porzingis jersey

toms shoes

vans scarpe

jordan 6

new balance 574

cartier sunglasses

golden goose shoes

ray ban sunglasses

armani jeans

nike outlet

burberry outlet

wedding dresses

montblanc pen

adidas outlet

kd shoes

adidas clothing

parajumpers outlet

iphone x case

goyard handbags

michael kors outlet

ghd hair straighteners

vans outlet

2018.7.21linying