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

RustでつくるRubyのFiber

Avatar for monochrome monochrome
October 22, 2020

 RustでつくるRubyのFiber

Avatar for monochrome

monochrome

October 22, 2020
Tweet

More Decks by monochrome

Other Decks in Programming

Transcript

  1. 既存のRuby実装(開発継続中のもの) 名称 記述言語 実行基盤 CRuby(MRI) C 独自VM mruby C 独自VM

    JRuby Java JVM TruffleRuby Java GraalVM (JVM) Opal Ruby JSへコンパイル Rubinius C++, Ruby 独自VM Topaz RPython PyPy Artichoke Rust mruby ruruby Rust 独自VM
  2. Optcarrot • Rubyで書かれたNESエミュレータ • 「Ruby3をRuby2の3倍速くする」目標のための準公式ベンチマーク • 実際にゲームができるモードと、ベンチマーク専用のモードがある • ベンチマークモードでは外部ライブラリを使用しない •

    「普通のRuby」で書かれた標準モードと、コードを自己書き換えして高速化する最 適化モードがある • ≒6500 LOC repo: https://github.com/mame/optcarrot • 紹介スライド: https://www.slideshare.net/mametter/optcarrot-a-pureruby-nes-emulator
  3. Fiber (coroutine in Ruby) f = Fiber.new { .. }

    f.resume 処理A 処理B Fiber.yield f.resume 処理C Child Fiber 処理 処理 処理