Skip to content

Optimize write_natural_field #14

@emersion

Description

@emersion

The next perf bottleneck is write_natural_field. I thought byte_sequence was used in memory images, but it turns out this is used instead:

type byte_pattern_element = maybe byte
type byte_pattern = list byte_pattern_element

(* An element might have an address/offset, and it has some contents. *)
type element = <| startpos : maybe natural
                ; length   : maybe natural
                ; contents : byte_pattern
                |>

Is there a reason why we use maybe byte instead of byte here?

Since element is used 140 times in the whole codebase, replacing it with something else is possible but definitely not trivial.

Metadata

Metadata

Assignees

No one assigned

    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