Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
"String intern" を知ってますか?
Search
skokado
October 14, 2022
Programming
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
"String intern" を知ってますか?
20221014_PyConJP2022_LT
skokado
October 14, 2022
More Decks by skokado
See All by skokado
ポートフォリオページの公開にGitLab CI/CDを使っている話
skokado
4
2.1k
Other Decks in Programming
See All in Programming
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.4k
新卒PdEのリアル
ryu1013
1
480
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
200
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
56
37k
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
Foundry Localでエージェント開発
seosoft
0
170
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
280
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
Heart of Swift Concurrency
koher
0
180
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
108
250k
First, design no harm
axbom
PRO
2
1.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
830
Believing is Seeing
oripsolob
1
210
Bash Introduction
62gerente
615
220k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
270
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Transcript
“String intern” を知ってますか? 2022/10/14 @ PyCon JP 2022 LT
• 小門 照太 ◦ https://portfolio.skokado.me/ • 職種:インフラ / クラウドエンジニア •
所属:株式会社RevComm • Python, AWS, DevOps, … • 小鳥+猫 自己紹介
(再掲) “String intern” を知ってますか? 2022/10/14 @ PyCon JP 2022 LT
クイズです
次のうち is による比較結果が True になるのはどれでしょう? クイズです
次のうち is による比較結果が True になるのはどれでしょう? クイズです
次のうち is による比較結果が True になるのはどれでしょう? ⇒Answer: 1, 2, 3 クイズです
次のうち is による比較結果が True になるのはどれでしょう? ⇒Answer: 1, 2, 3 ※補足
- Python 3.10.6 - 対話モードで実行する場合 - 右の記法では True クイズです
“String intern” なぜか
メモリー内の “隔離” されたテーブルに文字列の値のコピーを格納する仕組み What is “String intern” ?
メモリー内の “隔離” されたテーブルに文字列の値のコピーを格納する仕組み What is “String intern” ? 文字列 PyConJP
が “intern” された
メモリー内の “隔離” されたテーブルに文字列の値のコピーを格納する仕組み メリット • 値が同じ変数同士を比較する場合のパフォーマンス向上 ◦ 文字列の値ではなくポインタで比較可能になるため What is
“String intern” ?
しかし、メモリー使用量やオーバーヘッドのトレードオフがある。 そのため「全ての文字列を intern する」わけではない。 ⇒Python はいくつかのルールに基づいて intern を行う ※「いくつかのルール」のドキュメントは見つけられず …
What is “String intern” ?
しかし、メモリー使用量やオーバーヘッドのトレードオフがある。 そのため「全ての文字列を intern する」わけではない。 ⇒Python はいくつかのルールに基づいて intern を行う ※「いくつかのルール」のドキュメントは見つけられず …
What is “String intern” ?
intern を強制することが可能 sys.intern()
「長い文字列の比較」においてパフォーマンスが向上する 使いどころ
「長い文字列の比較」においてパフォーマンスが向上する 使いどころ
リンク • String Interning in Python: A Hidden Gem That
Makes Your Code Faster Appendix
Thank you !