Commit adbd083
committed
{libexpr,libcmd}: Make debugger significantly faster
The underlying issue is that debugger code path was
calling PosTable::operator[] in each eval method.
This has become incredibly expensive since 5d9fdab.
While we are it it, I've reworked the code to
not use std::shared_ptr where it really isn't necessary.
As I've documented in previous commits, this is actually
more a workaround for recursive header dependencies now
and is only necessary in `error.hh` code.
Some ad-hoc benchmarking:
After this commit:
```
Benchmark 1: nix eval nixpkgs#hello --impure --ignore-try --no-eval-cache --debugger
Time (mean ± σ): 784.2 ms ± 7.1 ms [User: 561.4 ms, System: 147.7 ms]
Range (min … max): 773.5 ms … 792.6 ms 10 runs
```
On master 3604c7c:
```
Benchmark 1: nix eval nixpkgs#hello --impure --ignore-try --no-eval-cache --debugger
Time (mean ± σ): 22.914 s ± 0.178 s [User: 18.524 s, System: 4.151 s]
Range (min … max): 22.738 s … 23.290 s 10 runs
```1 parent 50123f2 commit adbd083
4 files changed
+47
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 143 | + | |
147 | 144 | | |
148 | 145 | | |
149 | | - | |
150 | | - | |
| 146 | + | |
| 147 | + | |
151 | 148 | | |
152 | | - | |
| 149 | + | |
153 | 150 | | |
154 | 151 | | |
155 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
780 | 785 | | |
781 | 786 | | |
782 | 787 | | |
783 | | - | |
784 | | - | |
785 | | - | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
786 | 794 | | |
787 | 795 | | |
788 | 796 | | |
| |||
827 | 835 | | |
828 | 836 | | |
829 | 837 | | |
830 | | - | |
| 838 | + | |
831 | 839 | | |
832 | 840 | | |
833 | 841 | | |
| |||
1104 | 1112 | | |
1105 | 1113 | | |
1106 | 1114 | | |
1107 | | - | |
| 1115 | + | |
1108 | 1116 | | |
1109 | 1117 | | |
1110 | 1118 | | |
| |||
1330 | 1338 | | |
1331 | 1339 | | |
1332 | 1340 | | |
1333 | | - | |
1334 | | - | |
1335 | | - | |
| 1341 | + | |
1336 | 1342 | | |
1337 | 1343 | | |
1338 | 1344 | | |
| |||
1401 | 1407 | | |
1402 | 1408 | | |
1403 | 1409 | | |
1404 | | - | |
| 1410 | + | |
1405 | 1411 | | |
1406 | 1412 | | |
1407 | 1413 | | |
| |||
1602 | 1608 | | |
1603 | 1609 | | |
1604 | 1610 | | |
1605 | | - | |
| 1611 | + | |
1606 | 1612 | | |
1607 | 1613 | | |
1608 | 1614 | | |
| |||
1737 | 1743 | | |
1738 | 1744 | | |
1739 | 1745 | | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
| 1746 | + | |
1743 | 1747 | | |
1744 | 1748 | | |
1745 | 1749 | | |
| |||
2123 | 2127 | | |
2124 | 2128 | | |
2125 | 2129 | | |
2126 | | - | |
| 2130 | + | |
2127 | 2131 | | |
2128 | 2132 | | |
2129 | 2133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
0 commit comments