aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-20 13:45:36 +0100
committereldritch horrors <pennae@lix.systems>2024-03-20 13:45:36 +0100
commit22e3f0e9875082be7f4eec8e3caeb134a7f1c05f (patch)
treed445bdee787674d62b5bd742dd036a9923c166ff
parent5a28d70d1e340ff5acccf754b46f035cc6beacf3 (diff)
libexpr: unbreak PosTable performance
this was mostly an inconvenience for error reporting, but fully broke the debugger (because the debugger does *a lot* of eager position resolution). copying the line offsets into a local and filling that local when empty without also storing the calculated offsets back does kind of ... not cache anything. fixes https://git.lix.systems/lix-project/lix/issues/165 Change-Id: Iccb0ba193ce2f15c832978daecf7b9bebbbe8585
-rw-r--r--src/libexpr/nixexpr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index e0f4def4c..fd380935a 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -593,7 +593,7 @@ Pos PosTable::operator[](PosIdx p) const
Pos result{0, 0, origin->origin};
auto lines = this->lines.lock();
- auto linesForInput = (*lines)[origin->offset];
+ auto & linesForInput = (*lines)[origin->offset];
if (linesForInput.empty()) {
auto source = result.getSource().value_or("");