Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
#DeStudy #01 Rust入門
Search
K.Mori
July 31, 2020
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
#DeStudy #01 Rust入門
#DeStudy #01のRust入門スライドです。
K.Mori
July 31, 2020
More Decks by K.Mori
See All by K.Mori
GraphQL入門
morikyon
1
120
Other Decks in Programming
See All in Programming
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
AmebaブログはKMPから卒業します
kmars0605
0
190
golang-bob.pdf
iwatsukayura
0
130
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
230
The Rails Doctrine Decade
koic
2
590
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
500
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
Site-Speed That Sticks
csswizardry
13
1.6k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Building Applications with DynamoDB
mza
96
7.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
Google's AI Overviews - The New Search
badams
0
1.6k
エンジニアに許された特別な時間の終わり
watany
109
250k
Transcript
もちろん俺らは抵抗するで︖ Rustで kmori (@forestython)
今⽇のテーマ 2
3 Rust
Rust • Firefox の Mozilla がつくった新しいプログラミング⾔語 • 2010年7⽉7⽇に登場 • Stack
Overflowの最も愛されているプログラミング⾔語の 2016年から2019年まで4年連続1位︕ • 以下のソフト / サービスはRustで実装 • Firefox • Dropbox • AWS Lambda (Firecracker) • Discord 4
Rustのいいところ • メリット • くっそはやい • メモリ管理が優秀である • NULL安全と型推論が存在する •
デメリット • 学習コストが半端じゃない 5
実⾏速度 • 私のダメダメな実装よりQiitaの記事⾒たほうが有益なので引⽤ ü https://qiita.com/reki2000/items/55ef54b96b2 6d80ad694 • ダイクストラ法での探索アルゴリズム(枝数30万程度) ü C++
≒ Rust > Go > Julia > Kotlin > Cython > JavaScript > Python • ちなみに私のダメダメ実装でもエラトステネスの篩(指定数以下の 素数をすべて抽出)で⽐較したところ、C++とRustは拮抗してい て、Juliaがその2倍程度、Pythonが10倍程度でした 6
メモリ管理 • メモリ管理⽅法 1. プログラマが気合で管理 (C, C++) → 開放し忘れによるメモリリークの危険性 2.
システムが⾃動で不要なメモリを集約 (GC) → 実⾏時のオーバーヘッド発⽣ • Rustの管理⽅法 ü 値の所有者(=値を格納する変数)がスコープ(=簡単 に⾔うと値を含む関数等)から出た時点で開放 ü 気合で管理してた際の⼀時的な確保/開放が実現可能かつ、 GCのようなオーバヘッドとよしなにしてくれる部分をもつ 7
NULL安全、型推論 • NULL安全 • nullに対するメソッドのコール等をしたら実⾏時に出るエラー String str = null; str.length();
// => java.lang.NullPoinerException を回避するために、コンパイル時にエラーを出すこと • 鬱陶しいnull pointer exception をテスト時に発⾒ もしくは バグのまま納品せずに済む • 型推論 • 簡単に⾔うと型を推測してくれる let num; // => この時点で num は i32型と宣⾔していない num = 100; // => がしかし100の代⼊によって⾃動で定義 8
• サンプル︓ただのFizzBuzz • https://doc.rust-jp.rs/rust-by-example-ja/fn.html • よくある感想 • 正直、型が多すぎてわからん︕ • 関数の引数でも型指定しすぎててわからん︕
• 関数の定義の順番がしていないのでパッと⾒参照関係がわからん︕ 学習コスト 9
タイトル: とりまいれてみよう 10
• Mac $ brew install rust • Ubuntu $ sudo
apt install rustc • Windows スタートボタン → Ubuntu → $sudo apt install rustc ※ Windowsを素のままで使ってコーディングは 正気の沙汰ではない(諸説あり) How to install 11