-
Notifications
You must be signed in to change notification settings - Fork 446
/
Copy pathmain.swift
30 lines (25 loc) · 896 Bytes
/
main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
//
// Copyright (c) 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
import Foundation
import Algorithms
import CollectionsBenchmark
/// Benchmarks `.intersperse` from Swift Algorithms for Array<Int> sequences.
func benchmarkInterspersed() {
var benchmark = Benchmark(title: "Interspersed Benchmark")
benchmark.addSimple(
title: "Array<Int> interspersed",
input: Array<Int>.self
) { input in
blackHole(input.interspersed(with: 9))
}
benchmark.main()
}
print(benchmarkInterspersed())