Changeset 94647b0


Ignore:
Timestamp:
Nov 24, 2021, 9:10:18 PM (10 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
enum, master, pthread-emulation, qualifiedEnum
Children:
7770cc8
Parents:
fefd77a
Message:

String peformance improvement by removing all remaining uses of handwritten ByteCopy?. Halves noshare-fresh execution time, though a ~40% slowdown remains vs stl-fresh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/containers/string_res.cfa

    rfefd77a r94647b0  
    4949static void ?{}( VbyteHeap &, size_t = 1000 );
    5050static void ^?{}( VbyteHeap & );
    51 static void ByteCopy( char *, int, int, char *, int, int ); // copy a block of bytes from one location in the heap to another
     51
    5252static int ByteCmp( char *, int, int, char *, int, int );       // compare 2 blocks of bytes
    5353static char *VbyteAlloc( VbyteHeap &, int );                    // allocate a block bytes in the heap
     
    875875//######################### VbyteHeap #########################
    876876
    877 // Move characters from one location in the byte-string area to another. The routine handles the following situations:
    878 //
    879 // if the |Src| > |Dst| => truncate
    880 // if the |Dst| > |Src| => pad Dst with blanks
    881 
    882 void ByteCopy( char *Dst, int DstStart, int DstLnth, char *Src, int SrcStart, int SrcLnth ) {
    883     for ( int i = 0; i < DstLnth; i += 1 ) {
    884       if ( i == SrcLnth ) {                             // |Dst| > |Src|
    885             for ( ; i < DstLnth; i += 1 ) {             // pad Dst with blanks
    886                 Dst[DstStart + i] = ' ';
    887             } // for
    888             break;
    889         } // exit
    890         Dst[DstStart + i] = Src[SrcStart + i];
    891     } // for
    892 } // ByteCopy
    893 
    894877// Compare two byte strings in the byte-string area. The routine returns the following values:
    895878//
     
    955938    h = Header.flink;                                   // ignore header node
    956939    for (;;) {
    957                 ByteCopy( EndVbyte, 0, h->lnth, h->s, 0, h->lnth );
     940                memmove( EndVbyte, h->s, h->lnth );
    958941                obase = h->s;
    959942                h->s = EndVbyte;
     
    997980    int AmountUsed, AmountFree;
    998981
     982//    assert( false );
     983
    999984    AmountUsed = 0;
    1000985    for ( HandleNode *i = Header.flink; i != &Header; i = i->flink ) { // calculate amount of byte area used
Note: See TracChangeset for help on using the changeset viewer.