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 7416325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:28:28+00:00 2026-05-29T07:28:28+00:00

Canvas clearing gets vastly different perfomance on different browsers. See http://jsperf.com/canvas-clearing2 . I need

  • 0

Canvas clearing gets vastly different perfomance on different browsers. See http://jsperf.com/canvas-clearing2 .

I need to clear a canvas every frame and how I do it has a huge impact on mobile safari vs Desktop safari performance. Desktop Safari likes canvas.width = width but mobile safari prefers canvas.drawRect() .

Is there a way to detect what browser is what an run different JavaScript based on it? I would prefer to do this through JavaScript rather than server side.

Also, I’ve found that jQuery’s $.browser doesn’t help because it doesn’t distinguish between mobile safari and desktop safari. the navigator object has similar problems.

  • 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-05-29T07:28:29+00:00Added an answer on May 29, 2026 at 7:28 am

    Targeting specific browsers is always a bit of a problem. While there are certainly ways to do it, it’s not a particularly maintainable way to do it because there are lots of different browsers and versions of each browser and those browsers change over time, thus which browsers are optimized by which code can be changing all the time. This creates quite a maintenance headache. For example, mobile Safari on an iPod Touch has very different performance characteristics than mobile Safari on each different generation of iPhone or iPad.

    So … instead of trying to detect the type of browser, it’s much better to either do feature detection or performance detection and dynamically adjust based on how any given browser reacts. Done right, this can work equally well for all browsers, even browsers you’ve never seen or that aren’t even released yet.

    In your case, you could devise a quick performance test that tests the performance of each of your two methods. If there’s really a big performance difference between the two methods, then you could probably tell the difference in a matter of a few hundred milliseconds, set a cookie on the local browser indicating the method that works best and then just use the preferred method in that browser from then on. If you wanted to, you could let the cookie expire every few months (so it would get retested every once in a while) or you could put the exact browser version into the cookie too and reruns the tests and set a new cookie if the browser version every changed (software upgrades).

    In this way, your code would always be using the fastest version of your code in all browsers, now and forever without you ever having to maintain/test zillions of browsers to know which should be used for each.

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

Sidebar

Related Questions

Canvas with absolute position doesn't work as you can see here: http://jsfiddle.net/733zs/1/ (Tested in
canvas.MouseMove.Add(move canvas update) MouseMove.Add( p1 p2 p3) Usually I see this use and documentation,
I have a canvas on my WPF form that I need to run a
I've got a canvas object that I need to be able to create at
HTML5 canvas provides lots of flexibility to draw images using javascript. We need to
my renderer contains a canvas in it, i add some title-window, every time i
If I had a Canvas with n number of Visual objects of any shape
Given the following canvas: <Canvas> <Canvas.LayoutTransform> <ScaleTransform ScaleX=1 ScaleY=1 CenterX=.5 CenterY=.5 /> </Canvas.LayoutTransform> <Button
I have set a canvas' background to an image of a company logo. I
I have a main canvas 'blackboard' in a panel, this canvas has itself several

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.