oxidecomputer / oxidecomputer/omicron

Build Speed proposal: Cut out the serde dependency when communicating with steno?

Open
#4,484 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

Here's my idea -- I'd like to validate this with additional data, and I'll see if I can sketch out some numbers for potential improvement.

A lot of the structs in nexus/db-model derive serde's Serialize and Deserialize traits, in addition to their family of Diesel traits.

These traits are needed in two spots:

  1. https://docs.rs/steno/0.4.0/steno/trait.Action.html returns an https://docs.rs/steno/0.4.0/steno/type.ActionResult.html , which is a serde_json::Value
  2. https://docs.rs/steno/0.4.0/steno/struct.ActionContext.html#method.lookup must be able to lookup a https://docs.rs/steno/0.4.0/steno/trait.ActionData.html , which expects Serialize and Deserialize to be implemented.

This "makes sense", in the sense that Steno needs to serialize and deserialize this data. There is a minor quirk here, however -- Steno doesn't really need to parse this information, and forcing these Serialization/Deserialization derives onto all structs that could be stored / retrieved.

For example: if Steno acted on a "byte array" as input / output, we could cut down on a fair bit of monomorphized code (and therefore compile-time), and might be able to use a lighter serialization framework, like https://github.com/dtolnay/miniserde

Contributor guide

Open the contributing guide

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 by inspecting the structs in nexus/db-model and their serde Serialize/Deserialize derives. Read the Steno Action and ActionContext lookup interfaces linked in the issue, then gather compile-time or monomorphization data to validate the proposed benefit. Done requires measured evidence and an agreed design for changing the serialization boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, 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.