Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

FacPowErr Rustler tests

fac_pow_err/rustler-test.livemd

FacPowErr Rustler tests

Section

:observer.start()
before = :os.system_time(:millisecond)
FacPowErr.Utils.factorial(2_000_000_000)
after_time = :os.system_time(:millisecond)
duration = after_time - before
Enum.map(1..50, fn x ->
  spawn(fn ->
    before = :os.system_time(:millisecond)
    # fac = Enum.random(2000000000..10000000000)
    fac = Enum.random(2_000_000_000..2_000_099_999)
    FacPowErr.Utils.factorial(fac)
    after_time = :os.system_time(:millisecond)

    duration =
      (after_time - before)
      |> IO.inspect(label: "req number: #{x} fac: #{fac}")
  end)
end)
Enum.map(1..10, fn x ->
  spawn(fn ->
    before = :os.system_time(:millisecond)
    FacPowErr.Utils.raise_error()
    after_time = :os.system_time(:millisecond)

    duration =
      (after_time - before)
      |> IO.inspect(label: "req number: #{x}")
  end)
end)

:timer.sleep(1000)

2 + 2