[erlang-questions] HiPE and BIF

Mikael Pettersson mikpelinux@REDACTED
Fri Jul 19 11:29:38 CEST 2019

On Fri, Jul 19, 2019 at 11:00 AM Valentin Micic <v@REDACTED> wrote:
> It is my understanding (as per Erlang Manual) that if a module that has been compiled using HiPE calls a function in a module that is not (compiled using HiPE), then there may be a performance penalty that is due to "mode switching”.

Correct.  A similar penalty occurs if BEAM code calls native code, so
you'll want to minimize the number of transitions between native and
BEAM (either direction).

> Does this assertion hold when HiPE compiled module calls BIF as well?

No.  Calling a BIF is more direct and does not involve any "mode
switch", so it's fairly efficient.


More information about the erlang-questions mailing list