Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vcacheoptimizer: Improve meshopt_optimizeVertexCache performance by ~15%
The core of this algorithm has a few branches in the inner loops that are all difficult to predict. The triangle scoring was already optimized to cmov by clang/gcc, but the cache copy wasn't - and the result consumed a surprisingly large fraction of the total compute; making that code branchless yielded ~7% speedup by itself. The other ~7% speedup is achieved by a live_triangles check during scoring update; there's no need to update anything if we aren't going to use this vertex again. This is likely to be less effective on other meshes, but it's rather effective on Buddha mesh. Note: live_triangles is equivalent to adjacency.counts at the point of cache score update, but checking adjacency.counts generates better code on clang.
- Loading branch information