Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Why Rust is awesome?

Why Rust is awesome?

DevFest Colombia.dev 2015

Giovanny Gongora

October 15, 2015
Tweet

More Decks by Giovanny Gongora

Other Decks in Technology

Transcript

  1. ABOUT ME Giovanny Gongora @Gioyik Website: gioyik.com SPOILER ALERT: I

    will be hired By Mozilla to work with Developer Relations team
  2. 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
  3. SAFETY Problems related to safety cause not only software crash,

    also security vulnerabilities. • Null pointer deference • Double free • Use-after-free (more pointer problems..)
  4. 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
  5. 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
  6. RUNTIME EFFICIENCY • Managing the memory for the stack is

    trivial • Managing memory for the heap is non-trivial
  7. 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
  8. 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
  9. SO, WHAT’S NEXT FOR RUST? • Compiler Plugins • Inline

    Assembly • No stdlib • Advanced linking • Benchmark Test • … and more, trust me :)