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

Einführung in Rust

Einführung in Rust

Rust ist eine moderne Programmiersprache, die Performance und Sicherheit verbindet. Sie ist systemnah und bietet leistungsstarke Abstraktionen, die stark an dynamische Sprachen wie Ruby oder Python erinnern. Rust bietet Speichersicherheit ohne Garbage Collector und macht die Low-Level-Programmierung einfacher und sicherer. Matthias wird einen einführenden Vortrag über Rust halten und in diesem Rahmen auch einige der schönsten Features vorstellen. Außerdem wird er auf Einsatzmöglichkeiten für WebAssembly, Cloud Computing und mehr eingehen.

Matthias Endler

January 24, 2020
Tweet

More Decks by Matthias Endler

Other Decks in Technology

Transcript

  1. View Slide

  2. ?

    View Slide

  3. What Is Rust Doing
    Behind the Curtains?

    View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. Rust is a systems programming language that runs
    blazingly fast, prevents segfaults, and guarantees thread
    safety. It aims to bring modern language design and an
    advanced type system to systems programming. Rust
    does not use a garbage collector, using advanced static
    analysis to provide deterministic drops instead.

    View Slide

  8. Empowering everyone

    to build reliable and
    efficient software.

    View Slide

  9. Matthias Endler
    @matthiasendler
    - Düsseldorf, Germany
    - Backend Engineer at
    - Website performance team
    - Worked a lot with Python and PHP
    - Likes hot chocolate
    endler.dev mre

    View Slide

  10. hello-rust.show

    View Slide

  11. View Slide

  12. View Slide

  13. 5.90GiB/s
    1.90GiB/s
    GNU cat fastcat

    View Slide

  14. View Slide

  15. 3GiB/s
    850MiB/s
    GNU yes My yes

    View Slide

  16. Do What You Can't

    View Slide

  17. View Slide

  18. Rust Facts
    • Programming language
    • Funded by Mozilla
    • First version: 2010
    • Version 1.0: May 2015
    • Current stable version: 1.40

    View Slide

  19. Rust Facts
    • Memory safety
    • No undefined behavior
    • Fearless concurrency
    • High-level language concepts
    • Strong compiler checks
    • Easily embeddable into existing

    projects

    View Slide

  20. What I like about…
    Package manager, Community
    Syntax, Libraries, Async
    Tooling, Documentation, Concurrency
    Speed, no overhead
    PHP:
    Python:

    Golang:

    C:

    View Slide

  21. What I like about…
    Package manager, Community
    Syntax, Libraries, Async
    Tooling, Documentation, Concurrency
    Speed, no overhead

    Generics, Error handling
    Rust:

    View Slide

  22. Complexity vs speed
    PHP
    Python
    Golang
    Rust
    C
    Faster "Easier"

    View Slide

  23. View Slide

  24. View Slide

  25. View Slide

  26. View Slide

  27. View Slide

  28. https://cacm.acm.org/magazines/2017/10/221326-a-large-scale-study-of-programming-languages-and-code-quality-in-github/fulltext

    View Slide

  29. wc

    View Slide

  30. View Slide

  31. View Slide

  32. View Slide

  33. View Slide

  34. View Slide

  35. hellö
    wc wc.php
    5 6

    View Slide

  36. View Slide

  37. wc.php foo

    View Slide

  38. View Slide

  39. View Slide

  40. File icon created by Justiconnic from the Noun Project

    View Slide

  41. View Slide

  42. View Slide

  43. ... but there's more!
    • How to differentiate between end
    of file and error?
    • Parallel execution for multiple
    files?
    • What about very long lines?
    • Buffers for performance
    • Timeouts for slow reads?
    • SIMD?

    View Slide

  44. View Slide

  45. View Slide

  46. View Slide

  47. View Slide

  48. View Slide

  49. View Slide

  50. View Slide

  51. View Slide

  52. • Handles missing files
    • Handles read errors
    • Handles large files
    • UTF-8 support
    • Fast buffered reading
    • No memory leaks

    View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. View Slide

  57. https://cacm.acm.org/magazines/2017/10/221326-a-large-scale-study-of-programming-languages-and-code-quality-in-github/fulltext

    View Slide

  58. Rust productivity

    View Slide

  59. View Slide

  60. Who’s using Rust anyway?
    Firefox
    Dropbox
    Visual Studio Code
    npm
    Facebook (kind of)
    Google (kind of)
    trivago
    rust-lang.org/production

    View Slide

  61. View Slide

  62. Wasm!

    View Slide

  63. https://endler.dev/2019/tinysearch

    View Slide

  64. View Slide

  65. View Slide

  66. 0
    750
    1500
    2250
    3000
    Go C Rust
    How big is " Hello World " (in KB)?
    40k 1k

    View Slide

  67. " Serverless "

    View Slide

  68. View Slide

  69. View Slide

  70. View Slide

  71. View Slide

  72. Thanks!
    endler.dev/talks

    View Slide