cvsuser     03/05/28 07:56:33

  Modified:    .        MANIFEST MANIFEST.detailed list.c
               examples/benchmarks stress.pasm
  Added:       examples/benchmarks stress1.pasm stress1.pl stress3.pasm
  Log:
  new stress-tests and list improvements
  
  Revision  Changes    Path
  1.348     +3 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.347
  retrieving revision 1.348
  diff -u -w -r1.347 -r1.348
  --- MANIFEST  23 May 2003 16:30:48 -0000      1.347
  +++ MANIFEST  28 May 2003 14:56:29 -0000      1.348
  @@ -229,9 +229,12 @@
   examples/benchmarks/primes2_p.pasm
   examples/benchmarks/primes2.py
   examples/benchmarks/stress.pasm
  +examples/benchmarks/stress1.pasm
  +examples/benchmarks/stress1.pl
   examples/benchmarks/stress.pl
   examples/benchmarks/stress2.pasm
   examples/benchmarks/stress2.pl
  +examples/benchmarks/stress3.pasm
   examples/mops/README
   examples/mops/mops.c
   examples/mops/mops.cs
  
  
  
  1.22      +3 -0      parrot/MANIFEST.detailed
  
  Index: MANIFEST.detailed
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST.detailed,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -w -r1.21 -r1.22
  --- MANIFEST.detailed 23 May 2003 16:30:48 -0000      1.21
  +++ MANIFEST.detailed 28 May 2003 14:56:29 -0000      1.22
  @@ -229,8 +229,11 @@
   [main]doc    examples/benchmarks/primes2.py
   [main]doc    examples/benchmarks/stress.pasm
   [main]doc    examples/benchmarks/stress.pl
  +[main]doc    examples/benchmarks/stress1.pasm
  +[main]doc    examples/benchmarks/stress1.pl
   [main]doc    examples/benchmarks/stress2.pasm
   [main]doc    examples/benchmarks/stress2.pl
  +[main]doc    examples/benchmarks/stress3.pasm
   [main]doc    examples/mops/README
   [main]doc    examples/mops/mops.c
   [main]doc    examples/mops/mops.cs
  
  
  
  1.30      +34 -11    parrot/list.c
  
  Index: list.c
  ===================================================================
  RCS file: /cvs/public/parrot/list.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -w -r1.29 -r1.30
  --- list.c    24 May 2003 13:43:08 -0000      1.29
  +++ list.c    28 May 2003 14:56:29 -0000      1.30
  @@ -5,7 +5,7 @@
    *  Copyright: (c) 2002 Leopold Toetsch <[EMAIL PROTECTED]>
    *  License:  Artistic/GPL, see README and LICENSES for details
    *  CVS Info
  - *     $Id: list.c,v 1.29 2003/05/24 13:43:08 leo Exp $
  + *     $Id: list.c,v 1.30 2003/05/28 14:56:29 leo Exp $
    *  Overview:
    *     list aka array routines for Parrot
    *  History:
  @@ -25,6 +25,9 @@
    *    - 1.18               fixes
    *      1.19    08.11.2002 arbitrary sized items (enum_type_sized)
    *      1.26    08.01.2003 move Chunk_list flags out of buffer header
  + *      1.29               join chunks > MAX_ITEMS (Matt Fowles)
  + *      1.30               greater threshold befor do_sparse
  + *                         setting initial size to avoid sparse
    *
    *  Data Structure and Algorithms:
    *  ==============================
  @@ -70,7 +73,17 @@
    *
    *    enum_grow_fixed:
    *    All chunks are of MAX_ITEMS size, chosen, when the first access to
  - *    the array is indexed and beyond MIN_ITEMS
  + *    the array is indexed and beyond MIN_ITEMS and below 10 *
  + *    MAX_ITEMS
  + *    If the first access is beyond 10 * MAX_ITEMS a sparse chunk will
  + *    be created.
  + *    To avoid this - and the performance penalty - set the array size
  + *    before setting elements.
  + *
  + *      new P0, .PerlArray
  + *      set P0, 100000  # sets fixed sized, no sparse
  + *
  + *    This is only meaningful, if a lot of the entries are used too
    *
    *    enum_grow_growing:
    *    chunk sizes grow from MIN_ITEMS to MAX_ITEMS, this will be selected
  @@ -82,7 +95,7 @@
    *
    *    The chunks hold the information, how many chunks are of the same
    *    type, beginning from the current, and how many items are
  - *    included in this range. s. get_chunk below for detais.
  + *    included in this range. s. get_chunk below for details.
    *
    *    Sparse lists
    *    ------------
  @@ -475,7 +488,7 @@
       UINTVAL items, size;
       List_chunk *new_chunk;
       int much = idx - list->cap >= MIN_ITEMS;
  -    int do_sparse = (INTVAL)idx - (INTVAL)list->cap >= 2 * MAX_ITEMS;
  +    int do_sparse = (INTVAL)idx - (INTVAL)list->cap >= 10 * MAX_ITEMS;
   
       if (list->item_type == enum_type_sized) {
           items = list->items_per_chunk;
  @@ -1142,10 +1155,10 @@
   
       for (chunk = list->first; chunk; chunk = chunk->next) {
           pobject_lives(interpreter, (PObj *)chunk);
  -        if (!(chunk->flags & sparse))
  -            for (i = 0; i < chunk->items; i++) {
                   if (list->item_type == enum_type_PMC ||
                       list->item_type == enum_type_STRING) {
  +            if (!(chunk->flags & sparse))
  +                for (i = 0; i < chunk->items; i++) {
                       p = ((PObj **)chunk->data.bufstart)[i];
                       if (p)
                           pobject_lives(interpreter, p);
  @@ -1176,6 +1189,16 @@
           idx = list->start + (UINTVAL)len;
           list->length = len;
           if (idx >= list->cap) {
  +            /* assume user will fill it, so don't generate sparse
  +             * chunks
  +             */
  +            if (!list->cap && idx > MAX_ITEMS) {
  +                while (idx - MAX_ITEMS >= list->cap) {
  +                    add_chunk(interpreter, list, enum_add_at_end,
  +                            list->cap + MAX_ITEMS);
  +                }
  +            }
  +
               list_append(interpreter, list, 0, list->item_type, idx);
           }
           else {
  
  
  
  1.4       +1 -1      parrot/examples/benchmarks/stress.pasm
  
  Index: stress.pasm
  ===================================================================
  RCS file: /cvs/public/parrot/examples/benchmarks/stress.pasm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- stress.pasm       3 Jan 2003 21:27:40 -0000       1.3
  +++ stress.pasm       28 May 2003 14:56:33 -0000      1.4
  @@ -3,7 +3,7 @@
   # Do some GC stress-testing
   #
   
  -# Our master loop, 10000 times
  +# Our outer loops, 10+20+20 times
   
        set I0, 10
        new P0, .PerlArray
  
  
  
  1.1                  parrot/examples/benchmarks/stress1.pasm
  
  Index: stress1.pasm
  ===================================================================
  # stress1.pasm
  #
  # Do some GC stress-testing
  #
  
  # Our master loop, I20 times
        set I20, 10
        time N0
  mloop:
  
        set I0, 10
        new P0, .PerlArray
  
  ol:   bsr buildarray
        set P0[I0], P1
        dec I0
        if I0, ol
  
        set I0, 20
        new P2, .PerlArray
  
  ol1:  bsr buildarray
        set P2[I0], P1
        dec I0
        if I0, ol1
  
        set I0, 20
        new P3, .PerlArray
  
  ol2:  bsr buildarray
        set P3[I0], P1
        dec I0
        if I0, ol2
  
        time N1
        sub N2, N1, N0
        set N0, N1
        print N2
  
        interpinfo I1, 2
        print "\nA total of "
        print I1
        print " DOD runs were made\n"
  
        dec I20
        if I20, mloop
  
        end
  
  
        # Our inner loop, 20000 times
  buildarray:
        set I1, 20000
        new P1, .PerlArray
        set P1, I1      # set length => fixed sized array
  loop1:        new P9, .PerlInt
        set P9, I1
        set P1[I1], P9
        dec I1
        if I1, loop1
        ret
  
  
  
  1.1                  parrot/examples/benchmarks/stress1.pl
  
  Index: stress1.pl
  ===================================================================
  foreach (1..10) {
      my @arr;
      foreach (1..10) {
        $arr[$_] = buildarray();
      }
  
      my @arr1;
      foreach (1..20) {
        $arr1[$_] = buildarray();
      }
  
      my @arr2;
      foreach (1..20) {
        $arr2[$_] = buildarray();
      }
  }
  
  sub buildarray {
      my @foo;
      foreach (1..20000) {
        $foo[$_] = $_;
      }
      return [EMAIL PROTECTED];
  }
  
  
  
  1.1                  parrot/examples/benchmarks/stress3.pasm
  
  Index: stress3.pasm
  ===================================================================
  # stress3.pasm
  #
  # Do some GC stress-testing
  #
  
  # first loop, 100 times use 1.000.000 PMCs
  #
  # with a program arg of 1 these are destroyed before the 2. loop
  
        set I10, P0
        lt I10, 2, noarg
        set I11, P0[1]
  noarg:
        set I0, 100
        new P0, .PerlArray
  
  ol:   bsr buildarray
        set P0[I0], P1
        dec I0
        if I0, ol
  
  # now check reusage, destroy them depending on I11
        unless I11, no_dest
        new P0, .PerlUndef
  no_dest:
        set I0, 5000000
        new P3, .PerlArray
  l2:
        new P1, .PerlInt
        set P3[0], P1
        dec I0
        if I0, l2
  
        interpinfo I1, 2
        print "A total of "
        print I1
        print " DOD runs were made\n"
        interpinfo I1, 4
        print I1
        print " active PMCs\n"
  
        end
  
  
        # Our inner loop, 10000 times
  buildarray:
        set I1, 10000
        new P1, .PerlArray
  loop1:        new P9, .PerlInt
        set P9, I1
        set P1[I1], P9
        dec I1
        if I1, loop1
        ret
  
  
  

Reply via email to