Skip to content

Reduce use of buffers #363

@chrysn

Description

@chrysn

Right now we're using various buffer type aliases about everywhere to lug around messages. This comes with a bunch of problems:

  • We're copying around a lot of data, so much that we get huge stack sizes.
  • There are type aliases all over the place but they're not used consistently, so they're decayed into essentially requiring them to be the same type.
  • It's highly unidiomatic.

On the long run, I'd like to get to a point where we can do almost everything in place, provided hax lets us. But as a first step, let's get the use of buffers out from where we really don't need them, and clean up piece by piece.

Failed attempts

I've tried to just make all the various type aliases of EdhocMessageBuffer be an EdhocBuffer<{MAX_MESSAGE_SIZE + n}>, but this failed horribly because we have started using them differently all over the place: For example, the crypto API expects a particular buffer that was the first user, but people put all kinds of buffer in, so we can't "just" go around and correct every type piece by piece because there's not a single correct type for every place.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions