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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shia
April 22, 2026
Technology
540
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
1
4.4k
型を書かないRuby開発への挑戦
riseshia
0
5.7k
ひとつの開発環境
riseshia
0
92
Conquering Massive Traffic Spikes in Ruby Applications with Pitchfork
riseshia
0
360
スパイクアクセス対策としての pitchfork 導入
riseshia
0
930
NewEngineering 2024 - 繋がっていくサービスを支える開発環境作り
riseshia
0
1.7k
Hotspot on Coverage
riseshia
0
290
差分ベースで効率的にテストを実行してみる
riseshia
1
810
Cookpad internship 2020 summer - web
riseshia
0
7.7k
Other Decks in Technology
See All in Technology
Javaで学ぶSOLID原則
negima
1
270
Spring AI × MCP 入門〜AIエージェントへのツール公開、境界設計から始める最小構成 〜
yuyamiyamoto
0
210
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
50k
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
330
Dynamic Workersについて
yusukebe
2
570
チームで実践する AI-DLC 思考の軌跡を残すチェックポイント設計
belongadmin
0
2.1k
運用を見据えたAIエージェント設計実践
amacbee
0
2.3k
Sony_KMP_Journey_KotlinConf2026
sony
2
210
20260528_生成AIを専属DSに_Howの次にすべきことを考える
doradora09
PRO
0
280
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
320
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
16
8.3k
React、まだ楽しくて草
uhyo
7
3.9k
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
310
Ruling the World: When Life Gets Gamed
codingconduct
0
240
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
600
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
530
Mind Mapping
helmedeiros
PRO
1
230
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
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)