-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dfdf63
commit 5194aa0
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[ | ||
inputs: [ | ||
"{mix,.formatter}.exs", | ||
"{config,lib,test}/**/*.{ex,exs}" | ||
"{config,bench,lib,test}/**/*.{ex,exs}" | ||
], | ||
line_length: 88 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
sql = """ | ||
with recursive cte(i) as ( | ||
values(0) | ||
union all | ||
select i + 1 from cte where i < ? | ||
) | ||
select 'hello' || i from cte | ||
""" | ||
|
||
alias Exqlite.Sqlite3 | ||
|
||
Benchee.run( | ||
%{"fetch_all" => fn %{conn: conn, stmt: stmt} -> Sqlite3.fetch_all(conn, stmt) end}, | ||
inputs: %{ | ||
"10 rows" => 10, | ||
"100 rows" => 100, | ||
"1000 rows" => 1000, | ||
"10000 rows" => 10000 | ||
}, | ||
before_scenario: fn rows -> | ||
{:ok, conn} = Sqlite3.open(":memory:", [:readonly, :nomutex]) | ||
{:ok, stmt} = Sqlite3.prepare(conn, sql) | ||
Sqlite3.bind(conn, stmt, [rows]) | ||
%{conn: conn, stmt: stmt} | ||
end, | ||
after_scenario: fn %{conn: conn, stmt: stmt} -> | ||
Sqlite3.release(conn, stmt) | ||
Sqlite3.close(conn) | ||
end | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters