bencheeorg / benchee_html

Draw pretty micro benchmarking charts in HTML and allow to export them as png for benchee
MIT License
58 stars 9 forks source link

(with Poison 2.2) ** (Poison.EncodeError) expected string or atom key, got: 50 #38

Closed PragTob closed 6 years ago

PragTob commented 6 years ago

Seems I finally found one of the differences of poison 3 vs. poison 2.

The problem is our new percentiles that have integers as keys in the maps:

iex(1)> Poison.encode! %{1 => "lol"}
** (Poison.EncodeError) expected string or atom key, got: 1
    (poison) lib/poison/encoder.ex:188: Poison.Encoder.Map.encode_name/1
    (poison) lib/poison/encoder.ex:212: anonymous fn/4 in Poison.Encoder.Map.encode/3
    (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
    (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
    (poison) lib/poison.ex:41: Poison.encode!/2

vs.

iex(1)> Poison.encode! %{1 => "lol"}
"{\"1\":\"lol\"}"

This should trigger in benchee_json, but right now this code is still inlined in benchee_html:

job_json = JSON.encode!(%{
        statistics: scenario.run_time_statistics,
        run_times: scenario.run_times
      })

We can't switch to a newer poison version as lots of people rely on Poison < 3 in some phoenix versions etc.

Mitigation:

devonestes commented 6 years ago

I think now that the benchee_json PR is merged, this can be closed, right?

PragTob commented 6 years ago

Yup should be! :)