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
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
140
Data Hubグループ 紹介資料
sansan33
PRO
0
3.2k
AIのためのEthernet技術動向 (SerDes)
markunet
1
200
私がブラウザを自作したくなった理由
supurazako
1
250
35分でわかるEffective Platform Engineering
nwiizo
3
120
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
なぜ Temporal の大小比較には compare しかないのか / Why Does Temporal Only Have compare() for Comparisons
kazukihayase
1
150
20260807_第6回_関東kaggler会LT_claw系bot xangiと始める、"寂しくない" kaggle
sugupoko
0
320
【AG-UI × A2UI × MCP Apps】Generative UIをやさしく解説する
nrinetcom
PRO
1
140
Webアクセシビリティ入門 2026
recruitengineers
PRO
3
640
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
110
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
250
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.4k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
400
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
210
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
How to Ace a Technical Interview
jacobian
281
24k
Designing for Performance
lara
611
70k
Making the Leap to Tech Lead
cromwellryan
135
10k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
370
The SEO identity crisis: Don't let AI make you average
varn
0
530
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)