mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-16 06:54:03 +00:00
Reduce size of complete_entry_opt_t
It's gone from 136 bytes to a 128 bytes by rearranging the items in order of decreasing alignment requirements. While this reduces the memory consumption slightly (by around 6%) for each completion we have in-memory, that translates to only around ~8KiB of savings for a command with 1000 possible completions, which is nice but ultimately not that big of a deal. The bigger benefit is that a single `complete_entry_t` might now fit in a cache line, hopefully making the process of testing completions for matches more cache friendly (and maybe even faster).
This commit is contained in:
parent
0e9371cf24
commit
67c0a1db85
2 changed files with 3 additions and 3 deletions
|
@ -92,14 +92,14 @@ namespace {
|
|||
struct complete_entry_opt_t {
|
||||
/// Text of the option (like 'foo').
|
||||
wcstring option;
|
||||
/// Type of the option: args_only, short, single_long, or double_long.
|
||||
complete_option_type_t type;
|
||||
/// Arguments to the option.
|
||||
wcstring comp;
|
||||
/// Description of the completion.
|
||||
wcstring desc;
|
||||
/// Conditions under which to use the option.
|
||||
wcstring_list_t conditions;
|
||||
/// Type of the option: args_only, short, single_long, or double_long.
|
||||
complete_option_type_t type;
|
||||
/// Determines how completions should be performed on the argument after the switch.
|
||||
completion_mode_t result_mode;
|
||||
/// Completion flags.
|
||||
|
|
|
@ -198,7 +198,7 @@ class completion_receiver_t {
|
|||
const size_t limit_;
|
||||
};
|
||||
|
||||
enum complete_option_type_t {
|
||||
enum complete_option_type_t : uint8_t {
|
||||
option_type_args_only, // no option
|
||||
option_type_short, // -x
|
||||
option_type_single_long, // -foo
|
||||
|
|
Loading…
Reference in a new issue