hI
I can confirm 60% speedup for execution of function fx and fx3 - both functions are very primitive, so for real code the benefit can be higher
Unfortunately, there is about 5% slowdown for inlined code, and for just plpgsql code too.
I tested fx4
create or replace function fx4(int) returns int immutable as $$ begin return $1 + $1; end $$ language plpgsql;
and fx2
create or replace function fx2(int) returns int as $$ select 2 * $1; $$
language sql immutable;
and execution of patched code is about 5% slower. It is strange so this patch has a negative impact on plpgsql execution.
Regards
Pavel