Chromiumの規模を確認する その3: バージョン間の変更量


Chromiumのバージョン間の差分の規模を確認する

前回までは Chromium の規模をLOCで確認した
今回はChromiumのバージョン間の変更量を確認する

Chromiumは6週間毎に定期リリースをしている
巨大なソフトウェアとしては異例の頻繁なリリースをしている Chromium だが、1つバージョンが上がるたびにどの程度の変更が入っているのか?

結論

  • 88.0.4324.91
  • 89.0.4388.4

のバージョン間で確認した変更量

変更内容 規模
変更・追加・削除されたファイル (C,C++,Assembly,Java) 2万ファイル以上
変更・追加・削除されたコード (C,C++,Assembly,Java) 100万LOC以上
変更・追加・削除されたコードの割合 コード全体の約7%

比較対象

まずは Chromium の各バージョンの最新タグを確認

$ git show-ref --tag | sed s/refs\\/tags\\///g | sort -k2,2 -V -r | awk  -F'[ .]' '!colname[$2]++{print}' | head

70aa692d68ee86d365928edd160c3575fda2b453 pre_blink_merge
b9f09110acc31d8cfcdaf9ad99994493993fc837 89.0.4388.4
5133e62bf71cdc73827e8a692f41c340fae44f0c 88.0.4324.91
5b067f298bad6ee9966e55409ae85923aeafb4dd 87.0.4280.151
8e2f4b1218732818284cc04088d9d9618b22889f 86.0.4240.261
1b92670ff184497b121d26c7ecaff6006ac1697b 85.0.4183.162
9fe9eba385acebd69c14548b73dce6126c1ae1b2 84.0.4147.142
894fb9eb56c6cbda65e3c3ae9ada6d4cb5850cc9 83.0.4103.122
690e69771fa599fb1c6e9114c5d9b1296621b86a 82.0.4085.28
39d87f902daa0d138ded056c26e63c94558829b7 81.0.4044.156

下記の2つのバージョンの差をLOCで確認する
- 88.0.4324.91
- 89.0.4388.4

cloc --diff は git のコミット間の変更量を調査することができる
しかし、コミット間のサブディレクトリを比較するにはひと手間かかり面倒なので、もう一つ git リポジトリを用意して、ディレクトリ間の比較で調査を進める

M88用にリポジトリを用意

$ cd ~/work
$ time cp -rf chromium chromium2

real    5m32.421s
user    0m3.462s
sys 1m51.560s

$ (cd chromium/src/ && git status)
HEAD detached at 89.0.4388.4
nothing to commit, working tree clean

$ (cd chromium2/src/ && git status)
HEAD detached at 89.0.4388.4
nothing to commit, working tree clean

コピーしたリポジトリに1つ前のバージョンのソースコードをチェックアウト

$ cd ~/work/chromium2/src/
$ git checkout 88.0.4324.91
Checking out files: 100% (46989/46989), done.
Previous HEAD position was b9f09110acc3 Publish DEPS for 89.0.4388.4
HEAD is now at 5133e62bf71c Publish DEPS for 88.0.4324.91

$ git status
HEAD detached at 88.0.4324.91

It took 2.70 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
nothing to commit, working tree clean

2つのディレクトリのソースコードを比較する

$ time ~/work/cloc-1.88/cloc --quiet --diff --timeout=60 --diff-timeout=60 --csv chromium2/src chromium/src > cloc_diff_M88_M89.csv

7 errors:
Diff error, exceeded timeout:  chromium2/src/testing/buildbot/chromium.android.json v. chromium/src/testing/buildbot/chromium.android.json
Diff error, exceeded timeout:  chromium2/src/testing/buildbot/chromium.fyi.json v. chromium/src/testing/buildbot/chromium.fyi.json
Diff error, exceeded timeout:  chromium2/src/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json v. chromium/src/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
Diff error, exceeded timeout:  chromium2/src/testing/buildbot/chromium.clang.json v. chromium/src/testing/buildbot/chromium.clang.json
Diff error, exceeded timeout:  chromium2/src/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml
Diff error, exceeded timeout:  chromium/src/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml
Diff error, exceeded timeout:  chromium2/src/testing/buildbot/chromium.gpu.fyi.json v. chromium/src/testing/buildbot/chromium.gpu.fyi.json

real    53m22.413s
user    46m56.280s
sys 1m51.859s

タイムアウトエラーが発生したファイルは大きめのサイズの xml か json ファイル
ツールかテスト用のファイルのようなので、無視して進める

変更量

ファイルの変更数

Language 差分ファイル 追加ファイル 削除ファイル 合計
C++ 11,082 595 1,101 12,778
C/C++ Header 5,868 552 904 7,324
HTML 1,024 1,573 1,528 4,125
JavaScript 1,245 524 524 2,293
Java 1,434 278 367 2,079
XML 1,806 113 142 2,061
Python 762 231 195 1,188
Objective-C++ 852 57 77 986
JSON 163 270 39 472
XHTML 0 163 148 311
その他 1,214 242 552 2,008
合計 25,450 4,598 5,577 35,625

C, C++, Assembly, Javaの4言語のファイルだけでも 2万ファイル以上に何らかの修正が入っている

Language 差分ファイル 追加ファイル 削除ファイル 合計
C++ 11,082 595 1,101 12,778
C/C++ Header 5,868 552 904 7,324
C 47 27 5 79
Java 1,434 278 367 2,079
Assembly 36 0 0 36
合計 16,997 1,174 2,010 20,181



コードの変更量

Language 差分コード 追加コード 削除コード 合計
C++ 87,921 174,648 298,045 560,614
C/C++ Header 18,329 210,391 68,542 297,262
HTML 4,393 73,967 89,078 167,438
JavaScript 6,158 62,237 70,182 138,577
XML 9,777 51,513 73,560 134,850
C# 961 19,673 80,721 101,355
JSON 13,780 45,697 33,063 92,540
Java 6,802 30,905 45,411 83,118
Python 6,029 32,850 36,334 75,213
C 4,734 29,294 24,942 58,970
その他 12,662 51,463 65,147 129,272
合計 171,546 782,638 885,025 1,839,209

C, C++, Assembly, Javaの4言語の差分(変更・追加・削除)コードが 100万LOC を越える

Language 差分コード 追加コード 削除コード 合計
C++ 87,921 174,648 298,045 560,614
C/C++ Header 18,329 210,391 68,542 297,262
C 4,734 29,294 24,942 58,970
Java 6,802 30,905 45,411 83,118
Assembly 3364 8897 724 12985
合計 121,150 454,135 437,664 1,012,949



コードの変更の割合

全体の約7%のコードに差分 (変更・追加・削除) がある