@@ -11,12 +11,10 @@ Inspired by [tokei](https://github.com/Aaronepower/tokei).
11
11
12
12
## Installation
13
13
14
+ require Go 1.19+
15
+
14
16
```
15
- # Go version >= 1.16
16
17
$ go install github.com/hhatto/gocloc/cmd/gocloc@latest
17
-
18
- # Go version < 1.16
19
- $ go get -u github.com/hhatto/gocloc/cmd/gocloc
20
18
```
21
19
22
20
Arch Linux user can also install from AUR: [ gocloc-git] ( https://aur.archlinux.org/packages/gocloc-git/ ) .
@@ -87,81 +85,103 @@ $ gocloc --show-lang
87
85
```
88
86
89
87
## Performance
90
- * CPU 3.1GHz Intel Core i7 / 16GB 1600MHz DDR3 / MacOSX 10.11.3
91
- * cloc 1.66
92
- * tokei 1.5.1
93
- * gocloc [ 6a9d4f5 ] ( https://github.com/hhatto/gocloc/commit/6a9d4f5b3d4e5df28fe78a04e8741595e22ada50 )
94
- * target repository is [ golang/go commit:633ab74 ] ( https://github.com/golang/go/tree/633ab7426a906b72dcf6f1d54e87f4ae926dc4e1 )
88
+ * CPU 3.8GHz 8core Intel Core i7 / 32GB 2667MHz DDR4 / MacOSX 13.3.1
89
+ * cloc 1.96
90
+ * tokei 12.1.2 compiled with serialization support: json
91
+ * gocloc [ a88edc5 ] ( https://github.com/hhatto/gocloc/commit/a88edc52b3eea697687f9546f6ac74a03c91c5fb )
92
+ * target repository is [ golang/go commit: f742ddc ] ( https://github.com/golang/go/tree/f742ddc349723667fc9af5d0f16233f7762aeaa0 )
95
93
96
94
### cloc
97
95
98
96
```
99
97
$ time cloc .
100
- 5171 text files.
101
- 5052 unique files.
102
- 420 files ignored.
103
-
104
- https://github.com/AlDanial/cloc v 1.66 T=23.31 s (204.0 files/s, 48203.3 lines/s)
98
+ 12003 text files.
99
+ 11150 unique files.
100
+ 1192 files ignored.
101
+
102
+ 8 errors:
103
+ Line count, exceeded timeout: ./src/cmd/dist/build.go
104
+ Line count, exceeded timeout: ./src/cmd/trace/static/webcomponents.min.js
105
+ Line count, exceeded timeout: ./src/net/http/requestwrite_test.go
106
+ Line count, exceeded timeout: ./src/vendor/golang.org/x/net/idna/tables10.0.0.go
107
+ Line count, exceeded timeout: ./src/vendor/golang.org/x/net/idna/tables11.0.0.go
108
+ Line count, exceeded timeout: ./src/vendor/golang.org/x/net/idna/tables12.0.0.go
109
+ Line count, exceeded timeout: ./src/vendor/golang.org/x/net/idna/tables13.0.0.go
110
+ Line count, exceeded timeout: ./src/vendor/golang.org/x/net/idna/tables9.0.0.go
111
+
112
+ github.com/AlDanial/cloc v 1.96 T=35.07 s (317.9 files/s, 78679.3 lines/s)
105
113
-----------------------------------------------------------------------------------
106
114
Language files blank comment code
107
115
-----------------------------------------------------------------------------------
108
- Go 4197 101140 125939 780280
109
- Assembly 331 6128 14654 40531
110
- HTML 41 4927 198 33316
111
- C 90 1076 940 7390
112
- Perl 12 185 177 1135
113
- Bourne Again Shell 25 209 266 933
114
- XML 4 85 9 623
115
- Bourne Shell 8 71 302 467
116
- Python 1 121 88 295
117
- DOS Batch 5 55 1 238
118
- JavaScript 4 48 122 231
119
- C/C++ Header 15 50 147 211
120
- CSS 3 51 9 176
121
- yacc 1 27 20 155
122
- Protocol Buffers 1 1 0 144
123
- Windows Resource File 4 25 0 116
124
- JSON 2 0 0 36
125
- make 7 12 10 35
116
+ Go 9081 205135 337681 1779107
117
+ Text 1194 11530 0 210849
118
+ Assembly 563 15549 21625 122329
119
+ HTML 17 3197 78 24983
120
+ C 139 1324 982 6895
121
+ JSON 20 0 0 3122
122
+ CSV 1 0 0 2119
123
+ Markdown 27 674 106 1949
124
+ Bourne Shell 16 253 868 1664
125
+ JavaScript 10 234 221 1517
126
+ Perl 10 173 171 1111
127
+ C/C++ Header 26 145 346 724
128
+ Bourne Again Shell 16 120 263 535
129
+ Python 1 133 104 375
130
+ CSS 3 4 13 337
131
+ DOS Batch 5 56 66 207
132
+ Windows Resource File 4 23 0 146
133
+ Logos 2 16 0 101
134
+ Dockerfile 2 13 15 47
135
+ C++ 2 11 14 24
136
+ make 5 9 10 21
137
+ Objective-C 1 2 3 11
126
138
Fortran 90 2 1 3 8
127
- C++ 1 3 5 7
128
139
awk 1 1 6 7
140
+ YAML 1 0 0 5
141
+ MATLAB 1 1 0 4
129
142
-----------------------------------------------------------------------------------
130
- SUM: 4755 114216 142896 866334
143
+ SUM: 11150 238604 362575 2158197
131
144
-----------------------------------------------------------------------------------
132
- cloc . 13.57s user 7.89s system 105 % cpu 20.413 total
145
+ cloc . 33.70s user 1.48s system 99 % cpu 35.237 total
133
146
```
134
147
135
148
### tokei
136
149
137
150
```
138
- $ time tokei --sort code .
139
- -------------------------------------------------------------------------------
140
- Language Files Total Blanks Comments Code
141
- -------------------------------------------------------------------------------
142
- Go 4272 1027537 103241 150411 773970
143
- Plain Text 28 0 0 0 137715
144
- Assembly 334 61318 6130 0 55188
145
- HTML 41 38441 4927 204 33316
146
- C 92 9436 1081 946 7409
147
- BASH 27 2134 260 570 1304
148
- XML 4 717 85 9 623
149
- Perl 10 1255 151 1096 343
150
- Python 1 504 121 56 327
151
- Batch 5 294 55 0 239
152
- JavaScript 4 401 48 122 231
153
- C Header 15 408 50 147 211
154
- CSS 3 236 51 9 176
155
- Protocol Buffers 1 145 1 0 144
156
- Markdown 3 0 0 0 115
157
- JSON 2 0 0 0 36
158
- Makefile 7 57 13 10 34
159
- FORTRAN Modern 2 12 1 3 8
160
- C++ 1 15 3 5 7
161
- -------------------------------------------------------------------------------
162
- Total 4852 1142910 116218 153588 1011396
151
+ $ time tokei --sort code --exclude "**/*.txt" .
152
+ ===============================================================================
153
+ Language Files Lines Code Comments Blanks
154
+ ===============================================================================
155
+ Go 9242 2330107 1812147 318036 199924
156
+ GNU Style Assembly 565 159534 127093 16888 15553
157
+ C 143 9272 6949 1000 1323
158
+ JSON 21 3122 3122 0 0
159
+ Shell 16 2785 2267 342 176
160
+ JavaScript 10 1972 1520 218 234
161
+ Perl 9 1360 1032 170 158
162
+ C Header 27 1222 727 349 146
163
+ BASH 16 918 521 279 118
164
+ Python 1 612 421 70 121
165
+ CSS 3 354 337 13 4
166
+ Autoconf 9 283 274 0 9
167
+ Batch 5 329 207 66 56
168
+ Alex 2 117 101 0 16
169
+ Dockerfile 2 75 47 15 13
170
+ C++ 2 49 24 14 11
171
+ Makefile 5 40 20 10 10
172
+ Objective-C 2 21 15 3 3
173
+ FORTRAN Modern 2 12 8 3 1
174
+ Markdown 18 2402 0 1853 549
163
175
-------------------------------------------------------------------------------
164
- tokei --sort code . 1.27s user 0.06s system 99% cpu 1.328 total
176
+ HTML 17 19060 18584 49 427
177
+ |- CSS 4 2071 1852 10 209
178
+ |- HTML 1 219 212 0 7
179
+ |- JavaScript 8 6920 6876 16 28
180
+ (Total) 28270 27524 75 671
181
+ ===============================================================================
182
+ Total 10117 2533646 1975416 339378 218852
183
+ ===============================================================================
184
+ tokei --sort code --exclude "**/*.txt" . 0.76s user 0.50s system 562% cpu 0.224 total
165
185
```
166
186
167
187
### gocloc
@@ -171,32 +191,30 @@ $ time gocloc --exclude-ext=txt .
171
191
-------------------------------------------------------------------------------
172
192
Language files blank comment code
173
193
-------------------------------------------------------------------------------
174
- Go 4197 101140 133703 773058
175
- Assembly 331 6128 14694 40510
176
- HTML 41 4927 198 33316
177
- C 90 1076 991 7389
178
- BASH 28 257 539 1330
179
- Perl 12 185 177 1135
180
- XML 4 85 9 623
181
- Python 1 121 88 295
182
- Batch 5 55 1 238
183
- JavaScript 4 48 122 231
184
- C Header 15 50 147 211
185
- CSS 3 51 9 176
186
- Yacc 1 27 20 155
187
- Protocol Buffers 1 1 0 144
188
- Markdown 3 29 0 86
189
- Plan9 Shell 4 25 42 74
190
- Bourne Shell 5 23 29 70
191
- JSON 2 0 0 36
192
- make 7 13 10 34
194
+ Go 9096 205242 352844 1764503
195
+ Assembly 563 15555 21624 122324
196
+ HTML 17 3197 212 24849
197
+ C 139 1324 983 6894
198
+ JSON 20 0 0 3122
199
+ BASH 27 345 1106 2122
200
+ Markdown 18 549 28 1825
201
+ JavaScript 10 234 218 1520
202
+ C Header 26 145 346 724
203
+ Perl 10 173 584 698
204
+ Python 1 133 104 375
205
+ CSS 3 4 13 337
206
+ Batch 5 56 0 273
207
+ Plan9 Shell 4 23 50 96
208
+ Bourne Shell 5 28 24 78
209
+ C++ 2 11 14 24
210
+ Makefile 5 10 10 20
211
+ Objective-C 2 3 3 15
193
212
FORTRAN Modern 2 1 3 8
194
213
Awk 1 1 6 7
195
- C++ 1 3 5 7
196
214
-------------------------------------------------------------------------------
197
- TOTAL 4758 114246 150793 859133
215
+ TOTAL 9956 227034 378172 1929814
198
216
-------------------------------------------------------------------------------
199
- gocloc --exclude-ext=txt . 0.76s user 0.15s system 116 % cpu 0.775 total
217
+ gocloc --exclude-ext=txt . 0.65s user 0.51s system 119 % cpu 0.970 total
200
218
```
201
219
202
220
## License
0 commit comments