RustCrypto / RustCrypto/formats

tls_codec performance

Open
#254 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
338
Forks
188
Avg merge
4d 6h
Merged PRs (30d)
15

Description

Hey @franziskuskiefer question for you, how is the current encoding / decoding performance? If there are places you think we can help make improvements let us know.

Originally posted by @tomleavy in https://github.com/RustCrypto/formats/issues/250#issuecomment-975838633

That's a good question. Before being able to answer the question we'd need to know what the performance is and understand if its any good.
There's a very basic benchmark here thttps://github.com/RustCrypto/formats/blob/4d0c0530be501e00dd1fbc25024db02eeffd669b/tls_codec/benches/tls_vec.rs. I wrote it to look at the performance impact of (de)serialising each element vs using the specialised ByteVec.

  • Write benchmarks for real-world scenarios to measure performance.

There are two things that I think are worth looking at.

  • Memory allocations are the most expensive operation. Are there any unnecessary allocations? Is any buffer resized unnecessarily?
  • The existing benchmarks show that invoking (de)serialise for each element in a vector takes significant amount of time. Can this be optimised somehow?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tls_codec/benches/tls_vec.rs and review the existing vector serialization benchmark. Add benchmarks for real-world scenarios, then investigate the allocation, buffer-resizing, and per-element serialization costs described in the issue. Done means the relevant performance characteristics are measured and any justified optimization is supported by benchmark results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.