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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shia
April 22, 2026
Technology
50
1
Share
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
0
140
型を書かないRuby開発への挑戦
riseshia
0
1.7k
ひとつの開発環境
riseshia
0
79
Conquering Massive Traffic Spikes in Ruby Applications with Pitchfork
riseshia
0
320
スパイクアクセス対策としての pitchfork 導入
riseshia
0
870
NewEngineering 2024 - 繋がっていくサービスを支える開発環境作り
riseshia
0
1.7k
Hotspot on Coverage
riseshia
0
280
差分ベースで効率的にテストを実行してみる
riseshia
1
790
Cookpad internship 2020 summer - web
riseshia
0
7.7k
Other Decks in Technology
See All in Technology
AI時代における技術的負債への取り組み
codenote
1
1.4k
[最強DB講義]推薦システム | 基礎編
recsyslab
PRO
1
160
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
200
ARIA Notifyについて
ryokatsuse
1
120
Amazon S3 Filesについて
yama3133
2
210
こんなアーキテクチャ図はいやだ / Anti-pattern in AWS Architecture Diagrams
naospon
1
440
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
360
自立を加速させる神器 - EMOasis #11
stanby_inc
0
130
エージェントスキルを作って自分のインプットに役立てよう
tsubakimoto_s
0
150
MLOps導入のための組織作りの第一歩
akasan
0
320
AzureのIaC管理からログ調査まで、随所に役立つSkillsとCustom-Instructions / Boosting IaC and Log Analysis with Skills
aeonpeople
0
220
みんなの「データ活用」を支えるストレージ担当から持ち込むAWS活用/コミュニティー設計TIPS 10選~「作れる」より、「続けられる」設計へ~
yoshiki0705
0
240
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
94
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
170
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
The Curse of the Amulet
leimatthew05
1
11k
Making Projects Easy
brettharned
120
6.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
520
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.1k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
Practical Orchestrator
shlominoach
191
11k
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)