mrkaspa

mrkaspa

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?

Showing Posts 1 to 10

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?

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 Allow mix to pass compiler options to erlang · Issue #2665 · elixir-lang/elixir · GitHub

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!

Exadra37

Exadra37

Not accurate here…

The correct is:

Both Elixir and Erlang are compiled to same byte code.

OvermindDL1

OvermindDL1

No, actually Elixir does output to Erlang code. Erlang Core it might do later, but for now it is still outputting to Erlang itself for a variety of extra ‘free’ compiler checks it gets.

Exadra37

Exadra37

Thanks for the clarification @OvermindDL1 and sorry @ellispritchard for my wrong correction.

This was caused by reading somewhere, more than once, that Elixir was compiled to the same byte code of Erlang, not translated to Erlang code.

Trying to find that sources led me to this article https://medium.com/@fxn/how-does-elixir-compile-execute-code-c1b36c9ec8cf and for what I can understand Elixir is not translated to true Erlang code as some Erlang developer would write, but instead is translated to an Erlang Abstract Format to take advantage of the mentioned BEAM optimisations.

I was not able to find the sources of my misunderstood but at least I know more about what is the compiler process now :slight_smile:

OvermindDL1

OvermindDL1

From my understanding it does output to Erlang itself, not Erlang Core, I know that translating to a lower level was eventually planned (and the new debug segments added to the BEAM facilitate making that easier), but I don’t think it’s been done yet? Would love to find out though. :slight_smile:

Exadra37

Exadra37

Well from the blog post I linked it does look like so…

Maybe I am still misunderstanding something?

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews