Changeset 1680072 for libcfa


Ignore:
Timestamp:
May 12, 2021, 1:36:54 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1e5cd9a
Parents:
c8ffd74f
Message:

Changed ready_queue to use forloop instead of hardcoded unfolded loop of 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/ready_queue.cfa

    rc8ffd74f r1680072  
    398398
    399399                if(proc->rdq.target == -1u) {
    400                         _Static_assert(READYQ_SHARD_FACTOR == 2);
    401                         unsigned idx1 = proc->rdq.id + 0;
    402                         unsigned idx2 = proc->rdq.id + 1;
    403                         unsigned long long tsc1 = ts(lanes.data[idx1]);
    404                         unsigned long long tsc2 = ts(lanes.data[idx2]);
     400                        unsigned long long min = ts(lanes.data[proc->rdq.id]);
     401                        for(int i = 0; i < READYQ_SHARD_FACTOR; i++) {
     402                                unsigned long long tsc = ts(lanes.data[proc->rdq.id + i]);
     403                                if(tsc < min) min = tsc;
     404                        }
     405                        proc->rdq.cutoff = min;
    405406                        proc->rdq.target = __tls_rand() % lanes.count;
    406 
    407                         // WARNING: std::min is polymorphic and therefore causes 500% slowdown instead of the expected 2%
    408                         proc->rdq.cutoff = tsc1 < tsc2 ? tsc1 : tsc2;
    409407                }
    410408                else {
Note: See TracChangeset for help on using the changeset viewer.