Farzy / rust-barycenter

Tutorial on Rust functionnal programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust Barycenter

Synopsis

Test program for the "Learning Rust" tutorial by Leo Tindall on O'Reilly Learning.

I use this project to learn various Rust aspects:

Building

Because of the experimental benchmark code you must use the nightly version of the Cargotoolchain.

cargo +nightly build

Benchmarking

In order to benchmark the two merging functions run:

cargo +nightly bench

In my tests, the optimized parallel recursive is actually 3 to 30 times slower than the simple iterative version:

$ > cargo +nightly bench
   Compiling rust-barycenter v0.1.0 (/Users/ffarid/src/RUST/rust-barycenter)
    Finished bench [optimized] target(s) in 1.25s
     Running target/release/deps/rust_barycenter-df6957fa89931341

running 4 tests
test tests::bench_merge_iterative_large ... bench:   6,134,557 ns/iter (+/- 1,874,839)
test tests::bench_merge_iterative_small ... bench:       5,378 ns/iter (+/- 214)
test tests::bench_merge_recursive_large ... bench:  18,598,300 ns/iter (+/- 10,618,726)
test tests::bench_merge_recursive_small ... bench:     165,415 ns/iter (+/- 78,220)

test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out

Authors

References

About

Tutorial on Rust functionnal programming


Languages

Language:Rust 100.0%