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
Hideo Hattori
January 18, 2019
Technology
580
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
More Decks by Hideo Hattori
See All by Hideo Hattori
RustとPython
hhatto
4
2.7k
PyCon APAC 2013 LT
hhatto
0
95
PHP Kansai 2013 LT
hhatto
0
110
Other Decks in Technology
See All in Technology
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
300
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
350
SREへの勘違いに気づいた後の話
tomodakengo
0
110
CLIライブラリ開発を支える技術
htnabe
0
140
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.8k
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
2.9k
【技術的負債conf】事業成長に伴う技術的負債の説明責任とAIによるモニタリング、認知的負債について
i35_267
3
1.8k
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
310
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
360
データ_AIの事業の勝敗をわけるもの
nek0128
1
460
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
460
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
240
Fireside Chat
paigeccino
43
4k
Design in an AI World
tapps
1
320
Scaling GitHub
holman
464
140k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Transcript
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!!