Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:23:26+00:00 2026-06-09T07:23:26+00:00

I know that one of the most expensive operations in HTML5 gamedev is drawing

  • 0

I know that one of the most expensive operations in HTML5 gamedev is drawing on the canvas. But, what about drawing images outside of it? How expensive is that? What exactly happens when the canvas is 100 by 100 pixels and I try to draw an image at (1000, 1000)? Would checking sprite coordinates to make sure it is inside the canvas make rendering more efficient?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:23:29+00:00Added an answer on June 9, 2026 at 7:23 am

    In these tests I used Google Chrome version 21.0.1180.57.

    I’ve made a small fiddle that tests this situation… You can check it out here: http://jsfiddle.net/Yannbane/Tnahv/.

    I’ve ran the tests 1000000 times, and this is the data I got:

    Rendering the image inside the canvas lasted 2399 milliseconds.
    Rendering the image outside the canvas lasted 888 milliseconds.

    This means that drawing outside the canvas does take some time, roughly, 37% of time it would take to render it inside.

    Conclusion: It’s better to check if the image is inside the canvas before rendering it.

    But, of course, I wanted to know how much better… So, I did another test. This time, I, of course, implemented boundary checking, and got that it only took 3 milliseconds to “render” the image outside the canvas 1000000 times. That’s 29600% better than simply rendering it outside.

    You can see those tests here: http://jsfiddle.net/Yannbane/PVZnz/3/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that user agents are one indicator, but that's easy to spoof. What
I know that ScrollView can have only one Child but in my case I
One thing that I find most annoying about OOP is that whenever you need
We all know that we're supposed to combine our CSS into one file, but
I know that one of the differences between classes and structs is that struct
I know that one can define an 'expected' exception in JUnit, doing: @Test(expect=MyException.class) public
I would like to know how to measure/know that one's stored procedure is optimum
Before somebody points me to that question, I know that one can't parse html
In Xcode 4.2, I know that one can use the storyboard segue to have
I want to know that how one should proceed in building animated splash screen.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.