-
Notifications
You must be signed in to change notification settings - Fork 9
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
e8a4431
commit ba2b1d8
Showing
5 changed files
with
107 additions
and
173 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
IO.puts(""" | ||
This benchmark measures the performance of encoding rows in RowBinary format. | ||
""") | ||
|
||
alias Ch.RowBinary | ||
|
||
types = ["UInt64", "String", "Array(UInt8)", "DateTime"] | ||
|
||
rows = fn count -> | ||
Enum.map(1..count, fn i -> | ||
[i, "Golang SQL database driver", [1, 2, 3, 4, 5, 6, 7, 8, 9], DateTime.utc_now()] | ||
end) | ||
end | ||
|
||
Benchee.run( | ||
%{ | ||
"RowBinary" => fn rows -> RowBinary.encode_rows(rows, types) end, | ||
"RowBinary stream" => fn rows -> | ||
Stream.chunk_every(rows, 60_000) | ||
|> Stream.each(fn chunk -> RowBinary.encode_rows(chunk, types) end) | ||
|> Stream.run() | ||
end | ||
}, | ||
inputs: %{ | ||
"1_000_000 (UInt64, String, Array(UInt8), DateTime) rows" => rows.(1_000_000) | ||
} | ||
) |
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