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
Shia
April 22, 2026
Technology
660
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.8k
型を書かないRuby開発への挑戦
riseshia
0
6.1k
ひとつの開発環境
riseshia
0
110
Conquering Massive Traffic Spikes in Ruby Applications with Pitchfork
riseshia
0
390
スパイクアクセス対策としての pitchfork 導入
riseshia
0
980
NewEngineering 2024 - 繋がっていくサービスを支える開発環境作り
riseshia
0
1.9k
Hotspot on Coverage
riseshia
0
310
差分ベースで効率的にテストを実行してみる
riseshia
1
830
Cookpad internship 2020 summer - web
riseshia
0
7.7k
Other Decks in Technology
See All in Technology
案件に一番詳しいAIを Amazon Bedrock AgentCore で作る ― 知見が知見を生むチームへ / Compounding Knowledge with AgentCore
yusukeshimizu
1
120
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
220
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
4
370
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
1
6k
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
280
少人数チームで実現する、大規模AWSサーバーレス基盤における"揺らがない"信頼性運用
maimyyym
1
100
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
19k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
LanceDB入門
mocobeta
8
580
自宅NWにISR4331を導入してみた話
okaits
0
110
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
700
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
340
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
400
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
It's Worth the Effort
3n
188
29k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
470
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
490
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
770
Become a Pro
speakerdeck
PRO
31
6.2k
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)