Thread

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

    Bruce Momjian <bruce@momjian.us> — 2025-11-19T20:34:55Z

    On Wed, Nov 19, 2025 at 03:21:33PM -0500, Tom Lane wrote:
    > Bruce Momjian <bruce@momjian.us> writes:
    > > 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
    > 
    > > Any ideas on the cause of this decrease?
    > 
    > My first thought was that it had to do with the conversion of
    > src/backend/nodes/ to be largely auto-generated code.  If you
    > are using codelines against just what is in git, that would look
    > like a decrease.  However, I see that came in during v16 not v17,
    > so that's not the explanation.  I'm betting it's some similar
    > effect though: code getting moved out of the set of files that
    > will match '*.[chyl]'.
    
    Huh.
    
    > Also ... are you in fact counting only what is in git?  Because
    > I get different answers:
    > 
    > $ git clean -dfxq
    > $ git checkout REL_17_0
    > HEAD is now at d7ec59a63d7 Stamp 17.0.
    > $ src/tools/codelines
    >  1664472
    > $ git checkout REL_16_0
    > HEAD is now at c372fbbd8e9 Doc: fix release date in release-16.sgml.
    > $ src/tools/codelines
    >  1595197
    
    No, I just followed the shell comment I wrote above the 'find' command
    shown above:
    
    	# This script is used to compute the total number of "C" lines in the
    	# release This should be run from the top of the Git tree after a 'make
    	# distclean'
    
    And that tree has been built many times.  Should I change my procedure?
    
    -- 
      Bruce Momjian  <bruce@momjian.us>        https://momjian.us
      EDB                                      https://enterprisedb.com
    
      Do not let urgent matters crowd out time for investment in the future.