Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate why homepage is slow on firefox on linux #14

Open
eh-am opened this issue Nov 22, 2021 · 3 comments
Open

Investigate why homepage is slow on firefox on linux #14

eh-am opened this issue Nov 22, 2021 · 3 comments

Comments

@eh-am
Copy link
Contributor

eh-am commented Nov 22, 2021

The homepage is incredible slow on firefox.

Initially I assumed it was a problem with an extension, but @abeaumont confirmed it also happens on his computer. He also said CPU usage goes to 100%, he thinks must be something with video rendering.

@petethepig
Copy link
Member

or might be the cloud rendering at the bottom of the page

@abeaumont
Copy link
Contributor

I have checked and @petethepig is right, the problem seems to be with the canvas rendering in the cloud section. Removing https://github.com/pyroscope-io/docs/blob/main/src/pages/index.js#L274 makes the problem disappear.

@eh-am
Copy link
Contributor Author

eh-am commented Dec 14, 2021

I had a look at this some time ago, here's my brain dump (before GC kicks in and I completely forget these):

  • these setInterval for the typing effect don't help. Plus it's slightly annoying from user perspective
  • the cloud rendering is indeed slow
    • the code can be optimized a bit, but nothing that makes THE difference
    • it looks like we render into many canvas (one per puff)
      this.ctx.drawImage(this.puff.img, cX + this.points[i][0], cY + this.points[i][1]);
    • and then we render that against the real canvas
      context.drawImage(clouds[i].img, clouds[i].x - clouds[i].img.width / 2, clouds[i].y - clouds[i].img.height / 2);
    • from what I've seen, rendering off a canvas into another canvas seems to be slow, don't know exactly why (I assume it involves certain lower level optimizations that firefox get it wrong)

One thing we could do that is somewhat "good enough" is rendering a single cloud and don't move it.
Except that it's still gonna be slow when you just load the page. So I still recommend having a look on how to optimize this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants