Commit 06402ab
[parser] Optimize mayFollowTypeArgs
Doing benchmarks before and after I get the below.
Notice that this is on tokens/ms, i.e. higher is better.
JIT:
pkg/analyzer/lib/src/dart/ast/ast.dart:
```
Difference at 95.0% confidence
1.27922 +/- 0.393002
6.47159% +/- 1.9882%
(Student's t, pooled s = 0.418268)
```
pkg/front_end/lib/src/type_inference/inference_visitor.dart:
```
Difference at 95.0% confidence
0.968609 +/- 0.287367
6.8824% +/- 2.04187%
(Student's t, pooled s = 0.305841)
```
In both cases it processes a little over 6% more tokens per ms.
AOT:
pkg/analyzer/lib/src/dart/ast/ast.dart:
```
Difference at 95.0% confidence
2.39988 +/- 0.429312
9.50898% +/- 1.70105%
(Student's t, pooled s = 0.456911)
```
pkg/front_end/lib/src/type_inference/inference_visitor.dart:
```
Difference at 95.0% confidence
2.28604 +/- 0.279366
12.9521% +/- 1.58282%
(Student's t, pooled s = 0.297326)
```
It processes between 9-13% more tokens per ms.
Additionally, for AOT, I ran it through the benchmarker and got this:
pkg/analyzer/lib/src/dart/ast/ast.dart:
```
msec task-clock:u: -8.5488% +/- 2.1840% (-275.52 +/- 70.39) (3222.95 -> 2947.42)
cycles:u: -8.6402% +/- 2.1619% (-1210657004.60 +/- 302921394.06) (14011942063.40 -> 12801285058.80)
instructions:u: -9.0870% +/- 0.0000% (-2746030853.20 +/- 876.33) (30219334757.30 -> 27473303904.10)
branch-misses:u: -13.3846% +/- 10.1850% (-5542357.40 +/- 4217459.09) (41408381.20 -> 35866023.80)
seconds time elapsed: -8.5442% +/- 2.1816% (-0.28 +/- 0.07) (3.22 -> 2.95)
seconds user: -8.5614% +/- 2.2098% (-0.27 +/- 0.07) (3.20 -> 2.93)
```
pkg/front_end/lib/src/type_inference/inference_visitor.dart
```
msec task-clock:u: -11.6033% +/- 0.9079% (-402.51 +/- 31.50) (3468.96 -> 3066.45)
cycles:u: -11.6826% +/- 0.9053% (-1765194611.60 +/- 136793475.00) (15109578869.80 -> 13344384258.20)
instructions:u: -11.4435% +/- 0.0000% (-3905886611.70 +/- 1150.33) (34131775222.10 -> 30225888610.40)
branch-misses:u: -17.5244% +/- 4.6453% (-8196278.70 +/- 2172645.25) (46770630.60 -> 38574351.90)
seconds time elapsed: -11.6004% +/- 0.9056% (-0.40 +/- 0.03) (3.47 -> 3.07)
seconds user: -11.6215% +/- 0.9879% (-0.40 +/- 0.03) (3.45 -> 3.05)
```
I.e. in both cases it's 8-11% less work (instructions, time etc).
Compiling the CFE with the CFE before and after (AOT) I get this change:
```
msec task-clock:u: -0.4356% +/- 0.3110% (-23.07 +/- 16.47) (5295.49 -> 5272.42)
page-faults:u: 0.1135% +/- 0.0534% (123.64 +/- 58.22) (108956.82 -> 109080.46)
cycles:u: -0.5004% +/- 0.3175% (-109702416.52 +/- 69596415.67) (21921571730.18 -> 21811869313.66)
instructions:u: -0.3994% +/- 0.0005% (-104979706.80 +/- 138268.02) (26284569470.80 -> 26179589764.00)
branch-misses:u: -1.6117% +/- 1.4644% (-1285239.90 +/- 1167813.84) (79746730.52 -> 78461490.62)
seconds time elapsed: -0.4291% +/- 0.3090% (-0.02 +/- 0.02) (5.30 -> 5.28)
seconds user: -0.3992% +/- 0.3801% (-0.02 +/- 0.02) (5.04 -> 5.02)
```
So this improvement to the parser reduces the runtime of compiling by ~0.4%.
Change-Id: Ia89d02e8cce2655fb23ffe18ecbab63521ce75e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439721
Commit-Queue: Jens Johansen <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>1 parent 9c5eea2 commit 06402ab
File tree
1 file changed
+73
-18
lines changed1 file changed
+73
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
| 474 | + | |
474 | 475 | | |
475 | 476 | | |
476 | 477 | | |
| |||
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | | - | |
484 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
485 | 488 | | |
486 | 489 | | |
487 | 490 | | |
| |||
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
508 | 563 | | |
0 commit comments