Skip to content

Exploring the wonders of Rust by writing a gravity simulator and doing some FFI

Notifications You must be signed in to change notification settings

ErikBjare/rust-exploration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Exploring the wonders of Rust by writing a gravity simulator and doing some FFI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published