Re: 10% drop in code line count in PG 17

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: 10% drop in code line count in PG 17
Date: 2025-11-20 13:44:04
Message-ID: CAJ7c6TPBY4Q9wH73ByTyw-4OeUpi8p6cB9atExZroQ8NAhj_SA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-11-20 13:49:51 Re: 10% drop in code line count in PG 17
Previous Message Bertrand Drouvot 2025-11-20 13:33:51 Remove useless casts to (void *)