Skip to content

Conversation

@schneems
Copy link
Collaborator

Previously we were keeping track of the lines that were not in the frontier via an @indent_hash with the keys as indentation and value as an array.

This was inefficient and caused us to constantly be sorting the keys. Instead, we can get the same information by only sorting once.

As a bonus perf optimization, CodeLine#indent_index generates a key for stable sort and memoizes it so it only has to be allocated once per line.

@schneems schneems force-pushed the schneems/new-frontier branch from 2bc135a to 9fe6916 Compare December 16, 2020 20:46
@schneems schneems force-pushed the schneems/new-frontier branch from 9fe6916 to 25c3e58 Compare December 16, 2020 20:46
Previously we were keeping track of the lines that were not in the frontier via an @indent_hash with the keys as indentation and value as an array.

This was inefficient and caused us to constantly be sorting the keys. Instead we can get the same information by only sorting once.

As a bonus perf optimization CodeLine#indent_index generates a key for stable sort and memoizes it so it only has to be allocated once per line.
@schneems schneems force-pushed the schneems/new-frontier branch from 25c3e58 to dbb8520 Compare December 16, 2020 20:47
@schneems schneems merged commit 5546fc0 into main Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants