Exercise loadComponent of sdk more when training kernel_service
Exercise loadComponent of sdk more when training kernel_service

By exercising loadComponent more we speedup the loading of the sdk.
This is going to be noticable when executing small scripts.
On my machine execution of a hello-world script is speed up by ~15-20%.

More data from local experiments:

Before:

$ perf stat -r 25 -d out/ReleaseX64/dart hello.dart

 Performance counter stats for 'out/ReleaseX64/dart hello.dart' (25 runs):

        389.268166      task-clock:u (msec)       #    2.035 CPUs utilized            ( +-  0.91% )
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            19,278      page-faults:u             #    0.050 M/sec                    ( +-  0.65% )
       979,345,922      cycles:u                  #    2.516 GHz                      ( +-  1.31% )  (48.75%)
     1,120,493,995      instructions:u            #    1.14  insn per cycle           ( +-  0.73% )  (61.28%)
       207,470,248      branches:u                #  532.975 M/sec                    ( +-  0.84% )  (60.76%)
         4,439,025      branch-misses:u           #    2.14% of all branches          ( +-  1.00% )  (61.00%)
       387,461,284      L1-dcache-loads:u         #  995.358 M/sec                    ( +-  1.38% )  (49.12%)
        18,764,375      L1-dcache-load-misses:u   #    4.84% of all L1-dcache hits    ( +-  2.94% )  (26.43%)
         5,713,192      LLC-loads:u               #   14.677 M/sec                    ( +-  2.13% )  (25.71%)
         1,266,848      LLC-load-misses:u         #   22.17% of all LL-cache hits     ( +-  3.74% )  (37.01%)

       0.191278504 seconds time elapsed                                          ( +-  1.10% )


$ runxtimes 25 sudo chrt -f 99 /usr/bin/time -f "%e" out/ReleaseX64/dart hello.dart > /dev/null 2>> before.txt

After:

$ perf stat -r 25 -d out/ReleaseX64/dart hello.dart

 Performance counter stats for 'out/ReleaseX64/dart hello.dart' (25 runs):

        311.248543      task-clock:u (msec)       #    1.981 CPUs utilized            ( +-  0.91% )
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            18,055      page-faults:u             #    0.058 M/sec                    ( +-  0.84% )
       727,169,504      cycles:u                  #    2.336 GHz                      ( +-  1.66% )  (48.89%)
       875,097,166      instructions:u            #    1.20  insn per cycle           ( +-  0.74% )  (60.69%)
       164,966,288      branches:u                #  530.015 M/sec                    ( +-  0.82% )  (59.50%)
         3,403,794      branch-misses:u           #    2.06% of all branches          ( +-  0.93% )  (59.61%)
       272,404,305      L1-dcache-loads:u         #  875.199 M/sec                    ( +-  1.53% )  (47.62%)
        11,115,851      L1-dcache-load-misses:u   #    4.08% of all L1-dcache hits    ( +-  1.70% )  (27.55%)
         4,154,542      LLC-loads:u               #   13.348 M/sec                    ( +-  2.22% )  (26.40%)
         1,225,723      LLC-load-misses:u         #   29.50% of all LL-cache hits     ( +-  2.75% )  (37.49%)

       0.157151348 seconds time elapsed                                          ( +-  1.12% )



$ runxtimes 25 sudo chrt -f 99 /usr/bin/time -f "%e" out/ReleaseX64/dart hello.dart > /dev/null 2>> after.txt

$ ministat -A before.txt after.txt
x before.txt
+ after.txt
    N           Min           Max        Median           Avg        Stddev
x  25          0.17           0.2          0.18        0.1816         0.008
+  25          0.13          0.19          0.15         0.152   0.013844373
Difference at 95.0% confidence
        -0.0296 +/- 0.00643101
        -16.2996% +/- 3.5413%
        (Student's t, pooled s = 0.0113063)



Notes:

$ type runxtimes
runxtimes is a function
runxtimes ()
{
    number=$1;
    shift;
    for i in `seq $number`;
    do
        $@;
    done
}

Change-Id: I760759976136195da00e3719663bdadbfe962e70
Reviewed-on: https://dart-review.googlesource.com/c/82581
Reviewed-by: Alexander Aprelev <dfb74c35a357c2059971a4bf7fe26b6a7c18085d@google.com>
Commit-Queue: Jens Johansen <05223a3c6bdf76af6f84755eae231abeebcf4530@google.com>

dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk