Slide 1

Slide 1 text

Pumping Python modules using Rust PyCon Indonesia 2017 Vigneshwer Dhinakaran | Mozilla TechSpeaker | @dvigneshwer

Slide 2

Slide 2 text

What’s the Catch Whenever performance and control comes into the picture we are complacent that “ I can write a C extension ”

Slide 3

Slide 3 text

What’s the Catch Not many us write C extension in reality Writing C extension is scary & painful The community is awesome we already have such libraries cpython (C - 33% ) numpy (C - 53%) HeartBleed (OpenSSL bug)

Slide 4

Slide 4 text

What’s the main ask here for us? C’s Performance, Portability & Embeddability With Guaranteed Safety

Slide 5

Slide 5 text

Rust : Introduction System programming language that has great control like C/C++, delivers productivity like in Python, and is super safe

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

What does it offer? ➔ Strong safety guarantees ◆ No seg-faults ◆ No data-races ◆ Expressive type system ➔ Zero cost abstraction ◆ Without compromising on performance. ➔ Stability without stagnation ➔ Libraries & tools ecosystem Goal: Confident & productive systems programming

Slide 9

Slide 9 text

A bit complex example fn avg(list: &[f64]) -> f64 { let mut total = 0; for el in list{ total += *el; } total/list.len() as f64 }

Slide 10

Slide 10 text

HLL version fn avg(list: &[f64]) -> f64 { list.iter().sum::() / list.len() as f64 }

Slide 11

Slide 11 text

Parallel Version (Rayon) extern crate rayon; use rayon::prelude::*; fn avg(list: &[f64]) -> f64 { list.par_iter().sum::() / list.len() as f64 }

Slide 12

Slide 12 text

Demo Benchmarking fibonacci series

Slide 13

Slide 13 text

Benchmarking Results

Slide 14

Slide 14 text

where are we with Rust?

Slide 15

Slide 15 text

2016 -17 Rust is the Most Loved Language by Developers

Slide 16

Slide 16 text

Friends of Rust Organizations running Rust in production. (https://www.rust-lang.org/en-US/friends.html)

Slide 17

Slide 17 text

Resources https://github.com/vigneshwerd/Rust-PyconID Raise issues in the repository for questions?

Slide 18

Slide 18 text

Rust Trailheads Follow us on Twitter: @rustlang @ThisWeekInRust Join Rust IRC Channels: #rust #rust-community #rust-machine-learning #tensorflow-rust Join Rust Websites: rust-lang.org rustbyexample.com rustaceans.org reddit.com/r/rust/ 18

Slide 19

Slide 19 text

Appendix

Slide 20

Slide 20 text

~ Ownership and Borrowing ~ Type Ownership T &T Alias? Mutate? Owned Shared reference ✓ ✓ &mut T Mutable reference ✓

Slide 21

Slide 21 text

~ Concurrency paradigms ~ Paradigm Fork-join Ownership? Borrowing? ✓ Message Passing Locking ✓ ✓ ✓ Lock-free Futures … ✓ ✓ ✓ ✓

Slide 22

Slide 22 text

22

Slide 23

Slide 23 text

23

Slide 24

Slide 24 text

24 Gradual adoption works.

Slide 25

Slide 25 text

25 Community Photo credit: David McSpadden https://www.flickr.com/photos/familyclan/15535822737/

Slide 26

Slide 26 text

26 RFC Process

Slide 27

Slide 27 text

27