Skip to content

Low-impact perf cleanup batch #36

Description

@mack42

Source: Audit findings (LOW perf, grouped)

A handful of small wins, none individually urgent. Easy to do together once someone is in the file.

  1. ZRANGEBYSCORE filters twice (`src/storage/types.rs:256-264`): `range_by_score_bounded` does a `take_while` + `filter` chain over the collected range. Fold both predicates into one closure before `.collect()`.

  2. Command name uppercased multiple times (`src/server/connection.rs:202,298`): inline command parser already normalizes; extract once and pass through.

  3. `maxmemory_policy.clone()` per write command (`src/server/connection.rs:552`): the policy String is cloned from `Arc` on every SET/ZADD/etc. Pass as `&str` or switch `maxmemory_policy` from `String` to a small enum.

  4. LRU clock incremented on every access (`src/storage/db.rs:67-68,86-87`): `touch_lru` mutates on every get/get_mut/set. Under single-threaded execution this is fine; sample every N accesses or every M μs if a future change ever multi-threads command execution.

  5. `to_vec()` on `Bytes` (multiple sites in `src/command/strings.rs:197,332,378,395`): unnecessary copy where the underlying `Bytes` would do. Audit and replace.

Each item is independent and self-reviewable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttier-3Differentiator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions