Commit 9e3ad1a
committed
Use fast path in plpgsql's RETURN/RETURN NEXT in more cases.
exec_stmt_return() and exec_stmt_return_next() have fast-path code for
handling a simple variable reference (i.e. "return var") without going
through the full expression evaluation machinery. For some reason,
pl_gram.y was under the impression that this fast path only applied for
record/row variables; but in reality code for handling regular scalar
variables has been there all along. Adjusting the logic to allow that
code to be used actually results in a net savings of code in pl_gram.y
(by eliminating some redundancy), and it buys a measurable though not
very impressive amount of speedup.
Noted while fooling with my expanded-array patch, wherein this makes a much
bigger difference because it enables returning an expanded array variable
without an extra flattening step. But AFAICS this is a win regardless,
so commit it separately.1 parent 2c75531 commit 9e3ad1a
2 files changed
+28
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2452 | 2452 | | |
2453 | 2453 | | |
2454 | 2454 | | |
2455 | | - | |
2456 | | - | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
2457 | 2458 | | |
2458 | 2459 | | |
2459 | 2460 | | |
| |||
2576 | 2577 | | |
2577 | 2578 | | |
2578 | 2579 | | |
2579 | | - | |
2580 | | - | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
2581 | 2583 | | |
2582 | 2584 | | |
2583 | 2585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3036 | 3036 | | |
3037 | 3037 | | |
3038 | 3038 | | |
3039 | | - | |
| 3039 | + | |
3040 | 3040 | | |
3041 | 3041 | | |
3042 | | - | |
3043 | | - | |
| 3042 | + | |
| 3043 | + | |
3044 | 3044 | | |
3045 | 3045 | | |
3046 | 3046 | | |
3047 | 3047 | | |
3048 | | - | |
| 3048 | + | |
| 3049 | + | |
3049 | 3050 | | |
3050 | 3051 | | |
3051 | 3052 | | |
| |||
3055 | 3056 | | |
3056 | 3057 | | |
3057 | 3058 | | |
3058 | | - | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
3059 | 3065 | | |
3060 | 3066 | | |
3061 | 3067 | | |
3062 | 3068 | | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
3066 | | - | |
3067 | | - | |
3068 | | - | |
3069 | | - | |
3070 | | - | |
3071 | 3069 | | |
3072 | 3070 | | |
3073 | 3071 | | |
| |||
3099 | 3097 | | |
3100 | 3098 | | |
3101 | 3099 | | |
3102 | | - | |
| 3100 | + | |
3103 | 3101 | | |
3104 | 3102 | | |
3105 | | - | |
3106 | | - | |
| 3103 | + | |
| 3104 | + | |
3107 | 3105 | | |
3108 | 3106 | | |
3109 | 3107 | | |
3110 | 3108 | | |
3111 | | - | |
| 3109 | + | |
| 3110 | + | |
3112 | 3111 | | |
3113 | 3112 | | |
3114 | 3113 | | |
| |||
3118 | 3117 | | |
3119 | 3118 | | |
3120 | 3119 | | |
3121 | | - | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
3122 | 3126 | | |
3123 | 3127 | | |
3124 | 3128 | | |
3125 | 3129 | | |
3126 | | - | |
3127 | | - | |
3128 | 3130 | | |
3129 | 3131 | | |
3130 | 3132 | | |
| |||
0 commit comments