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
開発効率と性能の両立を目指すRust連携プログラミング言語Kaede
Search
Itto Hiramoto
May 11, 2026
Programming
17
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
開発効率と性能の両立を目指すRust連携プログラミング言語Kaede
サイボウズ・ラボユース成果発表会2026
Itto Hiramoto
May 11, 2026
More Decks by Itto Hiramoto
See All by Itto Hiramoto
Rustdoc JSONからFFIバインディングを自動生成してみた
ittohiramoto
0
25
Other Decks in Programming
See All in Programming
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
810
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.2k
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
400
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
180
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.5k
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
560
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
sira's awesome portfolio website redesign presentation
elsirapls
0
460
The Pragmatic Product Professional
lauravandoore
37
7.5k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
YesSQL, Process and Tooling at Scale
rocio
174
15k
How to build a perfect <img>
jonoalderson
1
6.1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Transcript
開発効率と性能の両立を目指す Rust連携プログラミング言語Kaede 平本一桐 言語処理系開発コース 1
コメントアプリのデモ Kaede で書いた Web アプリ https://bit.ly/40PWr4p QRコードを読み取ってコメントしてください 2
自己紹介 平本 一桐 ヒラモト イットウ 放送大学 教養学部 教養学科 情報コース 3年
普段はアルバイトとして、以下の開発をしています。 Web フロントエンド と バックエンド Elasticsearch を使った検索基盤の構築 ソースコードからコールグラフを生成する静的解析ツールの開発 Web サーバーを書くのが好きで、その中で感じた課題を解決するために Kaede を作りました。 3
今日話すこと まず全体像、その後に内部実装を見る 1. 背景と発想 2. 言語機能 3. 内部実装 4. まとめ
4
1. 背景と発想 5
問題意識 Rust で Web サーバーを書いていて感じたこと Rust は性能と安全性に優れるが、Web サーバーを書くときに 「もう少し軽く書きたい」と感じる場面が何度もあった 共有状態や、データのまたぎが増えるほど
所有権・借用・ライフタイムを意識する量が増える 並行処理のたびに、データの持ち方を意識する必要が出やすい 結果として、本筋より言語・型システム側の都合に時間が取られやすい 6
Kaede の発想 Web サーバーを軽く書きたい、でも性能は捨てたくない 1. サーバーの大部分は Kaede で軽く書く 2. 性能が必要な部分だけ
Rust を使う 3. その連携の手間を最小化する 7
Kaede の中核 この発想に沿った 3 つの柱 軽く書く — GC で所有権を気にせず書ける。式指向・列挙型・パターンマッ チなど、Rust
に近い表現力 速さは捨てない — 性能が必要な部分だけ Rust をそのまま使える 並行処理 — 軽量スレッド・チャネルと non-blocking I/O でリクエストを捌く 8
2. 言語機能 9
標準 HTTP / WebSocket ライブラリ 「軽く書く」― 標準ライブラリだけでサーバーが書ける mut app :=
std.http.App::new() app.static_file("/", "index.html") app.get("/api/hello", |req, res| { res.send_text("hello") }) app.ws("/ws/echo", |req, ws| { ws.send_text("connected") }) app.listen(port=8080) 10
軽量スレッド 「並行処理」― 少数の OS スレッドで多数のタスクを捌く fn worker(id: u64) { println(id)
} spawn worker(1) spawn worker(2) spawn worker(3) OS スレッドより軽量なので、接続ごとに1タスク割り当てても問題ない タスクの切り替えはユーザ空間のコンテキストスイッチで、OS スレッドの切り替えよりコ ストが軽い I/O 待ちの間はスレッドを塞がないので、少数のスレッドで多数のタスクを捌ける 11
CSPモデル 「並行処理」― チャネルでタスク間の通信ができる ch := Channel<String>::new() fn sender(ch: Channel<String>) {
ch <- "hello" // 送信 } spawn sender(ch) match <-ch { // 受信 Option::Some(msg) => println(msg), Option::None => {}, } 受信側はデータが届くまで待機し、他のタスクにスレッドを譲る 12
Rust 連携 「速さは捨てない」― 必要な部分だけ Rust を直接使う pub fn comment_json(id: u64,
author: &str, message: &str) -> String { json!({ "id": id, "author": author, "message": message }).to_string() } import rust::comment_app json := rust::comment_app::comment_json(123, "Taro", "hello, world!") サーバーの流れは Kaede、CPU を使う処理は Rust — GC のオーバーヘッドを避けられる 今回のデモでは、JSON 生成を Rust( serde )に任せている 13
3. 内部実装 14
Rust 連携の仕組み 追加の記述なく Rust を使える裏側 Shim は Rust と Kaede
の間をつなぐ薄い互換層 最終的には Kaede の実行ファイルにまとめてリンクされる 15
コンパイルパイプライン Kaede は LLVM バックエンドの静的型付けコンパイル型言語 Kaede IR は型と名前解決が済んだ Kaede 専用の中間表現
標準ライブラリ・ランタイム・GC も合わせてリンクされる 16
並行処理ランタイムの考え方 書き味は同期的、実行は non-blocking コードは上から順に書くだけ — async / await やコールバックは不要 I/O
待ちは epoll / kqueue で検知し、ユーザ空間のコンテキストスイッチでタ スクを切り替える Channel 待ちも同じスケジューラで扱う イベントループや状態機械を意識せずに、サーバー処理を書ける 17
まとめ Web サーバー開発の課題から生まれた言語 Rust で Web サーバーを書く中で 所有権や並行まわりの記述の重さを感じた Kaedeは、サーバー処理を素直に書ける言語機能を標準で備える サーバーの大部分を
Kaede で軽く書き、要所だけ Rust に任せる設計 18
GitHubリポジトリ https://github.com/itto-hiramoto/kaede 今回使ったコメントアプリもリポジトリ内にあります 19