From 22e3f0e9875082be7f4eec8e3caeb134a7f1c05f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 20 Mar 2024 13:45:36 +0100 Subject: 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 --- src/libexpr/nixexpr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(""); -- cgit v1.2.3