Avoid reallocation in emit_bit #40

Closed
opened 2024-07-02 13:56:06 +00:00 by Gregor Weiss · 0 comments
Collaborator

We could spare the reallocation in emit_bit if the stream is guaranteed to have the correct size. The only usage of emit_bit is taking the header variable in create_packet of tier2. The memory of header is initially allocated to PACKET_HEADER_SIZE=512.

A test that used two times the PACKET_HEADER_SIZE could avoid reallocation in emit_bit.

Generally, PACKET_HEADER_SIZE is variable and would have to be calculated to avoid dynamic reallocation.

How could we do such a calculation?

We could spare the reallocation in `emit_bit` if the `stream` is guaranteed to have the correct size. The only usage of `emit_bit` is taking the `header` variable in `create_packet` of tier2. The `memory` of `header` is initially allocated to PACKET_HEADER_SIZE=512. A test that used two times the `PACKET_HEADER_SIZE` could avoid reallocation in `emit_bit`. Generally, `PACKET_HEADER_SIZE` is variable and would have to be calculated to avoid dynamic reallocation. How could we do such a calculation?
Gregor Weiss added this to the Maintainbarkeit project 2024-07-02 13:56:06 +00:00
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TOPIO/BigWhoop#40
No description provided.