(b *testing.B, size int)
| 1815 | func BenchmarkPoolBatchInsert10000(b *testing.B) { benchmarkPoolBatchInsert(b, 10000) } |
| 1816 | |
| 1817 | func benchmarkPoolBatchInsert(b *testing.B, size int) { |
| 1818 | // Generate a batch of transactions to enqueue into the pool |
| 1819 | pool, key := setupTxPool() |
| 1820 | defer pool.Stop() |
| 1821 | |
| 1822 | account, _ := deriveSender(transaction(0, 0, key)) |
| 1823 | pool.currentState.AddBalance(account, big.NewInt(1000000)) |
| 1824 | |
| 1825 | batches := make([]types.Transactions, b.N) |
| 1826 | for i := 0; i < b.N; i++ { |
| 1827 | batches[i] = make(types.Transactions, size) |
| 1828 | for j := 0; j < size; j++ { |
| 1829 | batches[i][j] = transaction(uint64(size*i+j), 100000, key) |
| 1830 | } |
| 1831 | } |
| 1832 | // Benchmark importing the transactions into the queue |
| 1833 | b.ResetTimer() |
| 1834 | for _, batch := range batches { |
| 1835 | pool.AddRemotes(batch) |
| 1836 | } |
| 1837 | } |
no test coverage detected