Skip to content

v1.9.0 performance regression #2915

Description

@lucadalli

Description

After upgrading to v1.9, I was able to observe a significant slowdown for the setTexture method. While I was creating a minimal reproduction demo for setTexture, I noticed that initial load performance also suffered a regression. I imagine this stems from the same issue.

Live Demo

https://codepen.io/citylights/pen/qBXRwvX

The Codepen above serves as a primitive way to measure load performance. Alternate between version 1.8.0 and 1.9.0 by changing the script tag at the top of the template.
Top left of the view shows the visible model count followed by the duration taken to load those models.
On my machine I am consistently measuring ~1500ms for v1.8 and ~10,000ms for v1.9 for 10 models.

Version

  • model-viewer: v1.9.0

Browser Affected

  • Chrome, Win 10 Version 94.0.4606.81 (Official Build) (64-bit)
  • Edge
  • Firefox
  • IE
  • Safari

OS

  • Android
  • iOS
  • Linux
  • MacOS
  • Windows

AR

  • WebXR
  • SceneViewer
  • QuickLook

Activity

  1. sprengerst commented on Oct 25, 2021

    @sprengerst

    The overall loading performance seems to be decreasing with 1.9. Experienced on every supported browser. Even with the modelviewer.dev astronaut example on site. So +1

  2. elalish commented on Oct 25, 2021

    @elalish
    Contributor

    Thank you for the awesome repro @lucadalli! I was just noticing some perf issues with three.js, so I'm going to figure out whether this is something we can work around or needs to get fixed upstream.

  3. sprengerst commented on Oct 27, 2021

    @sprengerst
    2021-10-27.11-00-00.mp4

    I attached a video. Loading the modelviewer.dev page and trying to click the "Editor" href. The model loading seems to block the whole webpage functionallity. Even scrolling the page is blocked.

    Browser Affected
    Chrome 95.0.4638.54 (Offizieller Build) (64-Bit)

    OS
    Windows

  4. elalish commented on Oct 27, 2021

    @elalish
    Contributor

    @sprengerst I can't repro that on my mac it seems. Can you paste in a performance profile of page load from dev tools?

  5. sprengerst commented on Oct 27, 2021

    @sprengerst

    @elalish Event the profile generation looks like lagging at sec 3. I have experienced the same issue today on a customer's windows pc too.

    Here is the video:
    https://user-images.githubusercontent.com/6854862/139103794-933233d3-e972-4d41-ab8b-13c685b14705.mp4

    Here is the profile:
    Profile-20211027T180259.zip

    Thanks for the investigation.

  6. elalish commented on Oct 27, 2021

    @elalish
    Contributor

    This looks like a three.js regression; we're looking into it now. I believe the page is interactive while the model downloads, but not while the shader is compiling, and that step has somehow become very slow. On my machine it slowed from 300ms to 700ms, but somehow that windows trace is showing 4,000ms, which is crazy.

  7. elalish commented on Oct 28, 2021

    @elalish
    Contributor

    @lucadalli It might help to have your repro for the setTexture method as well. I do see a big perf slow-down for 10 identical models (caused by reuploading their textures over and over) but that's the same in 1.8 and 1.9 and just something we apparently hadn't optimized because that's kind of an unusual use case. However, I'm seeing the biggest difference between 1.8 and 1.9 for a single model start-up, having to do (I think) with shader compilation. I have yet to see where setTexture might be having an issue.

  8. lucadalli commented on Oct 28, 2021

    @lucadalli
    ContributorAuthor

    @elalish
    https://codepen.io/citylights/pen/WNEEeqV

    I'm not entirely convinced setTexture is the culprit, but the pen above demonstrates a significant slow-down.
    1,600ms (v1.8) vs 17,000ms (v1.9) on my Windows machine.

    Performance profile for v1.9:
    Profile-20211029T002059.zip

  9. elalish commented on Oct 28, 2021

    @elalish
    Contributor

    Interesting; it's 1,700ms for 1.8 and 2,500ms for 1.9 for me. No 10x, but should still be plenty for debug. Very strange.

  10. self-assigned this
    on Oct 28, 2021
  11. elalish commented on Nov 2, 2021

    @elalish
    Contributor

    Reopening, since I had to revert the fix since it was causing a bigger problem: #2949. A proper fix is coming in three.js, but it'll take our next release cycle to resolve.

  12. reopened this on Nov 2, 2021
  13. sprengerst commented on Nov 3, 2021

    @sprengerst

    Oh no :( thanks for the info.
    Can you tell when the next release cycle will happen? It makes whole pages unusable :-/

  14. elalish commented on Nov 3, 2021

    @elalish
    Contributor

    @sprengerst you're welcome to pin to either v1.8 or v1.9.1 until our next release comes, e.g. <script type="module" src="https://unpkg.com/@google/[email protected]/dist/model-viewer.min.js"></script>. It's the holidays, so it'll probably be after the new year.

  15. sprengerst commented on Nov 3, 2021

    @sprengerst

    @elalish Thank you. Holidays? What country do you live in, I think I should join you. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arc: performancetype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions