SlideShare une entreprise Scribd logo
1  sur  28
Let’s Get Rusty
License: CC BY-SA 4.0 International. You are free to share and adapt.
Nov 23, 2018 | Rust Community Meet-up 2018 | Delhi NCR
Abhiram Ravikumar | Mozilla Tech Speaker | ML Research Fellow, SAP Labs India
@abhi12ravi
Hi there!
Abhiram Ravikumar
• Mozilla Tech Speaker
• Open Source Evangelist
• Data Science Research Fellow
• Lynda Instructor
• Software Developer, SAP Labs
India
Questions / Feedback - @abhi12ravi
Agenda
• Why Rust?
• Rust features – (what have you?)
• FFIs (Foreign Function Interfaces) demo
• Rust Uses and Applications
@abhi12ravi
The audience - Orgs
@abhi12ravi
The audience – Rust knowledge
@abhi12ravi
The audience – rusty-projects
@abhi12ravi
Prelude: C++ Problems
• Dangling pointer
• Segmentation fault
• Iterator invalidation
• Thread safety
int* abc() {
int x = 1;
return &x;
}
@abhi12ravi
Prelude: C++ Problems
• Dangling pointer
• Segmentation fault
• Iterator invalidation
• Thread safety
int* abc() {
int x = 1;
return &x;
}
@abhi12ravi
Systems level
Memory safe
Thread safe
Fast ⚡
OOPS
Strong Compiler
FFIs
No GC!
Memory management – The Good Stuff
• Concept of mutability
• Ownership &
Borrowing
Concept of mutability – the why
• Variables are immutable by
default
• Add keyword mut to make it
mutable
• Future readers know the value is
going to change
• Less prone to unwanted changes
in the variable’s value
fn main() {
let mut x = 5;
println!(“X is {}“, x);
x = 6;
println!(“X is {}“, x);
}
// X is 5
// X is 6
Memory allocation - Fundamentals
1. The memory must be requested from the operating
system at runtime.
2. We need to return this memory to the operating system
when we’re done with our usage.
Returning memory to the OS
Other programming languages:
• Garbage Collector (GC)
• W/o GC – programmer’s responsibility
Challenges:
• Need to pair exactly one allocate with exactly one free
In Rust
{
let s = String::from("hello"); // s is valid from this point forward
// do stuff with s
} // this scope is now over, and s is no longer valid
Memory is automatically returned once variable goes out of
scope.
Also, in other news…
This week in Rust…
News & Blog Posts
The relative performance of C and Rust
Quote of the Week
Bare Metal Attracts Rust
- Sven Gregori on
Hackaday
Enough Rust, let’s switch to
Python!
Python Python
• Strong Ecosystem
• Fast iterations
• Robust interpreter
• Powerful meta programming
(APIs)
• Library support - fantastic
• Really slow
• Performance issues
• Far from metal
• Poor multi-threading
support
Rust Python
• Speed – fast ⚡
• Compile time ⬇️
• Stable environment (Reliability)
• Crash handling functionality ✔️
• Closer to metal
• Really slow
• Performance issues
• Far from the metal
• Poor multi-threading
support
➕ =
💚
The Bottomline…
⚡
Credits: @rochacbruno on
GitHub
Demos
Sample Problem Statement
String Processing use-case
• Count the pairs of repeated characters in the given string
• How many subsequent-repeated groups of chars are in the
given string?
The performance figures
Performance Benchmark
Scenario pure_python python_with_rus
t
Observation
Mean (ms) 53.9732 2.6085 ~ 20x faster
Max (ms) 56.9428 2.9296 ~19x faster
“Innovation is a necessity now,
and the faster your programs run,
the faster you innovate!”
Abhiram Ravikumar
References
1. The Rust book
2. Rust Python Example by Rocha C Bruno
3. Armin Ronacher: A Python and Rust love story
4. Dan Callahan - My Python's a little Rust-y - PyCon 2015
5. Extending Python with Rust (Samuel Cormier-Iijima)
6. All you need to know about FFI
Thank you!
This slide deck is available here:
speakerdeck.com/abhi12ravi

Contenu connexe

Tendances

Tendances (12)

Optimizing Web Performance - A personal experience
Optimizing Web Performance - A personal experienceOptimizing Web Performance - A personal experience
Optimizing Web Performance - A personal experience
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
Tips to improve your code review
Tips to improve your code reviewTips to improve your code review
Tips to improve your code review
 
Rails I18n From The Trenches
Rails I18n From The TrenchesRails I18n From The Trenches
Rails I18n From The Trenches
 
Python and web driver
Python and web driverPython and web driver
Python and web driver
 
ModernWeb 2019: Why we replace TypeScript with Dart
ModernWeb 2019: Why we replace TypeScript with DartModernWeb 2019: Why we replace TypeScript with Dart
ModernWeb 2019: Why we replace TypeScript with Dart
 
関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch Usage
 
Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.
 
Rntb20200325
Rntb20200325Rntb20200325
Rntb20200325
 
JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007
 
Reference Semantics with C# and .NET Core
Reference Semantics with C# and .NET CoreReference Semantics with C# and .NET Core
Reference Semantics with C# and .NET Core
 

Similaire à Rust meetup delhi nov 18

Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
ScyllaDB
 
Inside Of Mbga Open Platform
Inside Of Mbga Open PlatformInside Of Mbga Open Platform
Inside Of Mbga Open Platform
Hideo Kimura
 

Similaire à Rust meetup delhi nov 18 (20)

Performance and Abstractions
Performance and AbstractionsPerformance and Abstractions
Performance and Abstractions
 
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
 
Voxxed Vienna 2015 Fault tolerant microservices
Voxxed Vienna 2015 Fault tolerant microservicesVoxxed Vienna 2015 Fault tolerant microservices
Voxxed Vienna 2015 Fault tolerant microservices
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
 
openQA Hoverboard - Open-source Question Answering Framework
openQA Hoverboard - Open-source Question Answering FrameworkopenQA Hoverboard - Open-source Question Answering Framework
openQA Hoverboard - Open-source Question Answering Framework
 
Reactive All the Way Down the Stack
Reactive All the Way Down the StackReactive All the Way Down the Stack
Reactive All the Way Down the Stack
 
LJC: Microservices in the real world
LJC: Microservices in the real worldLJC: Microservices in the real world
LJC: Microservices in the real world
 
Inside Of Mbga Open Platform
Inside Of Mbga Open PlatformInside Of Mbga Open Platform
Inside Of Mbga Open Platform
 
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
cadec-2017-golang
cadec-2017-golangcadec-2017-golang
cadec-2017-golang
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
Lightweight APIs in mRuby (Михаил Бортник)
Lightweight APIs in mRuby (Михаил Бортник)Lightweight APIs in mRuby (Михаил Бортник)
Lightweight APIs in mRuby (Михаил Бортник)
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 

Plus de Abhiram Ravikumar

Plus de Abhiram Ravikumar (8)

Innovate the foss-way
Innovate the foss-wayInnovate the foss-way
Innovate the foss-way
 
Ethereum and blockchain
Ethereum and blockchainEthereum and blockchain
Ethereum and blockchain
 
BCI Media Playet | Intuit Accessibility Summit
BCI Media Playet | Intuit Accessibility SummitBCI Media Playet | Intuit Accessibility Summit
BCI Media Playet | Intuit Accessibility Summit
 
Privacy & Security on the Web - Tools on Mozilla Firefox
Privacy & Security on the Web - Tools on Mozilla FirefoxPrivacy & Security on the Web - Tools on Mozilla Firefox
Privacy & Security on the Web - Tools on Mozilla Firefox
 
A seminar on User Topic Interest profiles research by Google
A seminar on  User Topic Interest profiles research by GoogleA seminar on  User Topic Interest profiles research by Google
A seminar on User Topic Interest profiles research by Google
 
A kick-start into Open Source
A kick-start into Open SourceA kick-start into Open Source
A kick-start into Open Source
 
Take back control - introduction
Take back control - introductionTake back control - introduction
Take back control - introduction
 
A novel approach to big data veracity using crowd-sourcing techniques
A novel approach to big data veracity using crowd-sourcing techniques A novel approach to big data veracity using crowd-sourcing techniques
A novel approach to big data veracity using crowd-sourcing techniques
 

Dernier

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Dernier (20)

VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 

Rust meetup delhi nov 18

  • 1. Let’s Get Rusty License: CC BY-SA 4.0 International. You are free to share and adapt. Nov 23, 2018 | Rust Community Meet-up 2018 | Delhi NCR Abhiram Ravikumar | Mozilla Tech Speaker | ML Research Fellow, SAP Labs India @abhi12ravi
  • 2. Hi there! Abhiram Ravikumar • Mozilla Tech Speaker • Open Source Evangelist • Data Science Research Fellow • Lynda Instructor • Software Developer, SAP Labs India Questions / Feedback - @abhi12ravi
  • 3. Agenda • Why Rust? • Rust features – (what have you?) • FFIs (Foreign Function Interfaces) demo • Rust Uses and Applications @abhi12ravi
  • 4. The audience - Orgs @abhi12ravi
  • 5. The audience – Rust knowledge @abhi12ravi
  • 6. The audience – rusty-projects @abhi12ravi
  • 7. Prelude: C++ Problems • Dangling pointer • Segmentation fault • Iterator invalidation • Thread safety int* abc() { int x = 1; return &x; } @abhi12ravi
  • 8. Prelude: C++ Problems • Dangling pointer • Segmentation fault • Iterator invalidation • Thread safety int* abc() { int x = 1; return &x; } @abhi12ravi
  • 9.
  • 10. Systems level Memory safe Thread safe Fast ⚡ OOPS Strong Compiler FFIs No GC!
  • 11. Memory management – The Good Stuff • Concept of mutability • Ownership & Borrowing
  • 12. Concept of mutability – the why • Variables are immutable by default • Add keyword mut to make it mutable • Future readers know the value is going to change • Less prone to unwanted changes in the variable’s value fn main() { let mut x = 5; println!(“X is {}“, x); x = 6; println!(“X is {}“, x); } // X is 5 // X is 6
  • 13. Memory allocation - Fundamentals 1. The memory must be requested from the operating system at runtime. 2. We need to return this memory to the operating system when we’re done with our usage.
  • 14. Returning memory to the OS Other programming languages: • Garbage Collector (GC) • W/o GC – programmer’s responsibility Challenges: • Need to pair exactly one allocate with exactly one free
  • 15. In Rust { let s = String::from("hello"); // s is valid from this point forward // do stuff with s } // this scope is now over, and s is no longer valid Memory is automatically returned once variable goes out of scope.
  • 16. Also, in other news…
  • 17. This week in Rust… News & Blog Posts The relative performance of C and Rust Quote of the Week Bare Metal Attracts Rust - Sven Gregori on Hackaday
  • 18. Enough Rust, let’s switch to Python!
  • 19. Python Python • Strong Ecosystem • Fast iterations • Robust interpreter • Powerful meta programming (APIs) • Library support - fantastic • Really slow • Performance issues • Far from metal • Poor multi-threading support
  • 20. Rust Python • Speed – fast ⚡ • Compile time ⬇️ • Stable environment (Reliability) • Crash handling functionality ✔️ • Closer to metal • Really slow • Performance issues • Far from the metal • Poor multi-threading support
  • 23. Sample Problem Statement String Processing use-case • Count the pairs of repeated characters in the given string • How many subsequent-repeated groups of chars are in the given string?
  • 25. Performance Benchmark Scenario pure_python python_with_rus t Observation Mean (ms) 53.9732 2.6085 ~ 20x faster Max (ms) 56.9428 2.9296 ~19x faster
  • 26. “Innovation is a necessity now, and the faster your programs run, the faster you innovate!” Abhiram Ravikumar
  • 27. References 1. The Rust book 2. Rust Python Example by Rocha C Bruno 3. Armin Ronacher: A Python and Rust love story 4. Dan Callahan - My Python's a little Rust-y - PyCon 2015 5. Extending Python with Rust (Samuel Cormier-Iijima) 6. All you need to know about FFI
  • 28. Thank you! This slide deck is available here: speakerdeck.com/abhi12ravi