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

USDZ archive lookup is O(n^2) #1577

Closed
marsupial opened this issue Jul 29, 2021 · 1 comment
Closed

USDZ archive lookup is O(n^2) #1577

marsupial opened this issue Jul 29, 2021 · 1 comment

Comments

@marsupial
Copy link
Contributor

Description of Issue

USDZ is linearly traversing the archive for every lookup, which creates a huge bottleneck and is very noticeable once you pass ~10000 entries.

This was noticed by someone who is trying to use USD and Draco compression, which means every mesh will be referencing an external file. While not the most common use-case, the issue will also be at play even in a flat USD scene that makes heavy use of unique textures, or for a heavily referenced scene that just wants to be bundled into one file.

Steps to Reproduce

  1. Generate a usdz file with around 25000 external references, and then Open the stage. Even when those references are all nothing more than a single plane, load time will be above 15 seconds, while the original usdc takes under 3 seconds.
@jilliene
Copy link

jilliene commented Aug 6, 2021

Filed as internal issue #USD-6816

lkerley pushed a commit to imageworks/USD that referenced this issue Jan 7, 2022
…l references.

The idea for this change and the initial implementation were
contributed by @marsupial in PR PixarAnimationStudios#1578. I did some further
simplifications, cleanup to conform to our standard style,
and added a C++ unit test to exercise iterator behavior.

From the original submission:

While linearly traversing the **usdz** archive, cache the path and header
information so that subsequent lookups can be accelerated.

This brings down load time of a **usdz** file that was taking ~3 minutes
to ~16 seconds, and can often wind up performing better than parsing the
original **usdc** file that generated the **usdz** (likely because IO is
avoided on the references as the files are _in memory_ from the archive).

Fixes PixarAnimationStudios#1577

(Internal change: 2205950)
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