ST> That said, the documentation here says FLOAT4 is an alias for REAL, ST> so it's somewhat nonintuitive for FLOAT4 to be so much slower than ST> FLOAT8, which is an alias for DOUBLE PRECISION.
There are some versions of glibc where doing certain math on double is faster than doing it on float, depending on how things are compiled.
Maybe this is one of them?
no
It is plpgsql issue only. PL/pgSQL uses a generic cast via serialization to string and new parsing
It doesn't use a effective libc casting functions.