Looking for codebases having lots of structs (to measure custom compiler times)

Folks, I’ve made a Domo library adding new/1 constructor function to a struct that automatically checks conformance to the struct’s type.

The library includes the custom compiler that works right after Elixir in the chain to prepare pattern matchings.

Library usage looks like the following:

defmodule Foo do
  use Domo
  defstruct [:title]
  @type t :: %__MODULE__{title: String.t()}

Foo.new(title: :hello)
** (ArgumentError) the following values should have types defined for fields of the Foo struct:
 * Invalid value :hello for field :title of %Foo{}. Expected the value matching the <<_::_*8>> type.

I’m looking for the codebases with lots of structs to check the compilation times without/with use Domo in structures via the following command.
mix deps.compile && mix clean && time mix compile

Can you, please, share if you know one or two open-source projects that has as many structs with defined @type t() as possible?

P.S. Is it an absurd idea to ask you to test on a proprietary codebase? Please, DM if you can do such a measurement; I can send concrete steps in reply :grinning_face_with_smiling_eyes:

I would go with a single file defining thousands of structs. Somewhat alongside the following lines.

defmodule Structs do
  for i <- 1..1000, name = Module.concat(["S#{i}"]) do
    defmodule name do
      defstruct foo: 42

That way nothing else would affect the benchmark, all the code is at fingers etc.


Thanks, it seems like a property-based test and works for a synthetic check :smile:

Same time, I’m curious about production targeted codebases because it gives the most interesting combinations of structs and types.