1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibLine: Remove duplicate members in CompletionSuggestion

Previously, we stored two representations of the same string in
`CompletionSuggestion` object: one for the bytes and the other for the
code points corresponding to those bytes. To minimize duplication, this
patch combine both representations into a single UTF-8 string, which is
already supported by our new String class.

Following this update, we successfully reduce the size of each object
from 376 bytes to 256 bytes
This commit is contained in:
hanaa12G 2023-12-07 03:49:35 +07:00 committed by Ali Mohammad Pur
parent 89877b3f40
commit 19f137c1e6
7 changed files with 54 additions and 66 deletions

View file

@ -150,7 +150,7 @@ Vector<CodeComprehension::AutocompleteResultEntry> ShellComprehensionEngine::get
auto completions = const_cast<::Shell::AST::Node*>(document.node.ptr())->complete_for_editor(shell(), offset_in_file, hit_test).release_value_but_fixme_should_propagate_errors();
Vector<CodeComprehension::AutocompleteResultEntry> entries;
for (auto& completion : completions)
entries.append({ completion.text_string, completion.input_offset });
entries.append({ completion.text_string(), completion.input_offset });
return entries;
}