@@ -14,7 +14,7 @@ import TestsUtils
14
14
import Foundation
15
15
16
16
public let ReduceInto = [
17
- BenchmarkInfo ( name: " FilterEvenUsingReduce " , runFunction: run_FilterEvenUsingReduce, tags: [ . validation, . api] ) ,
17
+ BenchmarkInfo ( name: " FilterEvenUsingReduce " , runFunction: run_FilterEvenUsingReduce, tags: [ . validation, . api] , legacyFactor : 10 ) ,
18
18
BenchmarkInfo ( name: " FilterEvenUsingReduceInto " , runFunction: run_FilterEvenUsingReduceInto, tags: [ . validation, . api] ) ,
19
19
BenchmarkInfo ( name: " FrequenciesUsingReduce " , runFunction: run_FrequenciesUsingReduce, tags: [ . validation, . api] ) ,
20
20
BenchmarkInfo ( name: " FrequenciesUsingReduceInto " , runFunction: run_FrequenciesUsingReduceInto, tags: [ . validation, . api] ) ,
@@ -27,7 +27,7 @@ public let ReduceInto = [
27
27
@inline ( never)
28
28
public func run_SumUsingReduce( _ N: Int ) {
29
29
let numbers = [ Int] ( 0 ..< 1000 )
30
-
30
+
31
31
var c = 0
32
32
for _ in 1 ... N*1000 {
33
33
c = c &+ numbers. reduce ( 0 ) { ( acc: Int , num: Int ) -> Int in
@@ -40,7 +40,7 @@ public func run_SumUsingReduce(_ N: Int) {
40
40
@inline ( never)
41
41
public func run_SumUsingReduceInto( _ N: Int ) {
42
42
let numbers = [ Int] ( 0 ..< 1000 )
43
-
43
+
44
44
var c = 0
45
45
for _ in 1 ... N*1000 {
46
46
c = c &+ numbers. reduce ( into: 0 ) { ( acc: inout Int , num: Int ) in
@@ -55,9 +55,9 @@ public func run_SumUsingReduceInto(_ N: Int) {
55
55
@inline ( never)
56
56
public func run_FilterEvenUsingReduce( _ N: Int ) {
57
57
let numbers = [ Int] ( 0 ..< 100 )
58
-
58
+
59
59
var c = 0
60
- for _ in 1 ... N*100 {
60
+ for _ in 1 ... N*10 {
61
61
let a = numbers. reduce ( [ ] ) { ( acc: [ Int ] , num: Int ) -> [ Int ] in
62
62
var a = acc
63
63
if num % 2 == 0 {
@@ -73,7 +73,7 @@ public func run_FilterEvenUsingReduce(_ N: Int) {
73
73
@inline ( never)
74
74
public func run_FilterEvenUsingReduceInto( _ N: Int ) {
75
75
let numbers = [ Int] ( 0 ..< 100 )
76
-
76
+
77
77
var c = 0
78
78
for _ in 1 ... N*100 {
79
79
let a = numbers. reduce ( into: [ ] ) { ( acc: inout [ Int ] , num: Int ) in
@@ -91,7 +91,7 @@ public func run_FilterEvenUsingReduceInto(_ N: Int) {
91
91
@inline ( never)
92
92
public func run_FrequenciesUsingReduce( _ N: Int ) {
93
93
let s = " thequickbrownfoxjumpsoverthelazydogusingasmanycharacteraspossible123456789 "
94
-
94
+
95
95
var c = 0
96
96
for _ in 1 ... N*100 {
97
97
let a = s. reduce ( [ : ] ) {
@@ -108,7 +108,7 @@ public func run_FrequenciesUsingReduce(_ N: Int) {
108
108
@inline ( never)
109
109
public func run_FrequenciesUsingReduceInto( _ N: Int ) {
110
110
let s = " thequickbrownfoxjumpsoverthelazydogusingasmanycharacteraspossible123456789 "
111
-
111
+
112
112
var c = 0
113
113
for _ in 1 ... N*100 {
114
114
let a = s. reduce ( into: [ : ] ) {
0 commit comments