Commit 456c198
committed
Avoid reallocations for reading qualified names
Qualified names accumulate into buf, but drop their scratch space after
every completion of reading a qualified name. At the end of reading a
qualified name, the scratch space only needs to be read by
reference. The allocation of the value returned to the API client
happens in OwnedName.
By using a separate scratch space `qualified_name_buf`, we can operate
on the same scratch space string for each time reading a qualified name.
Results in a 2.8% speedup in a local measurement against a test similar
to [1].
[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/perf_tests/parser/xml-parser.html;l=8?q=xml-parser.html1 parent ee2d4db commit 456c198
1 file changed
Lines changed: 13 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
543 | 545 | | |
544 | 546 | | |
545 | 547 | | |
546 | | - | |
547 | 548 | | |
548 | | - | |
| 549 | + | |
549 | 550 | | |
550 | | - | |
551 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
555 | 558 | | |
556 | | - | |
557 | | - | |
| 559 | + | |
| 560 | + | |
558 | 561 | | |
559 | 562 | | |
560 | 563 | | |
561 | 564 | | |
562 | | - | |
563 | | - | |
564 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
565 | 568 | | |
566 | 569 | | |
567 | | - | |
| 570 | + | |
568 | 571 | | |
569 | 572 | | |
570 | 573 | | |
| |||
0 commit comments