mrkaspa

mrkaspa

Is there a guide about how to use HIPE in elixir?

I have some questions about this:

  • Is everything compiled and ran by mix already using hipe, after running iex I see that hipe shows on the message

iex
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)

  • How can I compile only an specific module in erlang I can add the attribute module -compile()

  • Is there a guide about when we should use HIPE and how to use it on elixir?

Most Liked

michalmuskala

michalmuskala

The primary reason to use Erlang Abstract Format instead of Core Erlang is tooling. Using that we get, basically for free dialyzer, cover, debugger and erl_eval. Compiling to Core is also a bit awkward since it’s a moving target - it’s treated as an internal detail of the Erlang compiler and changing rather frequently between releases.

sneako

sneako

There is an ElixirSips video showing how to use HiPE https://www.dailydrip.com/topics/elixirsips/drips/native-compilation-with-hipe

ellispritchard

ellispritchard

For the record, you can set the env-var ERLC_COMPILER_OPTIONS with options to be passed to erlc when compiling Erlang and Elixir code (because Elixir code gets translated to Erlang).

See https://github.com/elixir-lang/elixir/issues/2665

e…g. to compile only your deps native:

ERL_COMPILER_OPTIONS="native" mix deps.compile

You know it’s working if compiling takes much longer!

michalmuskala

michalmuskala

You use hipe exactly the same way you do it in erlang - with a module attribute. The syntax in elixir is @compile .... The hipe bit in the VM manifest is merely stating that this VM has support for hipe-compiled programs.

Hipe doesn’t work too good if you have a code that switches often between hipe and non-hipe code - the switches are expensive.

NobbZ

NobbZ

I never used HiPE per module attribute in erlang, but using {erl_opts, [{native, o3}]} in my rebar.config.

So could you please provide a full example of how to activate HiPE for a single module, and for the complete project as well?

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement