WIP: Add Rust implementation of triangulation module using PyO3#485
Closed
basnijholt wants to merge 2 commits intomainfrom
Closed
WIP: Add Rust implementation of triangulation module using PyO3#485basnijholt wants to merge 2 commits intomainfrom
basnijholt wants to merge 2 commits intomainfrom
Conversation
This commit introduces a high-performance Rust implementation of the triangulation module for the adaptive library, providing significant speedup for geometric operations. Key changes: - Add Rust project structure with PyO3 bindings (Cargo.toml, src/) - Implement core geometric algorithms in Rust (circumsphere, volume, point_in_simplex) - Create full Bowyer-Watson triangulation algorithm in Rust - Add Python wrapper with automatic fallback to Python implementation - Achieve 12-17x speedup for point addition and 14-15x for point location The Rust implementation maintains 100% API compatibility with the existing Python code and includes optimizations for 2D/3D cases while supporting N-dimensional operations. All tests pass with the new implementation. To build: maturin develop To use: The triangulation_rust.py module automatically uses Rust when available
…ation - Fixed incorrect indexing in Cramer's rule implementation for N-dimensional circumsphere - Added direct triangulation performance benchmarks showing 11-16x speedup - Verified Rust implementation works correctly in release mode Performance results: - Triangulation creation/addition: 11.64x speedup - Point location queries: 16.13x speedup
Contributor
|
What were your findings? |
Member
Author
|
That in (N>2)D SciPy is actually really fast, it was like >100x faster then the Rust code but in 2D Rust was 5-30x faster. Didn't do a lot of validation of whether it was doing the optimal thing though. |
Contributor
|
I thought scipy triangulation isn't designed for incremental updates; did you test on adding points one at a time or all at once? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just an experiment and 100% vibe coded... I want to see whether we can get a significant speedup by implementing the LearnerND in Rust.