Hacker News

Show HN: Avoid smooth spinners, use low-FPS spinners

20 points by nh2 ago | 25 comments
I got so annoyed by various apps (VScode, Chromium, Firefox, Thunderbird) burning CPU/GPU cycles and and making my laptop hot and sluggish with spinners on otherwise static content, that I made this little page to fight this.

4d4m |next [-]

Can this be done in a lightweight way that uses less resources at full speed?

Low fps seems jerky/retro?

nh2 |root |parent [-]

Probably no.

Does "Square ring" really look jerky/retro?

4d4m |root |parent [-]

Square ring and the 2x2 look smooth!

Diti |next |previous [-]

Those aren’t spinners (also called numeric updowns, see [1]). Those are throbbers (also called loading icons, see [2]).

[1]: https://en.wikipedia.org/wiki/Spinner_(computing)

[2]: https://en.wikipedia.org/wiki/Throbber

zaep |root |parent |next [-]

This is a rare instance where I think Wikipedia is plain wrong. Maybe the process to have multiple pages renamed is onerous? The thing in the original post I've usually heard to be called spinners, while this input element, which I'm not sure I've ever even seen, doesn't seem to have its name justified in any way on the Wikipedia page either. I can't really tell why it'd desperately need a concise name either, it's basically a numeric input with extra controls on it? anyhow, spinners spin and those spin so they're spinners, I won't hear otherwise.

Diti |root |parent |next [-]

Mozilla employees up until recently (2024), and research literature, seem to be calling them throbbers as well.

Anecdotally, I’ve only ever heard non-frontend developers call them “spinners”.

Maybe starting a discussion on the articles’ talk page could elicit some change? Language evolves, after all.

nh2 |root |parent [-]

> I’ve only ever heard non-frontend developers call them “spinners”

Such as these non-frontend devs?

https://getbootstrap.com/docs/5.3/components/spinners/

nom |root |parent |previous [-]

spin boxes date back to windows 95 and were part of the windows common controls, often called spinners

https://learn.microsoft.com/en-us/previous-versions/windows/...

I think they fell out of fashion after the scroll wheel was invented

creatonez |root |parent |next |previous [-]

> [1]: https://en.wikipedia.org/wiki/Spinner_(computing)

Hah, I did not expect that. I can't imagine any end users will be able to name that one.

pwdisswordfishq |root |parent |next |previous [-]

To be fair, those do spin, while "spinners" don't.

adastra22 |root |parent |previous [-]

That’s not how language works.

Diti |root |parent [-]

That is how language works.

account42 |root |parent [-]

The general public says: no.

echoangle |next |previous [-]

Your claimed GPU usage seems really high for a simple spinner, even considering the CPU is pretty old. I wonder if there's some other problem going on with your setup.

nh2 |root |parent [-]

I don't think so. This is just what happens when you redraw the screen.

Doing it 30x more frequent than needed costs more, no matter if it's only 1 pixel.

This problem is not isolated to me or to just one machine. Check out the chromium bug about the tab loading spinner, for example. It is a "simple" spinner as well.

Or the Zed editor, which spams screen redraws even when nothing changes at all, so it has high GPU usage for still picture.

adastra22 |root |parent |next [-]

It should not cost a visible fraction of CPU/GPU to update a little sprite even at 30fps.

nh2 |root |parent [-]

But it does. The GPU rerenders your entire screen with all its pixels, even if you change only one. The only thing you can do to avoid that is to not ask the GPU to render a frame. For that you need to reduce FPS.

SR2Z |root |parent |next [-]

You need a fairly modern laptop to change the screen refresh rate like you're describing. Older laptops do 60Hz (or whatever) refreshes at all times, they can't change refresh rates like that. The compositor should only paint relevant pixels on the screen.

I'm sure that some spinners are horrible and peg the CPU, but unless your machine is older than ~2018 there is something wrong with your setup if spinners (and not intense operations behind them) cause your battery to suffer.

nh2 |root |parent [-]

I'm not describing anything about screen refresh rates, which I'm pretty sure are 60 Hz on my laptop even when the CPU+GPU are at 0% and don't draw anything. Compute != monitor refresh.

Timon3 |root |parent |previous [-]

Did I totally miss how damage tracking has gone out of fashion, or what do you base this on?

nh2 |root |parent [-]

The damage tracking doesn't seem to be effective at reducing the computational cost. Measurement:

Opening https://nh2.me/low-fps-spinners/smooth-spinner.html it doesn't matter if I zoom the spinner to 25% or 500%: Despite the 400x difference in pixels redrawn, the "GPU Process" CPU usage in the "Browser" tab of the Chromium Shift+Esc task manager is equally high.

It only scales down the cost when reducing the FPS.

Lord-Jobo |root |parent |next |previous [-]

I miss the 1 update per second animations of ye olden times, even if it would be ugly as sin in a modern product.

jy14898 |root |parent |previous [-]

I'm on mobile so I'm not able to check, but can the will-change and contain attributes reduce the cost?

nh2 |root |parent [-]

Avoiding unnecessary browser repaint of the rest of the page is a basic technique and often already done correctly. If people don't do that, it's just ultra-bad.

But do really have the CPU/GPU go idle, you need to not use them; the only solution to that is to show still images, aka reduce FPS.

nonamesleft |previous [-]

I truly wish i could get everything to use the ticking clock one at 1Hz (or maybe 0.5) for spinners, animation in user interfaces causes me anguish in general, so i have to go around filtering them on webapps.