SlideShare a Scribd company logo
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

More Related Content

What's hot

Optimizing Web Performance - A personal experience
Optimizing Web Performance - A personal experienceOptimizing Web Performance - A personal experience
Optimizing Web Performance - A personal experience
Maira Bello
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
Nick Hodge
 
Tips to improve your code review
Tips to improve your code reviewTips to improve your code review
Tips to improve your code review
Wagner Mendes Voltz Fusca
 
Rails I18n From The Trenches
Rails I18n From The TrenchesRails I18n From The Trenches
Rails I18n From The Trenches
clemensk
 
Python and web driver
Python and web driverPython and web driver
Python and web driver
Colm Harrington
 
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
Jumper Chen
 
関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について
Shinya Ohyanagi
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch Usage
Greg Brown
 
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.
Russel Winder
 
Rntb20200325
Rntb20200325Rntb20200325
Rntb20200325
t k
 
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
JUG Lausanne
 
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
Christian Nagel
 

What's hot (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
 

Similar to Rust meetup delhi nov 18

Performance and Abstractions
Performance and AbstractionsPerformance and Abstractions
Performance and Abstractions
Metosin Oy
 
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
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
jClarity
 
Voxxed Vienna 2015 Fault tolerant microservices
Voxxed Vienna 2015 Fault tolerant microservicesVoxxed Vienna 2015 Fault tolerant microservices
Voxxed Vienna 2015 Fault tolerant microservices
Christopher Batey
 
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
SATOSHI TAGOMORI
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
SATOSHI TAGOMORI
 
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?
C4Media
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
John Nestor
 
Игорь Фесенко "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"
Fwdays
 
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
Edgard Marx
 
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
Steve Pember
 
LJC: Microservices in the real world
LJC: Microservices in the real worldLJC: Microservices in the real world
LJC: Microservices in the real world
Christopher Batey
 
Inside Of Mbga Open Platform
Inside Of Mbga Open PlatformInside Of Mbga Open Platform
Inside Of Mbga Open PlatformHideo Kimura
 
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...
Rehgan Avon
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
mperham
 
cadec-2017-golang
cadec-2017-golangcadec-2017-golang
cadec-2017-golang
TiNguyn863920
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
Axway Appcelerator
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
Marcin Gryszko
 
Lightweight APIs in mRuby (Михаил Бортник)
Lightweight APIs in mRuby (Михаил Бортник)Lightweight APIs in mRuby (Михаил Бортник)
Lightweight APIs in mRuby (Михаил Бортник)
Fwdays
 
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
Alex Payne
 

Similar to 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
 

More from Abhiram Ravikumar

Innovate the foss-way
Innovate the foss-wayInnovate the foss-way
Innovate the foss-way
Abhiram Ravikumar
 
Ethereum and blockchain
Ethereum and blockchainEthereum and blockchain
Ethereum and blockchain
Abhiram Ravikumar
 
BCI Media Playet | Intuit Accessibility Summit
BCI Media Playet | Intuit Accessibility SummitBCI Media Playet | Intuit Accessibility Summit
BCI Media Playet | Intuit Accessibility Summit
Abhiram Ravikumar
 
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
Abhiram Ravikumar
 
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
Abhiram Ravikumar
 
A kick-start into Open Source
A kick-start into Open SourceA kick-start into Open Source
A kick-start into Open Source
Abhiram Ravikumar
 
Take back control - introduction
Take back control - introductionTake back control - introduction
Take back control - introduction
Abhiram Ravikumar
 
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
Abhiram Ravikumar
 

More from 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
 

Recently uploaded

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
Nettur Technical Training Foundation
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 

Recently uploaded (20)

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 

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