Skip to content

Improve performance of position map computation#232

Merged
vincent-botbol merged 1 commit into
masterfrom
perf-improvements
Jun 3, 2026
Merged

Improve performance of position map computation#232
vincent-botbol merged 1 commit into
masterfrom
perf-improvements

Conversation

@vincent-botbol

Copy link
Copy Markdown
Collaborator

This PR reworks and cleans up the position map structure used to handle hovering queries among others.

After a lot of algorithmic head scratches, the most reasonable solution was, instead of building incrementally, to actually accumulate elements before building the tree in one go. Indeed, we (mostly) insert in surface's position order and, as I encoded the tree as a list (still banging my head on a wall in order to replace that, btw), starting from the last handled element would actually prevent a quadratic factor as we don't have to scan through the whole list each time to insert in the correct position.

This behavior wasn't obvious under normal circumstances (i.e., "normal" size documents) but on extreme examples, we notice an improvement in execution time from >15s to 500ms.

Comment thread server/test/test.ml Outdated
@vincent-botbol vincent-botbol merged commit 373aab7 into master Jun 3, 2026
@vincent-botbol vincent-botbol deleted the perf-improvements branch June 3, 2026 08:13
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Catala - language & tooling Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants