dfb414a0ec
This CL replaces the `optional` call in some places (more will likely follow in follow-up-CLs) with the (badly named) `optional2` which is both better typed (doesn't use strings) and is faster. In this CL I've replaced the most used calls (when using the CFE to compile itself), saving ~100 mio instructions. Sometimes statistics just says the ~100 mio instructions saved, other times I get statistics like this: ``` msec task-clock:u: -0.6861% +/- 0.2300% (-28.64 +/- 9.60) page-faults:u: 0.1113% +/- 0.0114% (116.33 +/- 11.97) cycles:u: -0.7966% +/- 0.2280% (-137543215.11 +/- 39365289.96) instructions:u: -0.4655% +/- 0.0003% (-100120984.16 +/- 56848.83) branch-misses:u: -3.5671% +/- 0.8585% (-2249707.82 +/- 541442.75) seconds time elapsed: -0.6788% +/- 0.2307% (-0.03 +/- 0.01) seconds user: -0.8448% +/- 0.2950% (-0.03 +/- 0.01) ``` ``` msec task-clock:u: -0.4102% +/- 0.2224% (-17.29 +/- 9.37) page-faults:u: 0.1194% +/- 0.0130% (124.99 +/- 13.61) cycles:u: -0.4368% +/- 0.2296% (-75891577.97 +/- 39893793.33) instructions:u: -0.4658% +/- 0.0003% (-100182606.12 +/- 62071.96) branch-misses:u: -1.5890% +/- 0.9771% (-1012729.95 +/- 622739.88) seconds time elapsed: -0.4072% +/- 0.2224% (-0.02 +/- 0.01) seconds user: -0.4771% +/- 0.3049% (-0.02 +/- 0.01) ``` ``` msec task-clock:u: -0.4542% +/- 0.2160% (-19.18 +/- 9.12) page-faults:u: 0.1219% +/- 0.0115% (127.61 +/- 12.03) cycles:u: -0.4774% +/- 0.2225% (-83126015.12 +/- 38752062.54) instructions:u: -0.4658% +/- 0.0003% (-100174778.84 +/- 61310.55) branch-misses:u: -1.9576% +/- 0.9711% (-1253736.65 +/- 621904.22) seconds time elapsed: -0.4471% +/- 0.2160% (-0.02 +/- 0.01) seconds user: -0.4976% +/- 0.2645% (-0.02 +/- 0.01) ``` These are statistics on 100 runs (each) of the CFE compiling itself when run as an AOT compile with `--deterministic`. It seems likely that it saves something like 0.4% in both instructions, cycles and actual runtime. Change-Id: I12763c23b1ec33357a31aaf47ed93ca16264c0f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385160 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>