IvanR

IvanR

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()}
end

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:

Most Liked

mudasobwa

mudasobwa

Creator of Cure

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
    end
  end
end

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

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New

We're in Beta

About us Mission Statement