Branch: Tag:

2010-07-11

2010-07-11 12:39:11 by Jonas Wallden <jonasw@roxen.com>

Optimize recursive copying of arrays, multisets and mappings. We delay the
allocation of the lookup mapping used to quickly process duplicate entries
until we find that the source contains a container with complex data
inside. Another improvement is to not place basic types in the mapping
since they will be copied the same way regardless. Finally, the old code
added complex entries to the lookup mapping twice (both in svalue.c and in
the respective type handler) which was redundant.

Rev: src/array.c:1.229
Rev: src/mapping.c:1.217
Rev: src/multiset.c:1.120
Rev: src/svalue.c:1.261

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.228 2010/07/11 12:30:45 jonasw Exp $ + || $Id: array.c,v 1.229 2010/07/11 12:39:11 jonasw Exp $   */      #include "global.h"
2440:       ret=allocate_array_no_init(a->size,0);    +  if (m) {    aa.type = T_ARRAY;    aa.subtype = 0;    aa.u.array = a;
2447:    bb.subtype = 0;    bb.u.array = ret;    low_mapping_insert(m, &aa, &bb, 1); +  }       ret->flags = a->flags & ~ARRAY_LVALUE;