Commit c554548
[dart2wasm] Make json decoder construct [OneByteStrings] if possible
If the input to `utf8.decode()` has only a single non-ascii character we
currently make all strings [TwoByteString]s. Not only is this very
memory intensive, it's also going to make comparisons later on slower
(e.g. a json['foo'] will use [OneByteString] for `foo` but the actual
map will have a [TwoByteString] as `foo`).
In general it would be better to have an invariant that strings that can
be [OneByteString]s should be [OneByteString]s.
Change-Id: I740b3eeb0f3660f2bf8fdd094e12f78f318f9a5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409320
Reviewed-by: Ömer Ağacan <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>1 parent 66fa0e2 commit c554548
1 file changed
+40
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
672 | 677 | | |
673 | 678 | | |
674 | 679 | | |
| |||
1181 | 1186 | | |
1182 | 1187 | | |
1183 | 1188 | | |
1184 | | - | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1185 | 1192 | | |
1186 | 1193 | | |
1187 | 1194 | | |
| |||
1589 | 1596 | | |
1590 | 1597 | | |
1591 | 1598 | | |
1592 | | - | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1593 | 1604 | | |
1594 | 1605 | | |
1595 | 1606 | | |
| |||
1635 | 1646 | | |
1636 | 1647 | | |
1637 | 1648 | | |
1638 | | - | |
1639 | | - | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1640 | 1666 | | |
1641 | 1667 | | |
1642 | 1668 | | |
1643 | 1669 | | |
1644 | 1670 | | |
1645 | 1671 | | |
1646 | | - | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
1647 | 1677 | | |
1648 | 1678 | | |
1649 | 1679 | | |
| |||
1835 | 1865 | | |
1836 | 1866 | | |
1837 | 1867 | | |
1838 | | - | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
1839 | 1873 | | |
1840 | 1874 | | |
1841 | 1875 | | |
| |||
0 commit comments