Commit 67180ef
committed
Optimize vec::retain performance
This simply moves the loops into the inner function which leads to better results.
```
old:
test vec::bench_retain_100000 ... bench: 203,828 ns/iter (+/- 2,101)
test vec::bench_retain_iter_100000 ... bench: 63,324 ns/iter (+/- 12,305)
test vec::bench_retain_whole_100000 ... bench: 42,989 ns/iter (+/- 291)
new:
test vec::bench_retain_100000 ... bench: 42,180 ns/iter (+/- 451)
test vec::bench_retain_iter_100000 ... bench: 65,167 ns/iter (+/- 11,971)
test vec::bench_retain_whole_100000 ... bench: 33,736 ns/iter (+/- 12,404)
```1 parent d0f38cc commit 67180ef
1 file changed
+29
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1520 | 1520 | | |
1521 | 1521 | | |
1522 | 1522 | | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
| 1523 | + | |
| 1524 | + | |
1526 | 1525 | | |
1527 | 1526 | | |
1528 | | - | |
1529 | | - | |
| 1527 | + | |
1530 | 1528 | | |
1531 | 1529 | | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
1549 | 1553 | | |
| 1554 | + | |
1550 | 1555 | | |
1551 | | - | |
1552 | | - | |
1553 | 1556 | | |
1554 | 1557 | | |
1555 | 1558 | | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
| 1559 | + | |
1561 | 1560 | | |
1562 | 1561 | | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
| 1562 | + | |
1566 | 1563 | | |
1567 | 1564 | | |
1568 | 1565 | | |
| |||
0 commit comments