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
94
PHP Kansai 2013 LT
hhatto
0
110
Other Decks in Technology
See All in Technology
Genie Code ワークショップ 応用編 / Genie-Code-Workshop-advanced
databricksjapan
PRO
0
310
Redmine 7.0で私が開発した新機能の狙いと背景
vividtone
1
110
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
240
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
6
6.8k
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
【試作】IoT x AIエージェント
happysamurai294
0
120
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
150
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
140
Claude Codeの体系的な理解と知識のフック
oikon48
10
6.7k
Bet AI Day 2026丨Production-Ready AI Agents — エンタープライズの実務を任せるための設計と運用
layerx
PRO
3
2k
PM領域でのAI Agentの活用
lycorptech_jp
PRO
0
270
少人数データチームのDevin活用実践事例
runandy16
2
430
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
470
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
520
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The browser strikes back
jonoalderson
0
1.6k
Are puppies a ranking factor?
jonoalderson
2
3.9k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
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!!