Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
My website is taking so much CPU on my computer

here is my performance for 2 secondsThe tab that has 36% cpu usage is the tab of my website

I'm using django with pure css and js in this project and it seems that my website is consuming so much cpu, also i'm using a gradient animation with css:

body {
  background: linear-gradient(to right, rgb(247, 85, 202), rgb(18, 103, 248));
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}
.nav-link,
.navbar-brand,
.nav-link:hover,
.navbar-brand:hover {
  background: linear-gradient(to right, rgb(247, 85, 202), rgb(18, 103, 248));
  -webkit-background-clip: text;
  background-size: 400% 400%;
  color: transparent;
  animation: gradient 15s ease infinite;
}
@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

In addition i'm using an event listener to the whole document using Javascript:

document.querySelectorAll('.edit').forEach((button) => {
  .
  .
  .
})
document.querySelectorAll('.filter-green').forEach(like => {...})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your problem is the use of animation on gradient background - if just on the body element then on my system (Windows 10/Edge reasonably powerful laptop) I don't see so much CPU being utilised, but the GPU usage is very high (around 48%).

If I then bring in the animations on the other two elements which have animated backgrounds the GPU goes up to anything between 60% and 75%.

So start by deciding what really has to have an animated background. I suspect it's the body that you want to show this, and remove the animations from the other elements.

You still have high either CPU or GPU usage and your users will not thank you for such battery-flattening behavior.

I would suggest you either scrap the idea of animating this type of gradient or at minimum provide a way for your users to switch it on and off. In any case, pay attention to whether they have asked for a low-motion site - some people react badly to movement on the screen.

See MDN for info on accessibility and animation.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda