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

Rubyの会社でRustを書くということ

KOBA789
February 10, 2018

 Rubyの会社でRustを書くということ

Cookpad TechConf 2018 ( https://techconf.cookpad.com/2018/ ) で発表した資料です。

KOBA789

February 10, 2018
Tweet

More Decks by KOBA789

Other Decks in Technology

Transcript

  1. 12 App S3 ج൫ SNS 1. ड৴ઃఆΛΫΤϦ 2. ARNΛΫΤϦ 3.

    S3ʹॻ͖ࠐΈ 4. S3͔ΒಡΈग़͢ 5. SNS΁ૹ৴ ᶃ ᶄ ᶅ ᶇ ᶆ MySQL
  2. 35 ... WHERE user_id = 1; ... WHERE user_id =

    2; ... WHERE user_id = 3; ... WHERE user_id IN (1, 2, 3);
  3. ΫΤϦΛ·ͱΊΔ 36 WHERE user_id = ? →6ms (only 1 id)

    WHERE user_id IN (?, ?, ... ?) →11ms (1000 ids) ϕϯνϚʔΫͷ݁Ռɺ਺ઍ͘Β͍͕Α͍ ࠷దͳόοναΠζ
  4. KOBA789/batch-recv-rs 42 fn try_iter(&self) -> TryIter<T> Ωϡʔͷத਎ΛΠςϨʔλͱͯ͠ಘΔϝιου impl<'a, T> Iterator

    for TryIter<'a, T> ΋ͪΖΜIteratorτϨΠτΛ࣮૷͍ͯ͠Δ crossbeam_channel::Receiver
  5. 64 ೖ 2 ग़ ೖ 1 ೖ 3 ग़ ग़

    όοναΠζ෼ͷ
 εϨου͕ඞཁ ͜ΕͰ͸ࠔΔ
  6. Tokio + futures-rs 66 ɾΠϕϯτϧʔϓͷ࣮૷ ɾ1ݸҎ্ͷFutureΛ࣮ߦ ɾϊϯϒϩοΩϯά I/O API ɾFutureτϨΠτ

    ɾJSͷPromiseͱ
 ಉ༷ͷ֓೦ ɾFutureͷίϯϏωʔλ ɾɹɹɹɹ΋͜Εͷػೳ Tokio futures-rs ೖ ग़