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
gocloc
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
88
PHP Kansai 2013 LT
hhatto
0
110
Other Decks in Technology
See All in Technology
現場回帰したデータエンジニアが考える AI 時代のキャリア開発 / Career Development in the Age of AI Perspectives from a Hands-on Data Engineer
medley
0
320
属人化を叩き割れ!「制作加速」と「安定化」の矛盾を打破する:8年目プロダクトが辿り着いた「ミスが起こり得ない」アセット制作フローの全貌
gree_tech
PRO
0
460
Android skills に学ぶ
kokiko
0
170
安全性・開発速度・ユーザー体験の あいだで考える 事業会社のプロダクトセキュリティ
mixi_engineers
PRO
0
110
小粒でもパワフルなJS Runtime Antjsについて
comamoca
0
120
【GCC2026】TrueHDRIを用いたルックデブ環境とライティングテクニック
bandainamcostudios
PRO
0
370
AI-DLC実践録_フルサイクル開発への挑戦
miyuc
0
420
暗号化?某ファイルストレージはどうなるの!? 3rd Partyとうまく付き合う秘密度ラベル設計
kasada
0
180
AI・HPC開発を支えるGPU環境の新しい選択肢 液冷GPUシステム「AquSys」の取り組み
gpuunite_official
0
240
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
4
26k
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
250
AI画像認識を活用したゲーム内決済処理検証の自動化
gree_tech
PRO
0
450
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Paper Plane
katiecoart
PRO
2
53k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
950
Automating Front-end Workflow
addyosmani
1369
210k
Un-Boring Meetings
codingconduct
0
390
Building Adaptive Systems
keathley
44
3.2k
Technical Leadership for Architectural Decision Making
baasie
3
530
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
870
Making Projects Easy
brettharned
120
6.7k
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!!