Performance question: functional vs imperative in Ruby @muc_rubyshift

Performance question: functional vs imperative in Ruby @muc_rubyshift

There are some slides with Sasha Grey. And Cormen. And kitties. And puppies. And a lot of benchmarking.

F14a1fcb0bd63f3d1a999844fd32a263?s=128

Anna Bulenkova

November 13, 2013
Tweet

Transcript

  1. Hi guys Today we’re gonna be benchmarking!

  2. Anna Bulenkova @povergo  ! Software Developer  @ JetBrains

  3. Different solutions

  4. Trends & innovations

  5. Who cares?

  6. Data size doesn’t matter anymore?

  7. Some might be worried

  8. Benchmarking

  9. λ

  10. λ

  11. λ

  12. λ

  13. λ

  14. Contains traces of for loops, one-symbol counters, code duplicates, explicit

    returns, coding style violations and cloning. And some other ugly things just to fit it into the screen. Sorry.
  15. Input

  16. Input • generate_hash • generate_boolean_array • generate_array_of_nils

  17. Direct modifications

  18. Options • use standard functions • create new objects

  19. Arrays

  20. Arrays

  21. Stop here! N of benchmarking steps != N of iterations

    through data
  22. O(f(n)) • 1 • log n • n log n

    • n**2 • n**3 etc…
  23. O(f(n)) • 1 • log n • n log n

    • n**2 • n**3 etc…
  24. Arrays

  25. Arrays

  26. Bang methods

  27. Bang methods

  28. Bang methods

  29. Hashes

  30. Hashes

  31. Hashes

  32. Hashes

  33. Primitive Recursion

  34. Primitive Recursion

  35. Use boolean expression result

  36. Lambdas

  37. Lambdas

  38. Lazy eval

  39. Segfault

  40. Lazy eval

  41. Lazy eval

  42. That the..?

  43. It’s Enumerator

  44. Some time after

  45. Some time after

  46. I just couldn’t measure

  47. Darvin contest

  48. Darvin contest

  49. Conclusions • use standard functions • don’t use standard functions

  50. None
  51. ? @povergo anna@bulenkova.com

  52. Thank you!