Project

General

Profile

« Previous | Next » 

Revision 10353

schemas/util.sql: map_nulls(): turned off STRICT to allow dynamic inlining, which causes a 2x speed improvement1. (see r10352 for an explanation of dynamic inlining.) note that turning off STRICT disables NULL-skipping (avoiding running a function when all its params are NULL), so it should only be used when the NULL-skipping optimization is needed less than dynamic inlining.

[1] the profiling query
SELECT util.map_nulls(array[v, 2, 3], v) FROM unnest(array_fill(1, array10000)) f (v)
has a runtime of 4157 ms with STRICT -> 2001 ms without = 2x speed improvement

View differences:

util.sql
1119 1119
--
1120 1120

  
1121 1121
CREATE FUNCTION map_nulls(nulls anyarray, value anyelement) RETURNS anyelement
1122
    LANGUAGE sql IMMUTABLE STRICT
1122
    LANGUAGE sql IMMUTABLE
1123 1123
    AS $_$
1124 1124
SELECT util._map(util.hstore($1, NULL) || '*=>*', $2)
1125 1125
$_$;

Also available in: Unified diff