crodas / microredis

Redis server implemented in rust.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Optimized dispatcher #15

Closed crodas closed 2 years ago

crodas commented 2 years ago

On each parsed command send by clients a new dispatcher object would have been created to be thrown away right when the command has been executed. This was a bit suboptimal, although easier to implement.

This MR creates a single dispatcher object and will return a reference to the handler function based on the command to be executed. Having a single object, shared for all connections is far more efficient and also required to gather metrics.