Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Could the CPU load be reduced? If I am only on the page, not even playing any music yet (probably because something is blocked), I get 1 core up at 100% CPU load. This can't all be for an animated background image, can it?


view as:

Looks like it is, if I remove the 4 gifs stacked on top of each other CPU usage drops massively.

It appears that every GIF frame is a Chrome paint (which makes sense) but a way to make the GIF static or turn off the GIFs would reduce paints down to basically nothing.

If it's only a few frames you might be able to arrange them vertically in a PNG and animate background-position to get the same effect for cheaper.

Correction: you want to use transform to force creation of a new rendering layer, then when adjusting the rendered position of the element using transform will not cause a repaint.


Ouch. What's wrong with APNG?

https://caniuse.com/apng


I figure it will have the same problem as GIF which is that each frame triggers a repaint.

Ouch you're totally right. I want to add an option to have static JPGs instead of GIFs. Already added to the backlog.

Video may be cheap, too: h.264 or WebM are relatively low cost on even reasonably modern devices.

I would go for videos + options to go with static assets. You could pause background video playback when the tab is not active.

My tests show the tab does not consume much when it is not visible.

To go in the opposite direction, if you wanted to add an option for people fine with large CPU/GPU expenditure (i.e., if this were playing on a dedicated TV in an actual café), it might be fun to add a WebGL canvas and make lofi/vaporwave-inspired effects [0].

[0]: http://hands.wtf/rad


Why would you ever target wasting CPU/GPU when better alternatives are available?

I actually really like this feature when playing music for a whole room on my OLED TV. People like watching the fancy graphics and I get to dodge a tiny little bit of burn in.

You missed the part of better alternatives. I didn't mean to turn off the anim, just switch it to a more efficient method of doing it.

What are the better alternatives?

I'm guessing pre-rendered animations. Better alternative if you're optimizing for performance, but maybe not if we're optimizing for other metrics.

It might be cool.

It might be cool to needlessly spin up a CPU/GPU for no reason other than not being familiar with a more effectient method of doing something? I don't know where you come from, but that's not my definition of cool at all

Video cheaper than animated gif?

Yeah, lower bandwidth requirements and most computers/all smartphones have dedicated video decoding hardware, especially for h264.

Hinted at with lower bandwidth requirements, but the biggest win with video is their stellar compression. GIFs store every single color value, which is why they get so huge so quick.

GIFs use run length encoding, which usually makes them quite good for pixelly art, but not when you apply a bunch of vfx.

Yep. For example, here is Fill's GIFs site[0], where comic animation on pages represented as video instead of GIF.[1]

    ...
    <video autoplay="" loop="" muted="">
      <source src="/video/aa3d713c20ba03cc3f87b36e9a947857.mp4" type="video/mp4">
    </video>
    ...

[0] https://fill.com.ua/

[1] https://fill.com.ua/gif/zagostrennya


So efficiency, much wow

I wonder if they're crypto-mining.

Same. I use a miniPC with a loud (by design constraints) fan when load is pegged. It ran like a jet engine on this site.

Gotta pay for hosting with some monero mining

Hey, just wanted to let you know I've just pushed a "low-energy" mode that will remove some elements and effects on screen. On my Mac (MBP with M1 chip) it makes the webview go from 40% CPU to around 10-15%.

You can activate it by pressing "l".


Legal | privacy