Re: 10% drop in code line count in PG 17 - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: 10% drop in code line count in PG 17
Date
Msg-id CAJ7c6TPBY4Q9wH73ByTyw-4OeUpi8p6cB9atExZroQ8NAhj_SA@mail.gmail.com
Whole thread Raw
In response to 10% drop in code line count in PG 17  (Bruce Momjian <bruce@momjian.us>)
Responses Re: 10% drop in code line count in PG 17
List pgsql-hackers
Hi Bruce,

> While working on a talk, I studied the number of code line changes in
> each major release, and found PG 17 surprisingly reduced code line count
> by 10%. To get the code line count, I used /pgtop/src/tools/codelines,
> which runs:
>
>         find . -name '*.[chyl]' | xargs cat| wc -l

FWIW I get different results with `cloc`:

$ git checkout REL_18_STABLE
$ git clean -dfx # be careful! this will drop your local .clangd settings etc
$ cloc ./

github.com/AlDanial/cloc v 1.98  T=3.38 s (1448.6 files/s, 915951.4 lines/s)
---------------------------------------------------------------------------------------
Language                             files          blank
comment           code
---------------------------------------------------------------------------------------
C                                     1555         189668
393758         940984
PO File                                466         180914
221367         543216
SQL                                    791          30420
23631         124104
C/C++ Header                           973          18935
64368         114176
Perl                                   335          13402
12264          60254
XML                                      3              4
15          30922
... skipped ...
---------------------------------------------------------------------------------------
SUM:                                  4895         446873
728634        1919686
---------------------------------------------------------------------------------------

$ git checkout REL_17_STABLE
$ cloc ./

github.com/AlDanial/cloc v 1.98  T=2.68 s (1764.0 files/s, 1104266.3 lines/s)
---------------------------------------------------------------------------------------
Language                             files          blank
comment           code
---------------------------------------------------------------------------------------
C                                     1507         181725
376154         905987
PO File                                466         174902
211970         529317
SQL                                    754          28606
21625         115742
C/C++ Header                           943          18255
61771         100741
Perl                                   309          11882
10905          52974
XML                                      3              4
15          30922
... skipped ...
---------------------------------------------------------------------------------------
SUM:                                  4733         428393
695356        1839064
---------------------------------------------------------------------------------------

Overall, there is a 4% increase according to this tool. What is
convenient about `cloc` - you can count only what you want, e.g. code
without comments, etc.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Remove useless casts to (void *)
Next
From: Aleksander Alekseev
Date:
Subject: Re: 10% drop in code line count in PG 17