--- parser3/src/main/Attic/pa_array.C 2001/03/29 17:11:41 1.30 +++ parser3/src/main/Attic/pa_array.C 2001/05/16 16:48:56 1.33 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_array.C,v 1.30 2001/03/29 17:11:41 paf Exp $ + $Id: pa_array.C,v 1.33 2001/05/16 16:48:56 parser Exp $ */ #include "pa_config_includes.h" @@ -15,9 +15,30 @@ #include "pa_exception.h" #include "pa_common.h" +#include "pa_sapi.h" +#define ARRAY_STAT_MAX_PIECES 1000 +int array_stat_pieces[ARRAY_STAT_MAX_PIECES]; +void log_array_stats(Pool& pool) { + for(int i=0; i( malloc(sizeof(int)+sizeof(Chunk::Row)*initial_rows+sizeof(Chunk *))); @@ -32,8 +53,12 @@ Array::Array(Pool& apool, int initial_ro } void Array::expand(int chunk_rows) { - if(chunk_rows( malloc(sizeof(int)+sizeof(Chunk::Row)*chunk_rows+sizeof(Chunk *))); @@ -47,10 +72,17 @@ void Array::expand(int chunk_rows) { Array& Array::operator += (Item *src) { if(chunk_is_full()) - expand(tail->count*CR_GROW_PERCENT/100); + expand(tail->count+CR_GROW_COUNT); append_here->item=src; append_here++; fused_rows++; + { + int index=min(fused_rows, ARRAY_STAT_MAX_LEN-1); + if(index) + array_stat_lens[index-1]++; + array_stat_lens[index]++; + } + return *this; } @@ -59,7 +91,7 @@ Array::Item *Array::get(int index) const if(!(index>=0 && index=0 && indexrows; row!=append_here; row++) + (*func)(row->item, info); + break; + } else { + int count=chunk->count; + for(int i=0; irows[i].item, info); + chunk=chunk->rows[count].link; + } + } +} +*/ Array::Item* Array::first_that(First_that_func_const func, const void *info) const { Chunk *chunk=head; while(true) {