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
Go 1.24 のイテレータ from byte to bite
Search
Nozomu Ikuta
February 25, 2025
Technology
0
29
Go 1.24 のイテレータ from byte to bite
CA.go ~ Deep dive into Go1.24 ~ の登壇資料です
Nozomu Ikuta
February 25, 2025
Tweet
Share
More Decks by Nozomu Ikuta
See All by Nozomu Ikuta
Demystifying Vite Internals
nozomuikuta
3
1.9k
Nuxt DevTools 101
nozomuikuta
3
1.8k
Deep Dive to UnJS and Nuxt 3
nozomuikuta
3
2.4k
OSS作者はじめの一歩
nozomuikuta
1
160
2022 年は Docus に注目しよう
nozomuikuta
1
86
Go初学者、最初の1週間の学び
nozomuikuta
1
77
Other Decks in Technology
See All in Technology
運用しているアプリケーションのDBのリプレイスをやってみた
miura55
1
830
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
1.2k
The Future of SEO: The Impact of AI on Search
badams
0
240
Culture Deck
optfit
0
480
転生CISOサバイバル・ガイド / CISO Career Transition Survival Guide
kanny
3
1.1k
深層学習と古典的画像アルゴリズムを組み合わせた類似画像検索内製化
shutotakahashi
1
260
なぜ私は自分が使わないサービスを作るのか? / Why would I create a service that I would not use?
aiandrox
0
880
Perlの生きのこり - エンジニアがこの先生きのこるためのカンファレンス2025
kfly8
1
220
株式会社EventHub・エンジニア採用資料
eventhub
0
4.3k
LINEギフトにおけるバックエンド開発
lycorptech_jp
PRO
0
110
Classmethod AI Talks(CATs) #17 司会進行スライド(2025.02.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol17_2025-02-19
shinyaa31
0
160
エンジニアのためのドキュメント力基礎講座〜構造化思考から始めよう〜(2025/02/15jbug広島#15発表資料)
yasuoyasuo
18
7.1k
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
500
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Transcript
Nozomu Ikuta 25th Feb. 2025 Go 1.24 ͷΠςϨʔλ from byte
to bite
@nozomuikuta X / GitHub • ιϑτΣΞΤϯδχΞ • Vue.js ຊϢʔβʔάϧʔϓίΞελοϑ •
UnJS ϝϯόʔ • Nuxt / Vite ίϯτϦϏϡʔλ
ϩΰืूத Shibuya.go
• ΠςϨʔλ͓͞Β͍ • bytes ύοέʔδͷΠςϨʔλ
ΠςϨʔλ͓͞Β͍
ΠςϨʔλ͓͞Β͍ • Go 1.23 ͰՃ͞Εͨ • yield ʹΑͬͯ࿈ଓͨ͠ΛίʔϧόοΫؔʹΘͨؔ͢ͷ͜ͱ • ͕ͳ͘ͳΔ͔
yield ͕ false Λฦ͢ͱΠςϨʔγϣϯ͕ऴྃ͢Δ
ΠςϨʔλ͓͞Β͍ • ͻͱͭͷΛΘͨ͢: Seq[V any] func(yield func(V) bool) • slices.All()
• slices.Values() • slices.Backward() • slices.Sorted() • etc.
ΠςϨʔλ͓͞Β͍ • ;ͨͭͷΛΘͨ͢: Seq2[K, V any] func(yield func(K, V) bool)
• maps.All() • maps.Insert() • etc.
bytes ύοέʔδͷΠςϨʔλ
• bytes.Lines() • bytes.FieldsSeq() • bytes.SplitSeq() • bytes.SplitAfterSeq() • bytes.FieldsFuncSeq()
bytes ύοέʔδͷΠςϨʔλ طఆͰׂ / ࣗ༝Ͱׂ
func Lines(s []byte) iter.Seq[[]byte] • newlineʢվߦʣͷޙͰ byte Λ۠ ͬͯฦͯ͘͠ΕΔ •
֤ඌʹվߦ͕͍ͭͯ͘Δ • byte ඌͷվߦͷ༗ແଚॏ͞Ε Δ bytes ύοέʔδͷΠςϨʔλ
func FieldsSeq(s []byte) iter.Seq[[]byte] • unicode.IsSpace()ʢۭനʣʹ߹க͢ Δ෦Ͱ byte Λ۠ͬͯฦͯ͘͠ ΕΔ
• ֤લޙʹۭനΛ;͘·ͳ͍ bytes ύοέʔδͷΠςϨʔλ
func SplitSeq(s, sep []byte) iter.Seq[[]byte] • ҙͷ byte slice Ͱ۠ͬͯฦͯ͠
͘ΕΔ • ֤ඌʹ۠Γ෦Λ;͘·ͳ͍ bytes ύοέʔδͷΠςϨʔλ
func SplitAfterSeq(s, sep []byte) iter.Seq[[]byte] • ҙͷ byte slice Ͱ۠ͬͯฦͯ͠
͘ΕΔ • ֤ඌʹ۠Γ෦Λ;͘Ή bytes ύοέʔδͷΠςϨʔλ
• ҙͷؔͰ byte Λ۠ͬͯฦ͠ ͯ͘ΕΔ • unicode.IsX() ϝιουͳͲͱΈ߹ Θͤͯ͏ •
֤લޙʹ۠Γ෦Λ;͘·ͳ ͍ bytes ύοέʔδͷΠςϨʔλ func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte]
·ͱΊ
• bytes ύοέʔδʹΠςϨʔλ͕ಋ ೖ͞Εͨ • ʮ۠ͬͯϧʔϓʯ͕ΑΓศརʹ
ࢀߟจݙ • https://go.dev/doc/go1.24 • https://pkg.go.dev/iter • https://pkg.go.dev/bytes
Thank you