Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kotlinの歴史を可視化する

moomin
June 22, 2024
1.8k

 Kotlinの歴史を可視化する

KotlinFest 2024

「可視化」のアプローチからKotlinの歴史を紐解いていきます。

発表中デモに用いた可視化結果:
https://explorekotlin-split.streamlit.app/

Kotlin organization配下のrepositoryのコミット数:
https://docs.google.com/spreadsheets/d/162KMzuAgLAIhD0GLGzMTDCiyR5Atbo9LNz5YeX6Ogis/edit?gid=0#gid=0

moomin

June 22, 2024
Tweet

Transcript

  1. Software Evolution Visualization 「ソフトウェアの進化」を可視化のアプローチで分析 分析対象 • Source Code Change •

    Developers Acttivity • Defects • Software Architecture 6 A systematic literature review of software visualization evaluation [ L.Merio et al., 2013 ]
  2. データの取得 13 filename 201401 201402 201403 … 202405 core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/ lazy/descriptors/LazyJavaClassMemberScope.kt

    22 1 5 … 0 core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/ lazy/descriptors/LazyJavaPackageFragmentScope.kt 21 0 0 … 0 … → 約27万行(277,326)
  3. 情報可視化 の設計指針 15 The Eyes Have It: A Task by

    Data Type Taxonomy for Information Visualizations [ B. Shneiderman, 1996 ] Visual Information Seeking Mantra Overview first, zoom and filter, then details-on-demand (まずは全体像を俯瞰し、一部分に着目、不要な要素は取り除き、 必要に応じて詳細情報を見る) Overview Zoom&Filter Details
  4. 可視化表現 全体が俯瞰できる可視化表現 今回のデータ • 時系列 • 数値的な変化 • 多くの項目 →

    ヒートマップ を採用 16 Overview first, zoom and filter, then details-on-demand
  5. (余談) 時系列データ可視化手法 の比較 17 数値の表現 正確な読み取り 要素が多い時 折れ線グラフ 高さ ⭕

    できる ❌ 重なりがある ヒートマップ 色 🔺 難しい ⭕ 重なりなし 視覚協創学(5): マッピング技術 ~特に時系列データ可視化技術の体系化に向けて~ [伊藤, 2012] その他、3次元の可視化表現や連携型可視化表現も存在 可視化の研究では、複数のグラフを組み合わせて表現する ex. ヒートマップの一部を選択したら対応する箇所が折れ線グラフで表示
  6. ヒートマップ の作り方 18 filename 202401 201402 201403 202404 202405 A

    0 0 0 10 30 B 10 15 0 0 0 C 0 20 11 0 0 時間変化 A B C 数値は commit数
  7. Zoom & Filter の詳細 21 本来: 可視化結果を元に対象を絞る Overview 絞る 今回は

    データを絞る さらに絞る Overview Zoom&Filter Details 絞られたデータ を可視化
  8. 使用データを絞る 25 約27万行 (277,326) 直近10年間分に絞る (2014年5月~2024年5月) 約14万行 (143,243) 約5万行 (54,791)

    現在のrepositoryに残るファイルのみ抽出 約1万行 (10,688) 文字列testをパスに含まないファイルのみ抽出
  9. データの加工 パスの2階層以下を集約 filename 201401 201402 … aaa/bbb/xxxx.kt 22 1 …

    aaa/bbb/yyyy.kt 21 0 … aaa/ccc/zzzz.kt 0 10 … filename 201401 201402 … aaa/bbb 43 1 … aaa/ccc 0 10 …
  10. 使用データを絞る 27 約27万行 (277,326) 直近10年間分に絞る (2014年5月~2024年5月) 約14万行 (143,243) 約5万行 (54,791)

    現在のrepositoryに残るファイルのみ抽出 パスの2階層以下を集約 約1万行 (10,688) 139行 文字列testをパスに含まないファイルのみ抽出
  11. 使用データを絞る 28 約27万行 (277,326) 直近10年間分に絞る (2014年5月~2024年5月) 約14万行 (143,243) 約5万行 (54,791)

    現在のrepositoryに残るファイルのみ抽出 約1万行 (10,688) 139行 文字列testをパスに含まないファイルのみ抽出 もう少し絞りたい ... パスの2階層以下を集約
  12. Kotlin の コンパイラ の概要 3段階の進化 1. リリース重視! 超初期 Compiler 2.

    多様なプラットフォームに対応! 過渡期 Compiler 3. NEW! K2 Compiler 35 詳しい解説: ・What Everyone Must Know About The NEW Kotlin K2 Compiler ・K2への道。コンパイラを作り直すってどういうこと? 2つのキーワード IR, FIR
  13. 40 Intermediate Representation … Kotlin ソースコードと   ターゲットコードの中間表現 Kotlin ソースコード

    JVM Frontend JVM Backend JavaScript JS Backend Native Native Backend IR ② 過渡期 Compiler
  14. 41 Kotlin ソースコード JVM Frontend JVM Backend JavaScript JS Backend

    Native Native Backend IR ② 過渡期 Compiler Intermediate Representation … Kotlin ソースコードと   ターゲットコードの中間表現
  15. 42 Kotlin ソースコード JVM Frontend JVM Backend JavaScript JS Backend

    Native Native Backend IR FIR Frontend Intermediate Representation … 高速化のための新しい   Frontend表現 ③ K2 Compiler
  16. IRの開発時期 47 Kotlin 1.2 Multiplatform projects are a new experimental

    feature in Kotlin 1.2, allowing you to reuse code between target platforms supported by Kotlin – JVM, JavaScript, and (in the future) Native. Overview Zoom&Filter Details compiler/ir 2016/10 初commit 2024/5 2016/2 Kolin 1.1 2017/5 AndroidのKotlin公式サポート発表 2017/11 Kolin 1.2, KolinConf2017 https://kotlinlang.org/docs/whatsnew12.html
  17. IRの開発時期から読み取れる考察 Kotlin Anywhere You Need It - KotlinConf 2017 48

    KotlinConf 2017 Keynote Kotlinの初期リリースから、 理想の世界に向けて動き出した一歩目なのか....?
  18. FIRの開発 53 Overview Zoom&Filter Details compiler/fir 2020/8 Kotlin 1.4 2024/5

    2018/10 Kotlin 1.3 2018/11 初 commit 2018/12 KotlinConf 2019
  19. FIRの開発 56 Overview Zoom&Filter Details compiler/fir 2018/10 Kotlin 1.3 2020/8

    Kotlin 1.4 2024/5 2018/11 初 commit 2018/12 KotlinConf 2019 KotlinConf 2019 新しいコンパイラについて言及 ・Frontend speed … Not in 1.4 ・ReWork Type inference … Coming 1.4
  20. まとめ: 可視化からわかる K2 Compilerの変遷 58 日付 公式発表 イベント 2016/ 2

    Kotlin 1.1 2016/10 compiler/ir 配下にcommit開始 2017/ 5 Android: Kotlin公式サポート発表 2017/11 Kotlin 1.2 JSとJVMのコード共通化が可能に 2018/10 Kotlin Conf 2018 Kotlin 1.3 2018/11 compiler/fir 配下にcommit開始 2019/12 Kotlin conf 2019 「Kotlin 1.4から早いコンパイラが導入」 2020/ 8 Kotlin 1.4 新しい型推論
  21. これまでのデータ 1. 現在のrepositoryに残っているファイルに絞る 2. 文字列 test をパスに含むファイルを削除 3. パスの2階層以下は集約 データの加工フェーズに戻る

    64 1. 現在 残っていないファイルに絞る 2. 文字列 test をパスに含むファイルを削除 3. パスの2階層以下は集約
  22. 推測: Swift への変換をサポート 68 Direct Kotlin-to-Swift export の発表 It’s already

    in progress. KotlinConf2024 Keynote → Swift IRを さしていたのでは..?
  23. 69 Kotlin ソースコード JVM Frontend JVM Backend JavaScript JS Backend

    Native Native Backend IR FIR Swift SIR Kotlin → Swift
  24. まとめ: 可視化からわかる Kotlin to Swift Export 70 日付 公式発表 イベント

    2023/11/1 Kotlin 1.9.20 2023/11/29 Swift IRに関するcommit開始 2024/5/21 Kotlin 2.0 2024/5/22 KotlinConf 2024 Direct Kotlin-to-Swift export の発表
  25. 言語 Kotlin 可視化 の 流れ 72 可視化結果 と 考察 データの取得

    データの加工・可視化表現 全体の流れ Overview Zoom&Filter Details
  26. 可視化: KotlinConf 2024で話題のテーマに注目 73 K2 Compiler FIR, IR 1 Direct

    Kotlin to Swift Export 2 6年も前からFIRの開発が始まっていた AndroidのKotlin公式サポート発表の 半年も前からIRの導入は進められていた Swift IRの開発が始まってまだ半年