Changeset ff71057 for doc


Ignore:
Timestamp:
Apr 4, 2023, 1:26:08 PM (14 months ago)
Author:
Mike Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, master
Children:
e02e13f
Parents:
fdc042d
Message:

Apply volatile variable frequency reduction (of fa6ca1ac779b4) to _classic test too.

Now current measurement agrees with classic, plus a 3%--8% penalty.
Calling that successfully reproducing classic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/benchmarks/list/_classic.c

    rfdc042d rff71057  
    171171#endif
    172172
    173 
    174 #define Repeat( op ) for ( volatile unsigned int i = 0; i < NoOfNodes; i += 1 ) { op; }
     173volatile unsigned int t = 0;
     174volatile unsigned int i_official = 0;
     175
     176#define Repeat( op ) for ( unsigned int i = 0; (i_official = i, i < NoOfNodes); i += 1 ) { op; }
    175177
    176178int main() {
     
    192194        TAILQ_INIT(&lst);
    193195        start = clock();
    194         for ( volatile unsigned int t = 0; t < Times; t += 1 ) {
     196        for ( t = 0; t < Times; t += 1 ) {
    195197                Repeat( TAILQ_INSERT_TAIL( &lst, &s[i], x ) );
    196198                Repeat( TAILQ_REMOVE( &lst, TAILQ_FIRST( &lst ), x ) );
     
    204206        std::list<S *> lst;
    205207        start = clock();
    206         for ( volatile unsigned int t = 0; t < Times; t += 1 ) {
     208        for ( t = 0; t < Times; t += 1 ) {
    207209                Repeat( lst.push_back( &s[i] ) );
    208210                Repeat( lst.pop_front() );
     
    216218        uSequence<S> lst;
    217219        start = clock();
    218         for ( volatile unsigned int t = 0; t < Times; t += 1 ) {
     220        for ( t = 0; t < Times; t += 1 ) {
    219221                Repeat( lst.addTail( &s[i] ) );
    220222                Repeat( lst.dropHead() );
     
    228230        dlist(S) lst;
    229231        start = clock();
    230         for ( volatile unsigned int t = 0; t < Times; t += 1 ) {
     232        for ( t = 0; t < Times; t += 1 ) {
    231233                Repeat( insert_last( lst, s[i] ) );
    232234                Repeat( remove( lst`first ) );
     
    240242        Sequence(S) lst;
    241243        start = clock();
    242         for ( volatile unsigned int t = 0; t < Times; t += 1 ) {
     244        for ( t = 0; t < Times; t += 1 ) {
    243245                Repeat( addHead( lst, s[i] ) );
    244246                Repeat( dropTail( lst ) );
Note: See TracChangeset for help on using the changeset viewer.