Commit 477fd70
committed
Auto merge of rust-lang#91407 - the8472:deserialize-unchecked-utf8, r=michaelwoerister
Avoid string validation in rustc_serialize, check a marker byte instead
Since the serialization format isn't self-describing we need a way to detect when encoder and decoder don't match up. But for strings it doesn't have to be utf8 validation, which currently does cost a few percent of performance.
Instead we can use a marker byte at the end to be reasonably sure that we're dealing with a string and it wasn't overwritten in some way.1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
153 | | - | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
| |||
502 | 510 | | |
503 | 511 | | |
504 | 512 | | |
505 | | - | |
| 513 | + | |
| 514 | + | |
506 | 515 | | |
507 | 516 | | |
508 | 517 | | |
| |||
656 | 665 | | |
657 | 666 | | |
658 | 667 | | |
659 | | - | |
660 | | - | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
661 | 674 | | |
662 | 675 | | |
663 | 676 | | |
| |||
0 commit comments