Giter Site home page Giter Site logo

Comments (12)

fgnass avatar fgnass commented on June 11, 2024

With only one throbber and shadows turned off things already look much better.

It would probably make sense to reduce the number of animations. One approach would be to use a rotation instead of opacity animations. I did this in a jQuery plugin I wrote about a year ago: http://neteye.github.com/activity-indicator.html
The page contains 5 throbbers and uses much less CPU.

The problem is that the rotation sometimes becomes eccentric when you zoom in on iOS. Also it doesn't look that smooth with a small number of lines.

Another alternative could be using canvas, like Thijs van der Vossen did here:
http://stuff.vandervossen.net/temporary/spinner.html

from spin.js.

stephanerangaya avatar stephanerangaya commented on June 11, 2024

FYI The animation works fine in every browsers but it's very slow on IE 7 to 9.

from spin.js.

SeanJA avatar SeanJA commented on June 11, 2024

@stephanerangaya This is probably not the place for this discussion, but perhaps it is your computer? It works fine on IE9 here, I am not about to go and install a bunch of other versions of it to test though.

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

On my machine (a MacBook Pro) all tested IE versions perform unexpectedly well, indeed they even outperform Chrome.

IE6, IE8, IE9 (running inside VirtualBox): Very smooth animation, 0-2% CPU

Among the WebKit browsers, Safari currently wins:

  • Chrome 14: 8-10% (Google Chrome Renderer)
  • Safari 5.1: 4-5%

The only two browsers that currently suck (CPU-wise) are Firefox and Opera:

  • Opera 11: ~20%
  • Firefox 6: ~41%, even up to 77% with shadows turned on (!)

The animation runs smoothly on an iPad 1, but I have no idea how to measure the CPU impact there.

I'll leave this issue open so that others can post their performance stats here, too.

from spin.js.

dlikhten avatar dlikhten commented on June 11, 2024

Hmm, perhaps disable some options like shadow on firefox/opera until a fix is available?

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

When forced into using a setTimeout()-based animation with 16fps, the CPU usage drops to ~20% in both Opera and Firefox. This might be an option, but I'd really like to get around UA-sniffing somehow ...

from spin.js.

dlikhten avatar dlikhten commented on June 11, 2024

~20% is better but still bad. Can we do better? I mean I would argue that above a few % max is already too much. A regular spinner image which can easily be generated and uses very little CPU, it would be wrong to have this "feature" and murder the CPU all in the name of a few bytes transferred.

I would say implement the setTimeout methodology for now, but I can't in good conscience ship this code to prod until the cpu utilization is super low.

http://neteye.github.com/activity-indicator.html

The demo page has 5 indicators and uses a fraction of the CPU as a single-indicator spin.js. BTW spin.js did not load in my FF beta for demo page so thats bad, no comparisons possible. Chrome's utilization was < 1% for the 5x activity-indicator vs 3% for spin.js on windows 7 x64.

Though even the other site has about 20% utilization of a single core when running 5x spinners. Which I assume would be about 5% on one spinner.

from spin.js.

glennfu avatar glennfu commented on June 11, 2024

I read in the jQuery 1.6 patch notes this line: "Additionally jQuery is now using the new requestAnimationFrame method provided by browsers to make our animations even smoother. We can use this functionality to avoid calling timers and instead depend upon the browser to provide the best possible animation experience." Is that something that can be taken advantage of here? https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame is the link to the specific feature. Sorry if this is irrelevant, just hoping to help!

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

@glennfu In my earlier tests requestAnimationFrame() resulted in even higher CPU usage due to the increased frame rate.

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

BTW, when I view a GIF on http://ajaxload.info/ in Firefox, CPU load is at ~16%. Maybe this is related to one of these bugs: 595671, 645761, 484793. I'll try to reset my profile and check CPU usage on other platforms and in older FF versions.

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

Under Windows XP Firefox 6.0.2 only uses 0-3% CPU so this seems indeed to be a MacOS-only issue.

from spin.js.

BYK avatar BYK commented on June 11, 2024

@fgnass requestAnimationFrame has a second optional argument for WebKit based browsers where you give the bounding element for the animation which usually helps with performance. Have you tried using that? The behavior is documented on the related MDN page.

from spin.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.