Slide 1

Slide 1 text

RubyKaigi 2024 にみんなで参加した Techouse の その後の進捗 with Ruby RubyKaigi 2024 follow up スポンサーLT 2024.8.31 Techouse 山崎良祐 ( @nappa )

Slide 2

Slide 2 text

P2 ©︎Techouse All Rights Reserved Techouse @nappa と申します

Slide 3

Slide 3 text

P3 ©︎Techouse All Rights Reserved 今春入社の フレッシャーな仲間と RubyKaigi 2024 参加 しました

Slide 4

Slide 4 text

P4 ©︎Techouse All Rights Reserved

Slide 5

Slide 5 text

P5 ©︎Techouse All Rights Reserved

Slide 6

Slide 6 text

P6 ©︎Techouse All Rights Reserved Ruby 1.6 のころ 生まれた世代

Slide 7

Slide 7 text

P7 ©︎Techouse All Rights Reserved

Slide 8

Slide 8 text

P8 ©︎Techouse All Rights Reserved 高校1年で Bignum/Fixnum 廃止 (=Ruby 2.4+)

Slide 9

Slide 9 text

P9 ©︎Techouse All Rights Reserved with…

Slide 10

Slide 10 text

P10 ©︎Techouse All Rights Reserved わたくし

Slide 11

Slide 11 text

P11 ©︎Techouse All Rights Reserved 高校1年のころ Ruby 1.6 で 遊んでた世代 マヨネーズ色の本

Slide 12

Slide 12 text

P12 ©︎Techouse All Rights Reserved 世代を超えて 愛される Ruby

Slide 13

Slide 13 text

P13 ©︎Techouse All Rights Reserved 世代を超えて 技術継承したい

Slide 14

Slide 14 text

P14 ©︎Techouse All Rights Reserved

Slide 15

Slide 15 text

P15 ©︎Techouse All Rights Reserved RubyKaigi 2024 参加前には Ruby Internal を みんなで学習

Slide 16

Slide 16 text

struct RObject { /** Basic part, including flags and class. */ struct RBasic basic; /** Object's specific fields. */ union { struct { VALUE *ivptr; struct rb_id_table *iv_index_tbl; } heap; /* Embedded instance variables. When an object is small enough, it * uses this area to store the instance variables. */ VALUE ary[1]; } as; }; Ruby Object (RObject型) https://github.com/ruby/ruby/blob/master/include/ruby/internal/core/robject. h Cソース (robject.h) RBasic VALUE *ivptr struct rb_id_table *iv_index_tbl; RObject 社内イベント資料より抜粋

Slide 17

Slide 17 text

struct RObject { /** Basic part, including flags and class. */ struct RBasic basic; /** Object's specific fields. */ union { struct { VALUE *ivptr; struct rb_id_table *iv_index_tbl; } heap; /* Embedded instance variables. When an object is small enough, it * uses this area to store the instance variables. */ VALUE ary[1]; } as; }; Ruby Object (RObject型) https://github.com/ruby/ruby/blob/master/include/ruby/internal/core/robject. h Cソース (robject.h) Struct RBasic VALUE *ivptr struct rb_id_table *iv_index_tbl; RObject 社内イベント資料より抜粋

Slide 18

Slide 18 text

struct RBasic { /** * Per-object flags. Each Ruby object has its own characteristics apart * from its class. For instance, whether an object is frozen or not is not * controlled by its class. This is where such properties are stored. * * @see enum ::ruby_fl_type * * @note This is ::VALUE rather than an enum for alignment purposes. Back * in the 1990s there were no such thing like `_Alignas` in C. */ VALUE flags; /** * Class of an object. Every object has its class. Also, everything is an * object in Ruby. This means classes are also objects. Classes have * their own classes, classes of classes have their classes too, and it * recursively continues forever. * * Also note the `const` qualifier. In Ruby, an object cannot "change" its * class. */ const VALUE klass; }; Ruby Object 共通データ (RBasic 型) https://github.com/ruby/ruby/blob/master/include/ruby/internal/core/robject. Cソース (rbasic.h) VALUE *ivptr struct rb_id_table *iv_index_tbl; RObject struct RBasic VALUE flags VALUE klass 社内イベント資料より抜粋

Slide 19

Slide 19 text

struct RBasic { /** * Per-object flags. Each Ruby object has its own characteristics apart * from its class. For instance, whether an object is frozen or not is not * controlled by its class. This is where such properties are stored. * * @see enum ::ruby_fl_type * * @note This is ::VALUE rather than an enum for alignment purposes. Back * in the 1990s there were no such thing like `_Alignas` in C. */ VALUE flags; /** * Class of an object. Every object has its class. Also, everything is an * object in Ruby. This means classes are also objects. Classes have * their own classes, classes of classes have their classes too, and it * recursively continues forever. * * Also note the `const` qualifier. In Ruby, an object cannot "change" its * class. */ const VALUE klass; }; Ruby Object 共通データ (RBasic 型) https://github.com/ruby/ruby/blob/master/include/ruby/internal/core/robject. Cソース (rbasic.h) VALUE *ivptr struct rb_id_table *iv_index_tbl; RObject struct RBasic VALUE flags VALUE klass 社内イベント資料より抜粋

Slide 20

Slide 20 text

Ruby Object 共通データ (RBasic 型) VALUE *ivptr struct rb_id_table *iv_index_tbl; RObject struct RBasic VALUE flags VALUE klass インスタンス変数を収納する配列へのポインタ メソッドを探索するハッシュテーブルへのポインタ クラス フラグ (freeze or not, GC のマーク (後述)) 社内イベント資料より抜粋

Slide 21

Slide 21 text

P21 ©︎Techouse All Rights Reserved フレッシャーズブログ

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

P23 ©︎Techouse All Rights Reserved RubyKaigi ではみなさま 本当にありがとうございました

Slide 24

Slide 24 text

P24 ©︎Techouse All Rights Reserved その後の進捗

Slide 25

Slide 25 text

P25 ©︎Techouse All Rights Reserved https://www.cecs.uci.edu/~papers/mpr/MPR/ARTICLES/101402.PDF CPUの中の パイプラインとか 分岐予測とか キャッシュライン とか……

Slide 26

Slide 26 text

P26 ©︎Techouse All Rights Reserved http://ithare.com/infographics-operation-costs-in-cpu-clock-cycles/ CPU内で 何が何サイクル かかるとかいう話

Slide 27

Slide 27 text

P27 ©︎Techouse All Rights Reserved Ruby で!

Slide 28

Slide 28 text

P28 ©︎Techouse All Rights Reserved 4.8 sec 5.1 sec 0から1億までの数を ソート済にした配列のなかの 奇数をかぞえる 0から1億までの数を シャッフルした配列のなかの 奇数をかぞえる 分岐予測に当たるとき・当たらないときに計算コストの差

Slide 29

Slide 29 text

P29 ©︎Techouse All Rights Reserved 2次元配列を 行→列方向に アクセス 2次元配列を 列→行方向に アクセス 6.4 sec 12.9 sec キャッシュメモリに当たるとき・当たらないときの計算コストの差

Slide 30

Slide 30 text

P30 ©︎Techouse All Rights Reserved 3.4 sec 6.0 sec 2**63 に 10000000回 ゼロを足す 0に 10000000回 ゼロを足す 固定長整数と可変長整数の計算コストの差

Slide 31

Slide 31 text

P31 ©︎Techouse All Rights Reserved 通じあえる仲間

Slide 32

Slide 32 text

P32 ©︎Techouse All Rights Reserved さて

Slide 33

Slide 33 text

P33 ©︎Techouse All Rights Reserved 「技術は手段にすぎない」

Slide 34

Slide 34 text

P34 ©︎Techouse All Rights Reserved と、よく 言われますが

Slide 35

Slide 35 text

P35 ©︎Techouse All Rights Reserved 私は違うと思います

Slide 36

Slide 36 text

P36 ©︎Techouse All Rights Reserved それ自体を 楽しむ 目的がある

Slide 37

Slide 37 text

P37 ©︎Techouse All Rights Reserved わかればわかるほど 楽しい世界

Slide 38

Slide 38 text

P38 ©︎Techouse All Rights Reserved その楽しさを 知ってるエンジニアと いっしょに働きたい

Slide 39

Slide 39 text

P39 ©︎Techouse All Rights Reserved その楽しさを 世代を超えて 伝えていきたい

Slide 40

Slide 40 text

P40 ©︎Techouse All Rights Reserved 世代を超える 「その後」 のために

Slide 41

Slide 41 text

P41 ©︎Techouse All Rights Reserved Techouse の 今後の進捗に ご期待ください 〜つづく〜