HiPE and BIF

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HiPE and BIF

Valentin Micic-6
Hi all,

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”. Does this assertion hold when HiPE compiled module calls BIF as well?

Kind regards

V/


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HiPE and BIF

Mikael Pettersson-5
On Fri, Jul 19, 2019 at 11:00 AM Valentin Micic <[hidden email]> 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.

/Mikael
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions