[erlang-bugs] inline & inline_effort

Tony Rogvall <>
Sun Sep 8 22:55:00 CEST 2013


I dont know who is working on the cerl_inline functionality but it is really intriguing !
I have found some problems doing experiments with (undocumented) compile attributes
inline_effort and inline_unroll. No No No do not remove them!!!! They just needs to be 
tested and reworked a bit :-) 

I am working on a module inline parse transform that I need for speed things up a bit,
specially on modules that I think will not change so much over time (think lists module)
Also, hipe compile on top of this tends to do marvelous things with performance :-)

Any way here is a module that when compiled, first of all warns about some strange things
and then generates some "interesting" code.

I guess the ones working on this will see what is the problem. And please do NOT remove
functionality just because I found it, improve it. I need it :-)





-compile({inline_size,   500}).    %% default=24
-compile({inline_effort, 500}).   %% default=150
%% -compile({inline_unroll, 1}).   %% default=1

run(V) when is_float(V) ->
    B = vec3f_new(4,5,6),
    C = vec3f_new(7,8,9),

-define(is_vecA, is_float(A1), is_float(A2), is_float(A3)).
-define(is_vecB, is_float(B1), is_float(B2), is_float(B3)).

vec3f_new(X,Y,Z) when is_number(X), is_number(Y), is_number(Z) ->

vec3f_add({A1,A2,A3},{B1,B2,B3}) when ?is_vecA, ?is_vecB ->

vec3f_multiply({A1,A2,A3},{B1,B2,B3}) when ?is_vecA, ?is_vecB ->
vec3f_multiply(A, {B1,B2,B3}) when is_float(A), ?is_vecB ->
vec3f_multiply({A1,A2,A3}, B) when is_float(B), ?is_vecA ->

More information about the erlang-bugs mailing list