forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 0
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
e05e8b9
commit b7aadf2
Showing
12 changed files
with
124 additions
and
43 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
Binary file added
BIN
+747 KB
apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.benchee
Binary file not shown.
60 changes: 60 additions & 0 deletions
60
apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.exs
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,60 @@ | ||
path = "benchmarks/explorer/chain/recent_collated_transactions.benchee" | ||
|
||
import Explorer.Factory | ||
|
||
alias Explorer.{Chain, Repo} | ||
alias Explorer.Chain.Block | ||
|
||
Benchee.run( | ||
%{ | ||
"Explorer.Chain.recent_collated_transactions" => fn _ -> | ||
Chain.recent_collated_transactions() | ||
end | ||
}, | ||
inputs: %{ | ||
" 0 blocks 0 transactions per block" => %{block_count: 0, transaction_count_per_block: 0}, | ||
" 10 blocks 0 transactions per block" => %{block_count: 10, transaction_count_per_block: 0}, | ||
" 10 blocks 1 transaction per block" => %{block_count: 10, transaction_count_per_block: 1}, | ||
" 10 blocks 10 transactions per blocks" => %{block_count: 10, transaction_count_per_block: 10}, | ||
" 10 blocks 100 transactions per blocks" => %{block_count: 10, transaction_count_per_block: 100}, | ||
" 10 blocks 250 transactions per blocks" => %{block_count: 10, transaction_count_per_block: 250}, | ||
" 100 blocks 0 transactions per block" => %{block_count: 100, transaction_count_per_block: 0}, | ||
" 100 blocks 1 transaction per block" => %{block_count: 100, transaction_count_per_block: 1}, | ||
" 100 blocks 10 transactions per blocks" => %{block_count: 100, transaction_count_per_block: 10}, | ||
" 100 blocks 100 transactions per blocks" => %{block_count: 100, transaction_count_per_block: 100}, | ||
" 100 blocks 250 transactions per blocks" => %{block_count: 100, transaction_count_per_block: 250}, | ||
"1000 blocks 0 transactions per block" => %{block_count: 1000, transaction_count_per_block: 0}, | ||
"1000 blocks 1 transaction per block" => %{block_count: 1000, transaction_count_per_block: 1}, | ||
"1000 blocks 10 transactions per blocks" => %{block_count: 1000, transaction_count_per_block: 10}, | ||
"1000 blocks 100 transactions per blocks" => %{block_count: 1000, transaction_count_per_block: 100} | ||
}, | ||
before_scenario: fn %{block_count: block_count, transaction_count_per_block: transaction_count_per_block} = input -> | ||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo, ownership_timeout: :infinity) | ||
|
||
# ensure database is clean from failed runs | ||
0 = Repo.aggregate(Block, :count, :hash) | ||
|
||
block_count | ||
|> insert_list(:block) | ||
|> Enum.each(fn block -> | ||
transaction_count_per_block | ||
|> insert_list(:transaction) | ||
|> Enum.each(fn transaction -> | ||
transaction | ||
|> with_block(block) | ||
|> with_receipt() | ||
end) | ||
end) | ||
|
||
input | ||
end, | ||
formatter_options: %{ | ||
console: %{extended_statistics: true} | ||
}, | ||
load: path, | ||
save: [ | ||
path: path, | ||
tag: "separate-receipts" | ||
], | ||
time: 10 | ||
) |
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
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 was deleted.
Oops, something went wrong.
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