Skip to content

Commit bd75358

Browse files
authored
fix to_string typo in benchmark (#9)
* fix to_string typo * Also fix typo in the records of benchmarking results
1 parent 4da192a commit bd75358

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

bench.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SQL.Repo.start_link()
99
range = 1..10_000
1010
Benchee.run(
1111
%{
12-
"to_stirng" => fn -> for _ <- range, do: to_string(~SQL[with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)]) end,
12+
"to_string" => fn -> for _ <- range, do: to_string(~SQL[with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)]) end,
1313
"to_sql" => fn -> for _ <- range, do: SQL.to_sql(~SQL[with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)]) end,
1414
"inspect" => fn -> for _ <- range, do: inspect(~SQL[with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)]) end,
1515
"ecto" => fn -> for _ <- range, do: SQL.Repo.to_sql(:all, "temp" |> recursive_ctes(true) |> with_cte("temp", as: ^union_all(select("temp", [t], %{n: 0, fact: 1}), ^where(select("temp", [t], [t.n+1, t.n+1*t.fact]), [t], t.n < 9))) |> select([t], [t.n])) end

benchmarks/v0.1.0.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ Estimated total run time: 42 s
1818

1919
Benchmarking inspect ...
2020
Benchmarking to_sql ...
21-
Benchmarking to_stirng ...
21+
Benchmarking to_string ...
2222
Calculating statistics...
2323
Formatting results...
2424

2525
Name ips average deviation median 99th %
26-
to_stirng 1.40 713.82 ms ±2.01% 711.52 ms 742.02 ms
26+
to_string 1.40 713.82 ms ±2.01% 711.52 ms 742.02 ms
2727
to_sql 1.37 729.90 ms ±1.90% 733.32 ms 749.88 ms
2828
inspect 1.35 742.32 ms ±1.93% 745.09 ms 764.21 ms
2929

3030
Comparison:
31-
to_stirng 1.40
31+
to_string 1.40
3232
to_sql 1.37 - 1.02x slower +16.08 ms
3333
inspect 1.35 - 1.04x slower +28.50 ms
3434

3535
Memory usage statistics:
3636

3737
Name Memory usage
38-
to_stirng 1.02 GB
38+
to_string 1.02 GB
3939
to_sql 1.02 GB - 1.00x memory usage -0.00025 GB
4040
inspect 1.02 GB - 1.01x memory usage +0.00515 GB
4141

benchmarks/v0.2.0.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ Estimated total run time: 56 s
2121
Benchmarking Ecto.Repo.to_sql ...
2222
Benchmarking inspect ...
2323
Benchmarking to_sql ...
24-
Benchmarking to_stirng ...
24+
Benchmarking to_string ...
2525
Calculating statistics...
2626
Formatting results...
2727

2828
Name ips average deviation median 99th %
2929
to_sql 4.74 K 0.21 ms ±20.20% 0.20 ms 0.32 ms
30-
to_stirng 4.51 K 0.22 ms ±3.60% 0.22 ms 0.26 ms
30+
to_string 4.51 K 0.22 ms ±3.60% 0.22 ms 0.26 ms
3131
inspect 0.24 K 4.09 ms ±2.96% 4.09 ms 4.36 ms
3232
Ecto.Repo.to_sql 0.00757 K 132.03 ms ±1.45% 131.80 ms 139.43 ms
3333

3434
Comparison:
3535
to_sql 4.74 K
36-
to_stirng 4.51 K - 1.05x slower +0.0108 ms
36+
to_string 4.51 K - 1.05x slower +0.0108 ms
3737
inspect 0.24 K - 19.39x slower +3.88 ms
3838
Ecto.Repo.to_sql 0.00757 K - 626.20x slower +131.82 ms
3939

4040
Memory usage statistics:
4141

4242
Name Memory usage
4343
to_sql 0.38 MB
44-
to_stirng 0.153 MB - 0.40x memory usage -0.22888 MB
44+
to_string 0.153 MB - 0.40x memory usage -0.22888 MB
4545
inspect 4.88 MB - 12.80x memory usage +4.50 MB
4646
Ecto.Repo.to_sql 179.35 MB - 470.13x memory usage +178.97 MB
4747

@@ -70,26 +70,26 @@ Estimated total run time: 56 s
7070
Benchmarking ecto ...
7171
Benchmarking inspect ...
7272
Benchmarking to_sql ...
73-
Benchmarking to_stirng ...
73+
Benchmarking to_string ...
7474
Calculating statistics...
7575
Formatting results...
7676

7777
Name ips average deviation median 99th %
78-
to_stirng 27.59 36.24 ms ±0.75% 36.22 ms 37.21 ms
78+
to_string 27.59 36.24 ms ±0.75% 36.22 ms 37.21 ms
7979
to_sql 27.45 36.42 ms ±0.47% 36.39 ms 36.93 ms
8080
inspect 24.53 40.76 ms ±1.07% 40.75 ms 41.60 ms
8181
ecto 6.96 143.65 ms ±1.37% 143.36 ms 148.62 ms
8282

8383
Comparison:
84-
to_stirng 27.59
84+
to_string 27.59
8585
to_sql 27.45 - 1.00x slower +0.181 ms
8686
inspect 24.53 - 1.12x slower +4.52 ms
8787
ecto 6.96 - 3.96x slower +107.41 ms
8888

8989
Memory usage statistics:
9090

9191
Name Memory usage
92-
to_stirng 4.50 MB
92+
to_string 4.50 MB
9393
to_sql 4.73 MB - 1.05x memory usage +0.23 MB
9494
inspect 9.23 MB - 2.05x memory usage +4.73 MB
9595
ecto 202.87 MB - 45.11x memory usage +198.37 MB

0 commit comments

Comments
 (0)