pelemay v0.0.13 Pelemay

Pelemay: The Penta (Five) “Elemental Way”: Freedom, Insight, Beauty, Efficiency and Robustness

For example, the following code of the function map_square will be compiled to native code using SIMD instructions by Pelemay.

defmodule M do
  require Pelemay
  import Pelemay

  defpelemay do
    def map_square (list) do
      list
      |> Enum.map(& &1 * &1)
    end
  end

  def string_replace(list) do
    list
    |> Enum.map(& String.replace(&1, "Fizz", "Buzz"))
  end
  1. Find Enum.map with a specific macro
  2. Analyze internal anonymous functions
  3. Register(ETS) following information as Map.

    • Module
    • Original function name
    • Function name for NIF
    • Value of Anonymous Function
  4. Insert NIF in AST
  5. Do Step 1 ~ 4 to each macro
  6. Receiving Map from ETS, and...
  7. Generate NIF Code
  8. Generate Elixir's functions
  9. Compile NIF as Custom Mix Task, using Clang

Link to this section Summary

Link to this section Functions

Link to this function

compile_time_info()

Link to this macro

defpelemay(functions)

(macro)
Link to this function

eval_compile_time_info()