Skip to content

Use linear scan for flexcomp unused-point reindexing - #3423

Open
teerthsharma wants to merge 1 commit into
google-deepmind:mainfrom
teerthsharma:feat/flexcomp-prefix
Open

Use linear scan for flexcomp unused-point reindexing#3423
teerthsharma wants to merge 1 commit into
google-deepmind:mainfrom
teerthsharma:feat/flexcomp-prefix

Conversation

@teerthsharma

Copy link
Copy Markdown
Contributor

Summary

  • replace flexcomp's per-unused-point suffix updates with an equivalent prefix count
  • preserve reindex behavior for leading, interleaved, and trailing unused points
  • add an end-to-end regression covering elements, texcoords, bodies, positions, pins, and flex vertices

Fixes #3422.

Performance

The old loop performs Theta(P * U) updates for P input points and U
unused points, which is Theta(P^2) in the worst case. The replacement is one
Theta(P) scan with constant additional state.

For a direct tetrahedral flexcomp with four referenced vertices and increasing
unused input points, median compile time at 32,000 points fell from 51.218 ms to
7.201 ms (7.11x faster, 85.9% less wall time). An all-points-used control found
no material regression. The temporary benchmark used to establish this result
is not included in the patch.

Validation

  • Ubuntu 24.04, Clang 18.1.3, RelWithDebInfo + AddressSanitizer and leak
    detection: all 60 UserFlexTest cases passed
  • Ubuntu 24.04, GCC 14.2, Release: full serial CTest suite passed
    1,926/1,926 tests (one declared locale-dependent test skipped)

@teerthsharma
teerthsharma marked this pull request as ready for review July 23, 2026 11:05
@teerthsharma
teerthsharma marked this pull request as draft July 23, 2026 11:44
@teerthsharma
teerthsharma marked this pull request as ready for review July 23, 2026 14:04
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

Successfully merging this pull request may close these issues.

Flexcomp compilation does quadratic work when removing unused points

1 participant