Skip to content

Minor performance improvements #645

Description

@emlautarom1

Summary

Small repeated-work items, collected so none is lost.

  • Health selectors compile a Regex per (label × contain) per series per scrape: labels_contain calls Regex::new inside its double loop, invoked per metric series by count_labels/sum_labels, and the selectors themselves are rebuilt per check in health/checks.rs. Precompile or cache.
  • CLI test commands build a fresh reqwest::Client per request — a new connection pool each time, so no keep-alive across RTT probes, which skews the very latency being measured: request_rtt (~20 call sites across beacon/mev/peers), relay_ping_test, and beacon.rs's http_client() per call site. request_rtt and relay_ping_test also carry no timeout (bounded only by cancellation) — one shared client with the 10s timeout the other paths already use fixes both. Improve alpha test peers: match Charon's probes; reduce timeouts #632 should adopt it for peers.
  • DutyType's Display round-trips through serde_json per call (types.rs#L55-L65) and feeds ~25 metric-label call sites (scheduler, tracker reporters, bcast/consensus metrics, dutydb). Give it an as_str() like ProposalType already has.
  • parsigex do_recv clones duty + par_sig per entry per inbound message (handler.rs#L264-L267) because the Verifier alias takes all three by value; narrowing to borrows ripples through every implementor and the boxed-future lifetime — decide once and do it.
  • conn_logger still tests connectivity via the allocating connections_to_peer(..).is_empty() (conn_logger.rs#L266) — cold path, but PeerStore::has_connection exists for exactly this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions