pelemay v0.0.4 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
- Find Enum.map with a specific macro
- Analyze internal anonymous functions
Register(ETS) following information as Map.
- Module
- Original function name
- Function name for NIF
- Value of Anonymous Function
- Insert NIF in AST
- Do Step 1 ~ 4 to each macro
- Receiving Map from ETS, and...
- Generate NIF Code
- Generate Elixir's functions
- Compile NIF as Custom Mix Task, using Clang