Skip to content

Commit 00650f8

Browse files
committed
Update benchmark results
1 parent a875109 commit 00650f8

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ A blazing fast JSON parser and generator in pure Elixir.
44

55
The parser and generator are at least twice as fast as other Elixir/Erlang libraries
66
(most notably `Poison`).
7-
The performance is comparable to `jiffy` - usually only twice as slow.
8-
When compiled with HiPE both parser and generator outperform even `jiffy` - usually
9-
by about 30%.
7+
The performance is comparable to `jiffy`, which is implemented in C as a NIF.
8+
Jason is usually only twice as slow.
109

1110
Both parser and generator fully conform to
1211
[RFC 8259](https://tools.ietf.org/html/rfc8259) and
@@ -109,9 +108,11 @@ forward "/api",
109108

110109
## Benchmarks
111110

112-
Detailed comparison with jiffy in various situations: https://gist.github.com/michalmuskala/29112611873bdb2bd7d87e3351aa639a
111+
Detailed benchmarks (including memory measurements):
112+
https://gist.github.com/michalmuskala/4d64a5a7696ca84ac7c169a0206640d5
113113

114-
Comparison with other Elixir and Erlang libraries: http://michal.muskala.eu/jason/decode.html and http://michal.muskala.eu/jason/encode.html
114+
HTML reports for the benchmark (only performance measurements):
115+
http://michal.muskala.eu/jason/decode.html and http://michal.muskala.eu/jason/encode.html
115116

116117
### Running
117118

bench/decode.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ decode_jobs = %{
66
"jsone" => fn {json, _} -> :jsone.decode(json) end,
77
"jiffy" => fn {json, _} -> :jiffy.decode(json, [:return_maps, :use_nil]) end,
88
"JSON" => fn {json, _} -> JSON.decode!(json) end,
9-
"binary_to_term/1" => fn {_, etf} -> :erlang.binary_to_term(etf) end,
9+
# "binary_to_term/1" => fn {_, etf} -> :erlang.binary_to_term(etf) end,
1010
}
1111

1212
decode_inputs = [
@@ -38,9 +38,10 @@ end
3838
inputs = for name <- decode_inputs, into: %{}, do: {name, read_data.(name)}
3939

4040
Benchee.run(decode_jobs,
41-
parallel: 4,
41+
# parallel: 4,
4242
warmup: 5,
4343
time: 30,
44+
memory_time: 1,
4445
inputs: inputs,
4546
formatters: [
4647
&Benchee.Formatters.HTML.output/1,

bench/encode.exs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ encode_jobs = %{
77
"jsone" => &:jsone.encode/1,
88
"jiffy" => &:jiffy.encode/1,
99
"JSON" => &JSON.encode!/1,
10-
"term_to_binary" => &:erlang.term_to_binary/1,
10+
# "term_to_binary" => &:erlang.term_to_binary/1,
1111
}
1212

1313
encode_inputs = [
@@ -33,13 +33,14 @@ end
3333

3434

3535
Benchee.run(encode_jobs,
36-
parallel: 4,
36+
# parallel: 4,
3737
warmup: 5,
3838
time: 30,
39+
memory_time: 1,
3940
inputs: for name <- encode_inputs, into: %{} do
4041
name
4142
|> read_data.()
42-
|> Poison.decode!
43+
|> Jason.decode!()
4344
|> (&{name, &1}).()
4445
end,
4546
formatters: [

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ defmodule Jason.Mixfile do
3030
[
3131
{:decimal, "~> 1.0", optional: true},
3232
{:benchee, "~> 0.8", only: :bench},
33-
{:benchee_html, "~> 0.1", only: :bench},
33+
{:benchee_html, "~> 0.1", only: :bench, github: "michalmuskala/benchee_html"},
3434
{:poison, "~> 3.0", only: :bench},
3535
{:exjsx, "~> 4.0", only: :bench},
3636
{:tiny, "~> 1.0", only: :bench},
3737
{:jsone, "~> 1.4", only: :bench},
3838
{:jiffy, "~> 0.14", only: :bench},
3939
{:json, "~> 1.0", only: :bench},
4040
{:dialyxir, "~> 0.5", only: [:dev, :test], runtime: false},
41-
{:ex_doc, "~> 0.18", only: :docs}
41+
{:ex_doc, "~> 0.18", only: :docs},
4242
] ++ maybe_stream_data()
4343
end
4444

mix.lock

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
%{
22
"benchee": {:hex, :benchee, "0.13.1", "bd93ca05be78bcb6159c7176230efeda2f724f7ffd485515175ca411dff4893e", [:mix], [{:deep_merge, "~> 0.1", [hex: :deep_merge, repo: "hexpm", optional: false]}], "hexpm"},
3-
"benchee_html": {:hex, :benchee_html, "0.5.0", "1354ba8005f979c177561fe08b83cafbae43f3046e8a6cf209132b8967b6db17", [:mix], [{:benchee, "~> 0.12", [hex: :benchee, repo: "hexpm", optional: false]}, {:benchee_json, "~> 0.5", [hex: :benchee_json, repo: "hexpm", optional: false]}], "hexpm"},
4-
"benchee_json": {:hex, :benchee_json, "0.5.0", "75878fd9944093ced03e9c214e6e1429da147de43e2f4a4cbc4377294ed5d029", [:mix], [{:benchee, "~> 0.12", [hex: :benchee, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
3+
"benchee_html": {:git, "https://github.com/michalmuskala/benchee_html.git", "e3f60b891b115dd599c9387637e4c36cc0269d7d", []},
54
"decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm"},
65
"deep_merge": {:hex, :deep_merge, "0.1.1", "c27866a7524a337b6a039eeb8dd4f17d458fd40fbbcb8c54661b71a22fffe846", [:mix], [], "hexpm"},
76
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
87
"earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"},
9-
"elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], [], "hexpm"},
108
"ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
119
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
12-
"jason": {:hex, :jason, "1.0.1", "ef108e64c6e086364b9f15b0073cf794061670af8f331d545d7308c0ba2e67f9", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
1310
"jiffy": {:hex, :jiffy, "0.15.2", "de266c390111fd4ea28b9302f0bc3d7472468f3b8e0aceabfbefa26d08cd73b7", [:rebar3], [], "hexpm"},
14-
"json": {:hex, :json, "1.2.5", "3682c18c6b07480df2122d0daf5c05457b42c1990f197ce3de53884e8ba834c4", [:mix], [{:benchee, "~> 0.8", [hex: :benchee, repo: "hexpm", optional: true]}, {:benchee_html, "~> 0.1", [hex: :benchee_html, repo: "hexpm", optional: true]}, {:exjsx, "~> 4.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:jsone, "~> 1.4", [hex: :jsone, repo: "hexpm", optional: true]}, {:poison, "~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:tiny, "~> 1.0", [hex: :tiny, repo: "hexpm", optional: true]}], "hexpm"},
11+
"json": {:hex, :json, "1.0.3", "547d58dbbd864c0a560c0ca3789ee8848974e8c517cdb7827c3303e3b42e754d", [:mix], [], "hexpm"},
1512
"jsone": {:hex, :jsone, "1.4.6", "644d6d57befb22c8e19b324dee19d73b1c004565009861a8f64c68b7b9e64dbf", [:rebar3], [], "hexpm"},
1613
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"},
1714
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},

0 commit comments

Comments
 (0)