Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Class.new is all you need
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shia
April 22, 2026
Technology
580
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Class.new is all you need
RubyKaigi 2026 LT
Shia
April 22, 2026
More Decks by Shia
See All by Shia
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
4.6k
型を書かないRuby開発への挑戦
riseshia
0
5.9k
ひとつの開発環境
riseshia
0
95
Conquering Massive Traffic Spikes in Ruby Applications with Pitchfork
riseshia
0
360
スパイクアクセス対策としての pitchfork 導入
riseshia
0
940
NewEngineering 2024 - 繋がっていくサービスを支える開発環境作り
riseshia
0
1.8k
Hotspot on Coverage
riseshia
0
290
差分ベースで効率的にテストを実行してみる
riseshia
1
820
Cookpad internship 2020 summer - web
riseshia
0
7.7k
Other Decks in Technology
See All in Technology
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
210
Agile and AI Redmine Japan 2026
hiranabe
4
480
「ビジネスがわかるエンジニア」とは何か?
ryooob
0
300
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
310
アラート調査向けAIエージェントの本番導入とその後/AI Agents for Alert Investigation: Production Deployment and After
taddy_919
0
120
Zenoh on Zephyr on LiteX
takasehideki
2
110
起点・思考・出力で分解する 〜PM業務の自動化設計〜
kazu_kichi_67
1
1.1k
自宅LLMの話
jacopen
1
720
Deep Data Security 機能解説
oracle4engineer
PRO
2
110
不要なレビューをAIにまかせて AIコーディングの環境改善を加速した
shoota
1
260
LayerX コーポレートエンジニアリング室におけるサプライチェーンセキュリティへの取り組み / Supply Chain Security at LayerX Corporate Engineering
yuyatakeyama
3
840
徹底討論!ECS vs EKS!
daitak
3
1.7k
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
400
Building Adaptive Systems
keathley
44
3.1k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
How to make the Groovebox
asonas
2
2.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
250
Prompt Engineering for Job Search
mfonobong
0
350
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Deep Space Network (abreviated)
tonyrice
0
210
Designing for Performance
lara
611
70k
Transcript
RubyKaigi 2026 LT Shia@STORES Class.new is all you need
SIM SANGYONG (@shia) - STORES Inc. - GitHub: @riseshia -
X: @riseshia Self Introduction 2
SIM SANGYONG (@shia) - STORES Inc. - GitHub: @riseshia -
X: @riseshia - And…Day 3!!! Self Introduction 3
"type-guessr" needed to collect info from project code at startup
and it was slow. So, I profiled and… Background 4
ko1: "Class.new is faster than them" shia: "…!?!?" Background 5
Target: Initialization speed - Data.define, Struct, Class - kwargs, positional
args - 1 ivar, 8 ivars Ruby 4.0.1 / linux / no YJIT So, benchmark it 6
Result 7 1 field 8 fields
- Class.new > Struct.new >> Data.define.new - kwargs are slow
- more ivars, more slower Observation 8
Observation 9 8 fields - Class.new > Struct.new >> Data.define.new
- kwargs are slow - more ivars, more slower Note: Class.new outperforms with YJIT
See perf results 10 "perf record -g --call-graph dwarf" Ruby
4.0.1 / linux / no YJIT / ivar 1 field
See perf results 11
See perf results 12
See perf results 13
See perf results 14
See perf results 15
- Is kwargs initialization optimized? - Create Hash for kwargs
on initialization or not - Is ivar access optimized? - Byte code caching with object shape applied or not - Does the object need to be frozen? Why?? 16
shia: "I found it really is.." ko1: "We optimize what
people use most, so yeah" shia: "That's absolutely true😂" After talk 17
I originally used Data because I vaguely assumed Data/Struct was
lighter than Class. Reality was different at least object initialization. Did you know that? Summary 18
〜Fin〜 19
🤔 20
If "Class" is the fastest, why not re-implement these with
it?? 🤔🤔🤔 How to speed up Struct or Data.define 21
Re-impl Struct with "Class", and benchmark again: (8 fields, YJIT
off/on) How to speed up Struct or Data.define 22
It’s really fast! Let’s submit this patch!!!
Let’s submit this patch!!! 24
Submit this patch…? 25
🫠 26
🚮 27
28 You can check the full benchmark & RubyStruct implementation!
https://github.com/riseshia/class-new-is-all-you-need Class.new might be all you need (if initialization perf matters)