Skip to content

Commit 7871466

Browse files
committed
Reduce number of write operations in bit writer benchmarks
1 parent e0a2844 commit 7871466

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Tests/BitByteDataBenchmarks/LsbBitWriterBenchmarks.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LsbBitWriterBenchmarks: XCTestCase {
1212
self.measure {
1313
let bitWriter = LsbBitWriter()
1414

15-
for _ in 0..<5_000_000 * 4 {
15+
for _ in 0..<4_000_000 {
1616
bitWriter.write(bit: 0)
1717
bitWriter.write(bit: 1)
1818
}
@@ -23,7 +23,7 @@ class LsbBitWriterBenchmarks: XCTestCase {
2323
self.measure {
2424
let bitWriter = LsbBitWriter()
2525

26-
for _ in 0..<5_000_000 {
26+
for _ in 0..<1_000_000 {
2727
bitWriter.write(number: 55, bitsCount: 7)
2828
}
2929
}
@@ -33,7 +33,7 @@ class LsbBitWriterBenchmarks: XCTestCase {
3333
self.measure {
3434
let bitWriter = LsbBitWriter()
3535

36-
for _ in 0..<5_000_000 {
36+
for _ in 0..<1_000_000 {
3737
bitWriter.append(byte: 37)
3838
}
3939
}

Tests/BitByteDataBenchmarks/MsbBitWriterBenchmarks.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class MsbBitWriterBenchmarks: XCTestCase {
1212
self.measure {
1313
let bitWriter = MsbBitWriter()
1414

15-
for _ in 0..<5_000_000 * 4 {
15+
for _ in 0..<4_000_000 {
1616
bitWriter.write(bit: 0)
1717
bitWriter.write(bit: 1)
1818
}
@@ -23,7 +23,7 @@ class MsbBitWriterBenchmarks: XCTestCase {
2323
self.measure {
2424
let bitWriter = MsbBitWriter()
2525

26-
for _ in 0..<5_000_000 {
26+
for _ in 0..<1_000_000 {
2727
bitWriter.write(number: 55, bitsCount: 7)
2828
}
2929
}
@@ -33,7 +33,7 @@ class MsbBitWriterBenchmarks: XCTestCase {
3333
self.measure {
3434
let bitWriter = MsbBitWriter()
3535

36-
for _ in 0..<5_000_000 {
36+
for _ in 0..<1_000_000 {
3737
bitWriter.append(byte: 37)
3838
}
3939
}

0 commit comments

Comments
 (0)