Revision 10359
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1128 | 1128 |
|
1129 | 1129 |
|
1130 | 1130 |
-- |
1131 |
-- Name: FUNCTION map_nulls(nulls text[], value anyelement); Type: COMMENT; Schema: util; Owner: - |
|
1132 |
-- |
|
1133 |
|
|
1134 |
COMMENT ON FUNCTION map_nulls(nulls text[], value anyelement) IS 'due to dynamic inlining[1], this is just as fast as util._map() which it wraps[2]. |
|
1135 |
|
|
1136 |
[1] inlining of function calls, which is different from constant folding |
|
1137 |
[2] _map()''s profiling query |
|
1138 |
SELECT util._map(''"1"=>NULL, "2"=>NULL, "3"=>NULL, *=>*'', v) FROM unnest(array_fill(1, array[100000])) f (v) |
|
1139 |
and map_nulls()''s profiling query |
|
1140 |
SELECT util.map_nulls(array[1, 2, 3]::text[], v) FROM unnest(array_fill(1, array[100000])) f (v) |
|
1141 |
both take ~920 ms'; |
|
1142 |
|
|
1143 |
|
|
1144 |
-- |
|
1131 | 1145 |
-- Name: map_values(regclass); Type: FUNCTION; Schema: util; Owner: - |
1132 | 1146 |
-- |
1133 | 1147 |
|
Also available in: Unified diff
schemas/util.sql: map_nulls(): documented that due to dynamic inlining, this is just as fast as util._map() which it wraps. dynamic inlining now brings altogether a 40x speed improvement to map_nulls() (4000 ms -> 100 ms), and would likely bring a comparable improvement for other functions that are run repeatedly and call other user-defined functions.