Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

RUST

Slide 3

Slide 3 text

ABOUT ME Giovanny Gongora @Gioyik Website: gioyik.com SPOILER ALERT: I will be hired By Mozilla to work with Developer Relations team

Slide 4

Slide 4 text

BRIEF INTRODUCTION • First inventor: Graydon Hoare (8 years ago) • Mozilla Foundation (~2009) • Zero-cost abstraction • High concurrency support • Memory safety by ownership • Lifetime concept • Servo <3

Slide 5

Slide 5 text

AND THAT IN REAL LIFE…

Slide 6

Slide 6 text

OWNERSHIP

Slide 7

Slide 7 text

SAFETY Problems related to safety cause not only software crash, also security vulnerabilities. • Null pointer deference • Double free • Use-after-free (more pointer problems..)

Slide 8

Slide 8 text

MEMORY MANAGEMENT

Slide 9

Slide 9 text

WHAT DO OTHER LANGUAGES DO? • Most languages with a garbage collector heap- allocate by default • Every value is boxed • There are some possible optimizations that don’t make it true 100% of the time

Slide 10

Slide 10 text

GARBAJE COLLECTION • Computer cannot know the exact timing that each object should be freed • Need of more memory and CPU power • No predictability • Limited concurrency • Large code size

Slide 11

Slide 11 text

STACK

Slide 12

Slide 12 text

STACK

Slide 13

Slide 13 text

STACK

Slide 14

Slide 14 text

HEAP

Slide 15

Slide 15 text

HEAP

Slide 16

Slide 16 text

RUNTIME EFFICIENCY • Managing the memory for the stack is trivial • Managing memory for the heap is non-trivial

Slide 17

Slide 17 text

CONCURRENCY

Slide 18

Slide 18 text

RUST INSIDE OTHER LANGUAGES

Slide 19

Slide 19 text

THE PROBLEM Star ten threads. Inside each thread, count from one to five million. After all then threads are finished, print out ‘done’. • Rust has something called a ‘foreign function interface’, often shortened to ‘FFI’ • Rust has support for FFI in both directions • Let’s try it with examples in Ruby, Python and JavaScript

Slide 20

Slide 20 text

CRATES AND MODULES

Slide 21

Slide 21 text

CRATES AND MODULES When a project starts getting large, it’s considered good software engineering practice to split it up into a bunch of smaller pieces, and then fit them together. • Rust has a module system • A crate is synonymous with a “library” or “package” in other languages • “Cargo” as the name of Rust’s package management tool • Crates can produce an executable or a library depending on the project • Modules allow you to partition your code

Slide 22

Slide 22 text

AND FUNCTIONAL PROGRAMMING?

Slide 23

Slide 23 text

SO, WHAT’S NEXT FOR RUST? • Compiler Plugins • Inline Assembly • No stdlib • Advanced linking • Benchmark Test • … and more, trust me :)

Slide 24

Slide 24 text

PLAY.RUST-LANG.ORG

Slide 25

Slide 25 text

THANKS Giovanny Gongora Why Rust is awesome? @Gioyik Website: gioyik.com