lucacorti / jsonapi_plug

JSON:API library for Plug and Phoenix applications
https://hexdocs.pm/jsonapi_plug
MIT License
11 stars 3 forks source link

Make links optional #53

Closed treere closed 6 months ago

treere commented 6 months ago

Using Benchee I run this

  test "bench" do
    conn =
      conn(:get, "/posts?include=author")
      |> Conn.assign(:data, [@default_data])
      |> Conn.assign(:meta, %{total_pages: 1})

    Benchee.run(%{"call" => fn -> MyPostPlug.call(conn, []) end}, time: 10, memory_time: 2)
  end

With links

Name           ips        average  deviation         median         99th %
call        7.53 K      132.73 μs    ±18.14%      122.57 μs      212.69 μs

Memory usage statistics:

Name    Memory usage
call        51.63 KB

Without links:

Name           ips        average  deviation         median         99th %
call       10.42 K       95.93 μs    ±18.39%       89.55 μs      164.67 μs

Memory usage statistics:

Name    Memory usage
call        42.19 KB