Skip to content

Super efficient way of embedding files or binary data in OCaml executables #21

@kayceesrk

Description

@kayceesrk
  • There is ocaml-crunch that takes files, splits them into chunks, generates a source OCaml module with an API. It's not super efficient: files have to be parsed at compile time, and recomposed when accessed. Room for improvement, don't generate OCaml code including the data to be embedded.

  • Idea: implement that with magic from the compiler, Dune, or cppo. Make files available as Bytes, in a module created at compile time.

  • C23 will have an #embed preprocessor directive (under the hood, it's the linker's job). No parsing of data, available as a static const array of bytes. Checkout how Rust or Golang are doing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions