Hey everyone,
I’m not super technical, but I came across this slide from River:
276,000 code changes sounds like a massive number to me.
ChatGPT mentioned that this means nearly 40% of the code was altered in 2024.
That seems like a huge amount. Is this info trustworthy? How can I check this?
You can verify this from their github repository https://github.com/bitcoin/bitcoin and clicking on insight(click on the... at the top corner if it's not visible) would grant access to various data.
What you need should be in code frequency but github limits visualization for massive projects like Bitcoin.
So you can check on contributors and it would show their commits( saved file of changes).
Specify the duration to let's say 12 months and you can see their commit and to check manually. Click on their profile and you would see some project they have worked on. Click on Bitcoin Core and select the Year. Yes quite time consuming but the essence is to show that it's indeed possible for such changes to have been made not to verify everything.
If it's still not clear. I could use image though.
That PDF screenshot have misleading information.
1. Not all lines of code on Bitcoin Core manage Bitcoin protocol, some of them have different usage (such as wallet management and how blockchain data is stored locally).
2. A Bitcoin Core developer state over 70% activity is related with maintenance[1].
3. With Ctrl-F, i unable to find mention whether "Over 276,000" include comment (rather than actual code) and refactor (rewrite the code without change on it's behavior).
And in narrow sense, Taproot was most recent major protocol change.
[1] https://www.coindesk.com/consensus-magazine/2023/02/23/can-bitcoin-afford-to-maintain-its-core-network-coindesk
The protocol itself can only change through a fork (soft or hard fork) and we have only had about a dozen of them so far in the past 16 years, from BIP-16 (P2SH) all the way to BIP-341-342-343 (Taproot).
Since the Bitcoin protocol is written in stone, they at least have to pretend they're doing something.
They all have two things in common: they changed the world, and they are outdated.
Hello fillippone!
Out of curiousity, I asked git about these stats and I am posting the responses below.
Please take them with a grain of salt!
I am using the master branch for the statistics.
The first commit of 2024 was made on Jan 3rd, 2024 and the hash was 65c05db660b2ca1d0076b0d8573a6760b3228068:
The last commit of 2024 was made on December 31, 2024 and the hash was 2bdaf52ed1259fd3bec22b680e12563fcee0a8b3:
Between these commits, there have been many changes, you can get an idea about how many using the following command:
The total number of lines of code that bitcoin has is 921267.
The total number of files that bitcoin has is 2768.
According to your statistics, there were 130K insertions and 80K deletions, so the claim of "276,000 lines of code changes" seems a lot.
Even considering refactoring or multiple changes over the same lines of code, the total seems too big compared to the total number of lines of code: 921267.
Seems strange, as River is a pretty reputable source of information.
River is reputable indeed, although I don't have personal experience with them.
Well, as you said refactoring is something that can't be easily measured because the 130K insertions and 80K deletions are aggregated values.
You can't be perfectly sure about the number of lines that have been added or removed.
It would be better if they had given us the branches on which they have made their calculations. I reckon they could have taken all the Pull Requests of 2024 and have counted the number of lines, for the PRs that have been merged on master.
I am definitely curious to know how they came up with this number. If you have any info on this, let me know. Because, indeed, 276,000 lines are too many. Which doesn't mean that it's not true, but I am just curious.
Sorry for double posting, I normally don't do it, but I want it to be clearly seen here
EDIT:
I 've found the way they calculated it.
According to Jameson Lopp[1], the command they used was:
which, I just ran and gave me this response:
Essentially what it does is:
1. it takes all the commits after 2023-12-31 and before 2024-12-31 (i.e. in 2024), with this git log --no-merges --after="2023-12-31" --before="2024-12-31" --stat
2. the result for each log will have the commit message, the commit author, the description and details in this format: 2 files changed, 2 insertions(+), 2 deletions(-)
3. it uses grep -Eo '[0-9]+ insertions|[0-9]+ deletions' to get the details in this format: 45 deletions, 91 insertions etc.
4. it uses awk '{sum+=$1} END {print "Total lines changed:", sum}' to aggregate all the numbers. For example: 45 + 91 = 136 lines.
I don't like this command, but it's Jameson Lopp who did it, so I can't say a lot. He 's more trustworthy than I am.
[1] https://blog.lopp.net/bitcoin-2024-annual-review/
Small silly knowledge of the day! I hope you enjoyed it as much as I did
It might be worth knowing that Git is not exactly reporting amount of code changes and the X number of insertions and Y number of deletions that is reported is not necessarily total number changes in "lines of code". Take this commit for instance for better understanding of what I mean:
https://github.com/bitcoin/bitcoin/commit/c7d5dcaa61471cc26c3fb1772dfc4c82b20e1f9d#diff-c42097cc877be0016cc04ac42254466b267533286801646a2100db673b806e67
It is a typo fix commit and this particular part of it is simply adding the letter "t" to a comment (ie. commiting to committing) inside src/txgraph.h file, but git counts that as 2 changes: 1 deletion and 1 addition (1 line deleted, 1 line added).
Sure, it's not a good (accurate) metric. You need to take this into account.
I don't think Git can provide a more accurate count however, because technically it's a pointer-based system. So, the change in the commit you posted is a modification of the same line but for Git something was deleted and something else was added.