DropBehavior dbehavior;
OnCommitAction oncommit;
List *list;
+ FastList fastlist;
Node *node;
Value *value;
ColumnRef *columnref;
{ $$ = NIL; }
;
-expr_list: a_expr { $$ = makeList1($1); }
- | expr_list ',' a_expr { $$ = lappend($1, $3); }
+expr_list: a_expr
+ {
+ FastList *dst = (FastList *) &$$;
+ makeFastList1(dst, $1);
+ }
+ | expr_list ',' a_expr
+ {
+ FastList *dst = (FastList *) &$$;
+ FastList *src = (FastList *) &$1;
+ *dst = *src;
+ FastAppend(dst, $3);
+ }
;
extract_list:
* FastList is an optimization for building large lists. The conventional
* way to build a list is repeated lappend() operations, but that is O(N^2)
* in the number of list items, which gets tedious for large lists.
+ *
+ * Note: there are some hacks in gram.y that rely on the head pointer (the
+ * value-as-list) being the first field.
*/
typedef struct FastList
{
( (fl)->head = (l), (fl)->tail = llastnode((fl)->head) )
#define FastListValue(fl) ( (fl)->head )
+#define makeFastList1(fl, x1) \
+ ( (fl)->head = (fl)->tail = makeList1(x1) )
+
/*
* function prototypes in nodes/list.c