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

Elixir a Language for the Future

Elixir a Language for the Future

98195776df79590269541395c699f816?s=128

João Moura

June 23, 2017
Tweet

Transcript

  1. elixir elixir elixir A language for the future

  2. 1,000,000,000

  3. None
  4. None
  5. None
  6. None
  7. None
  8. None
  9. None
  10. largest city in the Americas the most populous city of

    the southern hemisphere
  11. None
  12. None
  13. None
  14. Programming Languages

  15. None
  16. Elixir

  17. ?

  18. João Moura @joaomdmoura

  19. 初⼼

  20. beginner's mind

  21. None
  22. None
  23. beginner's mind

  24. EXPERTS

  25. EXPERTS

  26. None
  27. The rules for software are CHANGING

  28. None
  29. None
  30. None
  31. None
  32. The future is DYNAMIC 1.

  33. 1,000,000,000 ~

  34. 2 177 mm2

  35. The future is Concurrent 2.

  36. Threads, Processes and cores

  37. multi-thread

  38. None
  39. Process

  40. SHARED Memory

  41. SHARED Memory

  42. None
  43. Cores

  44. None
  45. None
  46. RaceConditions

  47. None
  48. None
  49. None
  50. Highly Concurrent

  51. Easily distributable

  52. Really fast (real time)

  53. Almost no downtime

  54. Self-healing and fault tolerant

  55. Erlang

  56. Erlang VM

  57. Actor Model

  58. FREAKING 30 YEARS

  59. downtime A YEAR 31ms

  60. ruby +

  61. ruby + Erlang +

  62. ruby + Erlang +Steroids

  63. elixir elixir elixir

  64. Functional “doing the same thing over and over again and

    expecting different results” Albert Einstein
  65. - Clear code - Transparency - Parallelization - Modularity -

    Easier debugging
  66. EXAMPLE I

  67. a = 0
 def increment a += 1 end RUBY

  68. def increment(a) return a + 1 end RUBY

  69. EXAMPLE II

  70. indexes = [1, 2, 3] indexes << 4
 indexes #

    [1,2,3,4] RUBY
  71. indexes = [1, 2, 3] new_indexes = indexes ++ [4]

    Elixir
  72. EXAMPLE III

  73. result = func1(a, b) + func2(a, c)

  74. func1(a, b) func2(a, c)

  75. func1(a, b) func2(a, c) } parallelization

  76. ELIXIR

  77. PIPE OPERATOR

  78. Ruby

  79. Ruby

  80. Ruby

  81. Ruby

  82. Elixir

  83. Match Operator

  84. Ruby

  85. Ruby

  86. Elixir

  87. Elixir

  88. Pattern Matching

  89. Elixir

  90. Elixir

  91. Elixir

  92. Elixir

  93. Modules

  94. Ruby

  95. Ruby

  96. Ruby

  97. Elixir

  98. Putting together

  99. Elixir

  100. Elixir

  101. Elixir

  102. Elixir

  103. Elixir

  104. Elixir

  105. Elixir

  106. Elixir

  107. Elixir

  108. Elixir "

  109. Elixir

  110. Elixir

  111. Elixir

  112. None
  113. # OF PROCESSES

  114. # OF PROCESSES # CALL FOR SPAWN AND BLOCKER

  115. # OF PROCESSES # CALL FOR SPAWN AND BLOCKER #

    SPAWN NEW PROCESSES
  116. # OF PROCESSES # CALL FOR SPAWN AND BLOCKER #

    SPAWN NEW PROCESSES # FUNCTION THE PROCESS EXECUTE
  117. # OF PROCESSES # CALL FOR SPAWN AND BLOCKER #

    SPAWN NEW PROCESSES # FUNCTION THE PROCESS EXECUTE # BLOCKER THAT GETS THE MESSAGE
  118. None
  119. 1.500.000

  120. None
  121. WEB!

  122. Rake + bundler

  123. mix

  124. mix test

  125. mix phoenix.new

  126. mix deps.get

  127. gemfile.rb

  128. mix.ex

  129. None
  130. Rails: req/s: 1,140.53 Stdev: 18.96ms Max latency: 159.43ms

  131. Rails: req/s: 1,140.53 Stdev: 18.96ms Max latency: 159.43ms Pheonix: req/s:

    12,120.00 Stdev: 3.35ms Max latency:43.30ms
  132. Rails: req/s: 1 140 530 Stdev: 18.96ms Max latency: 159.43ms

    Pheonix: req/s: 12 120 000 Stdev: 3.35ms Max latency:43.30ms
  133. 10.63x more throughput

  134. This is good shit. “ “ Co-creator of Erlang Joe

    Armstrong
  135. The future is DYNAMIC

  136. The future is Concurrent

  137. Erlang VM

  138. elixir elixir elixir

  139. None
  140. None
  141. None
  142. None
  143. None
  144. None
  145. None
  146. joaomdmoura.com #ElixirWithaRubyist @joaomdmoura