Closed madolson closed 5 months ago
We periodically check client->authenticated to see if the client authenticated with the current user, or was just assuming the default user for backwards compatibility. This check is fine, however it's unnecessary to use 4 bytes for what is basically a single bit flag. We can save the entire 4 bytes by moving it to a flag like https://github.com/valkey-io/valkey/blob/417660449f9c1fce998e1563f30f7bfd9cb5197f/src/server.h#L429.
Doing so would save some memory and might reduce cache line misses.
Hi I would like to contribute, can you elaborate on this solution You're proposing a bit more?
We periodically check client->authenticated to see if the client authenticated with the current user, or was just assuming the default user for backwards compatibility. This check is fine, however it's unnecessary to use 4 bytes for what is basically a single bit flag. We can save the entire 4 bytes by moving it to a flag like https://github.com/valkey-io/valkey/blob/417660449f9c1fce998e1563f30f7bfd9cb5197f/src/server.h#L429.
Doing so would save some memory and might reduce cache line misses.