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
gocloc
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hideo Hattori
January 18, 2019
Technology
590
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
gocloc
https://github.com/hhatto/gocloc
Hideo Hattori
January 18, 2019
Transcript
13 slides
gocloc Umeda.go 2019 Winter 2019.01.18
whoami Hideo Hattori (hhatto) 関西圏でソフトウェアエンジニアをしています Rust, Python, Go, C などが好きです
今日お話しすること gocloc 作ってみました 得られた知見
gocloc とは?
gocloc ソースコードの行数を数えるツール Perl 実装のcloc がベース
モチベーション cloc が遅いので速いツールが欲しかった Rust でも同じような実装があったのでGo でもどれ くらい高速になるか試したかった
実行イメージ $ gocloc . Language files blank comment code
Go 13 164 42 1369 Markdown 1 20 0 149 Makefile 1 5 0 14 TOML 1 2 0 9 YAML 1 2 0 8 TOTAL 17 193 42 1549
主な機能 言語毎のファイル数/ 空行数/ コメント行数/ コード 行数の表示 ファイル毎のファイル数/ 空行数/ コメント行数/ コ
ード行数の表示( byfile オプション) 出力結果が多様なフォーマットに対応
得られた知見
得られた知見 goroutine 使わなくてもGo で実装するだけで動作 が軽量なツールが実装できる シングルバイナリでツールを提供できて配布が楽 ファイルの言語判定にはsrc-d/enry を使うとより高 速になる generaltso/linguist
がもともと存在していた が、src-d/enry に切り替えたところ高速に動作 した
得られた知見 boyter/scc というGo の別実装が登場 ファイルの言語判定が自前なので速い goroutine を使っていてgocloc よりさらに高速 gocloc もgoroutine
使えばさらに高速化できる かもしれない ATS という言語で実装されているPolyglot というツ ールが最速
合わせて読むと良いかもしれないリンク集 gocloc - fast cloc implementation | hexacosa.net 実装初期にまとめたgocloc 誕生の経緯など
Sloc Cloc and Code Revisited - Optimizing an already fast Go application | Ben E. C. Boyter Yet Another なGo で実装されたcloc クローン。 gocloc より速い!! Polyglot Is the Fastest Code-counting Tool Available Polyglot という最速のcloc クローン。ATS という 言語で実装されている
Thank you!!
More Decks by Hideo Hattori
See All by Hideo Hattori
RustとPython
hhatto
4
2.7k
PyCon APAC 2013 LT
hhatto
0
100
PHP Kansai 2013 LT
hhatto
0
120
Other Decks in Technology
See All in Technology
データから見る AI時代のエンジニア転職と採用
junya_okura
4
1.5k
一口馬主の募集馬をAIで診断してみた
yoshimura_datam
0
130
Amazon ECS ネットワークモード選びに悩まない ~検証を通じて見えたネットワークモードの選び方~ / 20261114 Masaki Okuda
shift_evolve
PRO
1
160
本の挿絵に困ったから挿絵メーカーを自作した
yoshimura_datam
1
140
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
270
ポケモンバトルのAIエージェント
koji_kawamura
0
330
Claude Certified Developer – Professional 試験対策
shinoisa
0
320
Kiro のリモートワークスペース: IDE は手元のままで、ワークスペースをクラウド、コンテナ、自前のマシンに置く
inariku
PRO
2
270
Ignite 2026 Security
babaneko
0
120
Is the Website Dying?
miriamschwab
0
290
最近のMySQL事情について
yoku0825
1
480
AIエージェントの認証がまとめて進化! ~pre:Inventで来た3つのアップデート~
minorun365
PRO
1
250
Featured
See All Featured
Designing Experiences People Love
moore
143
24k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
540
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
390
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
690
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.7k
Are puppies a ranking factor?
jonoalderson
2
4.2k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
620
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
2
4.1k