https://github.com/erikbjare/rust-exploration
Exploring the wonders of Rust by writing a gravity simulator and doing some FFI
https://github.com/erikbjare/rust-exploration
experimentation ffi nbody
Last synced: 15 days ago
JSON representation
Exploring the wonders of Rust by writing a gravity simulator and doing some FFI
- Host: GitHub
- URL: https://github.com/erikbjare/rust-exploration
- Owner: ErikBjare
- Created: 2017-01-31T11:46:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-16T16:03:27.000Z (about 8 years ago)
- Last Synced: 2025-02-14T13:46:48.568Z (2 months ago)
- Topics: experimentation, ffi, nbody
- Language: Rust
- Homepage:
- Size: 213 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
rust-exploration
=============My own exercises in:
- calling Rust code from other languages.
- writing a gravity simulator.# Usage
This repo currently contains two experiments.
## Gravitysim
Just run with:
```
cargo run
```You can see all the available command line arguments with:
```
cargo run -- --help
```## FFI part
Compile the Rust code:
```
cargo build --release
```Call the library from Python:
```
cd misc
python3 call_with_python.py
```# Decreasing executable size
Use `strip` to remove debug symbols (almost halves the size of the executable!):
```
strip target/release/gravitysim
```The smallest I managed to get the binary down to was ~1.6MB. This with the system allocator, `lto=true`, `panic='abort'` and use of `strip`.