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

Topaz is Ruby in Python

Topaz is Ruby in Python

Slides from a talk about Topaz I delivered on 12.06.2013 at Munich Ruby Users Group meetup.

Ae7a42fb716793697b1d222f3cc753b8?s=128

Jan Stępień

June 12, 2013
Tweet

Transcript

  1. Topaz is in Ruby Python

  2. Hi, my name is Jan Stępień

  3. Topaz is a Ruby implementation written in Python

  4. Topaz is a Ruby implementation which is faster

  5. Ruby Topaz is a bird from South America

  6. cc-by-sa-3.0 geimfyglið

  7. Topaz is in Ruby Python

  8. cc-by-sa-3.0 geimfyglið

  9. cc-by-nc-sa-2.0 marie

  10. Why? would you implement Ruby in Python?

  11. Python CPython PyPy

  12. Ruby MRI JRuby Rubinius

  13. PyPy is a Python implementation

  14. PyPy is amazingly fast See http://speed.pypy.org

  15. PyPy is written in RPython

  16. RPython is a subset of Python

  17. RPython can be statically compiled to C

  18. RPython is optimised for implementing VMs

  19. PyPy is an impl. of Python PyPy is written in

    RPython RPython is compiled to C
  20. Topaz is an impl. of Ruby Topaz is written in

    RPython RPython is compiled to C
  21. git clone http://github.com/topazproject/topaz

  22. $ cd topaz && cloc . Language files code Python

    132 22934 Ruby 35 5058
  23. $ time ./bin/topaz_untranslated.py 3.times { puts :hello } ˆD hello

    hello hello real 0m3.539s
  24. $ cd topaz $ python \ .../pypy/rpython/bin/rpython \ -Ojit targettopaz.py

    RPython → C
  25. None
  26. $ time ./bin/topaz 3.times { puts :hello } ˆD hello

    hello hello real 0m0.050s
  27. freqs = [0] * 256 while buf = $stdin.read(8192) buf.bytes.each

    do |b| freqs[b] += 1 end end p freqs
  28. MRI 2.0 36,1 s 5,0 MB/s JRuby 1.7.2 24,8 s

    7,3 MB/s Topaz 3,3 s 55,3 MB/s 180MB of data served from caches
  29. 50 100 150 Input size [MB] 10 30 20 0

    Time [s] M RI JRuby Topaz
  30. Topaz redefines what fast means in the Ruby world

  31. Why is it so fast? PyPy!

  32. Meta-tracing just-in-time compilation

  33. None
  34. Get the source and try for yourself

  35. Is Topaz a Ruby-Python interoperability bridge? No, unfortunately it’s not.

  36. Topaz is still very young

  37. Contributing is easy

  38. See also 096 RR Topaz with Alex Gaynor Introducing Topaz

    – Tim Felgentreff topazruby.com
  39. dankeschön dziękuję ślicznie