diff --git a/Benchmarks/Benchmarks/Cpp/CppBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppBenchmarks.swift new file mode 100644 index 00000000..145a1afe --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppBenchmarks.swift @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +extension Benchmark { + public mutating func addCppBenchmarks() { + cpp_set_hash_fn { value in value._rawHashValue(seed: 0) } + + self.addSimple( + title: "std::hash", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_hash(buffer.baseAddress, buffer.count) + } + } + + self.addSimple( + title: "custom_intptr_hash (using Swift.Hasher)", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_custom_hash(buffer.baseAddress, buffer.count) + } + } + + _addCppVectorBenchmarks() + _addCppDequeBenchmarks() + _addCppUnorderedSetBenchmarks() + _addCppUnorderedMapBenchmarks() + _addCppPriorityQueueBenchmarks() + _addCppVectorBoolBenchmarks() + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppDequeBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppDequeBenchmarks.swift new file mode 100644 index 00000000..12026b7c --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppDequeBenchmarks.swift @@ -0,0 +1,170 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppDeque { + var ptr: UnsafeMutableRawPointer? + + init(_ input: [Int]) { + self.ptr = input.withUnsafeBufferPointer { buffer in + cpp_deque_create(buffer.baseAddress, buffer.count) + } + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_deque_destroy(ptr) + } + ptr = nil + } +} + +extension Benchmark { + internal mutating func _addCppDequeBenchmarks() { + self.addSimple( + title: "std::deque push_back from integer range", + input: Int.self + ) { count in + cpp_deque_from_int_range(count) + } + + self.addSimple( + title: "std::deque constructor from buffer", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_deque_from_int_buffer(buffer.baseAddress, buffer.count) + } + } + + self.add( + title: "std::deque sequential iteration", + input: [Int].self + ) { input in + let deque = CppDeque(input) + return { timer in + cpp_deque_iterate(deque.ptr) + } + } + + self.add( + title: "std::deque random-access offset lookups (operator [])", + input: ([Int], [Int]).self + ) { input, lookups in + let vector = CppDeque(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_deque_lookups_subscript(vector.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::deque at, random offsets", + input: ([Int], [Int]).self + ) { input, lookups in + let deque = CppDeque(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_deque_lookups_at(deque.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.addSimple( + title: "std::deque push_back", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_deque_append_integers(buffer.baseAddress, buffer.count) + } + } + + self.addSimple( + title: "std::deque push_front", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_deque_prepend_integers(buffer.baseAddress, buffer.count) + } + } + + self.addSimple( + title: "std::deque random insertions", + input: Insertions.self + ) { insertions in + insertions.values.withUnsafeBufferPointer { buffer in + cpp_deque_random_insertions(buffer.baseAddress, buffer.count) + } + } + + self.add( + title: "std::deque pop_back", + input: Int.self + ) { size in + return { timer in + let deque = CppDeque(Array(0 ..< size)) + timer.measure { + cpp_deque_pop_back(deque.ptr) + } + deque.destroy() + } + } + + self.add( + title: "std::deque pop_front", + input: Int.self + ) { size in + return { timer in + let deque = CppDeque(Array(0 ..< size)) + timer.measure { + cpp_deque_pop_front(deque.ptr) + } + deque.destroy() + } + } + + self.add( + title: "std::deque random removals", + input: Insertions.self + ) { insertions in + let removals = Array(insertions.values.reversed()) + return { timer in + let deque = CppDeque(Array(0 ..< removals.count)) + timer.measure { + removals.withUnsafeBufferPointer { buffer in + cpp_deque_random_removals(deque.ptr, buffer.baseAddress, buffer.count) + } + } + deque.destroy() + } + } + + self.add( + title: "std::deque sort", + input: [Int].self + ) { input in + return { timer in + let deque = CppDeque(input) + timer.measure { + cpp_deque_sort(deque.ptr) + } + deque.destroy() + } + } + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppPriorityQueueBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppPriorityQueueBenchmarks.swift new file mode 100644 index 00000000..cd8d1012 --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppPriorityQueueBenchmarks.swift @@ -0,0 +1,96 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppPriorityQueue { + var ptr: UnsafeMutableRawPointer? + + init(_ input: [Int]) { + self.ptr = input.withUnsafeBufferPointer { buffer in + cpp_priority_queue_create(buffer.baseAddress, buffer.count) + } + } + + convenience init() { + self.init([]) + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_priority_queue_destroy(ptr) + } + ptr = nil + } + + func push(_ value: Int) { + cpp_priority_queue_push(ptr, value) + } + + func push(_ values: [Int]) { + values.withUnsafeBufferPointer { buffer in + cpp_priority_queue_push_loop(ptr, buffer.baseAddress, buffer.count) + } + } + + func pop() -> Int { + cpp_priority_queue_pop(ptr) + } + + func popAll() { + cpp_priority_queue_pop_all(ptr) + } +} + +extension Benchmark { + internal mutating func _addCppPriorityQueueBenchmarks() { + self.addSimple( + title: "std::priority_queue construct from buffer", + input: [Int].self + ) { input in + let pq = CppPriorityQueue(input) + blackHole(pq) + } + + self.add( + title: "std::priority_queue push", + input: [Int].self + ) { input in + return { timer in + let pq = CppPriorityQueue() + timer.measure { + pq.push(input) + } + blackHole(pq) + pq.destroy() + } + } + + self.add( + title: "std::priority_queue pop", + input: [Int].self + ) { input in + return { timer in + let pq = CppPriorityQueue(input) + timer.measure { + pq.popAll() + } + blackHole(pq) + pq.destroy() + } + } + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppUnorderedMapBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppUnorderedMapBenchmarks.swift new file mode 100644 index 00000000..bf1ccd9f --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppUnorderedMapBenchmarks.swift @@ -0,0 +1,153 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppUnorderedMap { + var ptr: UnsafeMutableRawPointer? + + init(_ input: [Int]) { + self.ptr = input.withUnsafeBufferPointer { buffer in + cpp_unordered_map_create(buffer.baseAddress, buffer.count) + } + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_unordered_map_destroy(ptr) + } + ptr = nil + } +} + +extension Benchmark { + internal mutating func _addCppUnorderedMapBenchmarks() { + self.addSimple( + title: "std::unordered_map insert from integer range", + input: Int.self + ) { count in + cpp_unordered_map_from_int_range(count) + } + + self.add( + title: "std::unordered_map sequential iteration", + input: [Int].self + ) { input in + let map = CppUnorderedMap(input) + return { timer in + cpp_unordered_map_iterate(map.ptr) + } + } + + self.add( + title: "std::unordered_map successful find", + input: ([Int], [Int]).self + ) { input, lookups in + let map = CppUnorderedMap(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_map_lookups(map.ptr, buffer.baseAddress, buffer.count, true) + } + } + } + + self.add( + title: "std::unordered_map unsuccessful find", + input: ([Int], [Int]).self + ) { input, lookups in + let map = CppUnorderedMap(input) + let lookups = lookups.map { $0 + input.count } + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_map_lookups(map.ptr, buffer.baseAddress, buffer.count, false) + } + } + } + + self.add( + title: "std::unordered_map subscript, existing key", + input: ([Int], [Int]).self + ) { input, lookups in + let map = CppUnorderedMap(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_map_subscript(map.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::unordered_map subscript, new key", + input: ([Int], [Int]).self + ) { input, lookups in + let map = CppUnorderedMap(input) + let lookups = lookups.map { $0 + input.count } + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_map_subscript(map.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.addSimple( + title: "std::unordered_map insert", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_unordered_map_insert_integers(buffer.baseAddress, buffer.count, false) + } + } + + self.addSimple( + title: "std::unordered_map insert, reserving capacity", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_unordered_map_insert_integers(buffer.baseAddress, buffer.count, true) + } + } + + self.add( + title: "std::unordered_map erase existing", + input: ([Int], [Int]).self + ) { input, removals in + return { timer in + let map = CppUnorderedMap(input) + timer.measure { + removals.withUnsafeBufferPointer { buffer in + cpp_unordered_map_removals(map.ptr, buffer.baseAddress, buffer.count) + } + } + map.destroy() + } + } + + self.add( + title: "std::unordered_map erase missing", + input: ([Int], [Int]).self + ) { input, removals in + return { timer in + let map = CppUnorderedMap(input.map { input.count + $0 }) + timer.measure { + removals.withUnsafeBufferPointer { buffer in + cpp_unordered_map_removals(map.ptr, buffer.baseAddress, buffer.count) + } + } + map.destroy() + } + } + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppUnorderedSetBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppUnorderedSetBenchmarks.swift new file mode 100644 index 00000000..5719e872 --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppUnorderedSetBenchmarks.swift @@ -0,0 +1,122 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppUnorderedSet { + var ptr: UnsafeMutableRawPointer? + + init(_ input: [Int]) { + self.ptr = input.withUnsafeBufferPointer { buffer in + cpp_unordered_set_create(buffer.baseAddress, buffer.count) + } + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_unordered_set_destroy(ptr) + } + ptr = nil + } +} + +extension Benchmark { + internal mutating func _addCppUnorderedSetBenchmarks() { + self.addSimple( + title: "std::unordered_set insert from integer range", + input: Int.self + ) { count in + cpp_unordered_set_from_int_range(count) + } + + self.addSimple( + title: "std::unordered_set constructor from buffer", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_unordered_set_from_int_buffer(buffer.baseAddress, buffer.count) + } + } + + self.add( + title: "std::unordered_set sequential iteration", + input: [Int].self + ) { input in + let set = CppUnorderedSet(input) + return { timer in + cpp_unordered_set_iterate(set.ptr) + } + } + + self.add( + title: "std::unordered_set successful find", + input: ([Int], [Int]).self + ) { input, lookups in + let set = CppUnorderedSet(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_set_lookups(set.ptr, buffer.baseAddress, buffer.count, true) + } + } + } + + self.add( + title: "std::unordered_set unsuccessful find", + input: ([Int], [Int]).self + ) { input, lookups in + let set = CppUnorderedSet(input) + let lookups = lookups.map { $0 + input.count } + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_unordered_set_lookups(set.ptr, buffer.baseAddress, buffer.count, false) + } + } + } + + self.addSimple( + title: "std::unordered_set insert", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_unordered_set_insert_integers(buffer.baseAddress, buffer.count, false) + } + } + + self.addSimple( + title: "std::unordered_set insert, reserving capacity", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_unordered_set_insert_integers(buffer.baseAddress, buffer.count, true) + } + } + + self.add( + title: "std::unordered_set erase", + input: ([Int], [Int]).self + ) { input, removals in + return { timer in + let set = CppUnorderedSet(input) + timer.measure { + removals.withUnsafeBufferPointer { buffer in + cpp_unordered_set_removals(set.ptr, buffer.baseAddress, buffer.count) + } + } + set.destroy() + } + } + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppVectorBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppVectorBenchmarks.swift new file mode 100644 index 00000000..c188d1ff --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppVectorBenchmarks.swift @@ -0,0 +1,188 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppVector { + var ptr: UnsafeMutableRawPointer? + + init(_ input: [Int]) { + self.ptr = input.withUnsafeBufferPointer { buffer in + cpp_vector_create(buffer.baseAddress, buffer.count) + } + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_vector_destroy(ptr) + } + ptr = nil + } +} + +extension Benchmark { + internal mutating func _addCppVectorBenchmarks() { + self.addSimple( + title: "std::vector push_back from integer range", + input: Int.self + ) { count in + cpp_vector_from_int_range(count) + } + + self.addSimple( + title: "std::vector constructor from buffer", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_vector_from_int_buffer(buffer.baseAddress, buffer.count) + } + } + + self.add( + title: "std::vector sequential iteration", + input: [Int].self + ) { input in + let vector = CppVector(input) + return { timer in + cpp_vector_iterate(vector.ptr) + } + } + + self.add( + title: "std::vector random-access offset lookups (operator [])", + input: ([Int], [Int]).self + ) { input, lookups in + let vector = CppVector(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_vector_lookups_subscript(vector.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::vector random-access offset lookups (at)", + input: ([Int], [Int]).self + ) { input, lookups in + let deque = CppVector(input) + return { timer in + lookups.withUnsafeBufferPointer { buffer in + cpp_vector_lookups_at(deque.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.addSimple( + title: "std::vector push_back", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_vector_append_integers(buffer.baseAddress, buffer.count, false) + } + } + + self.addSimple( + title: "std::vector push_back, reserving capacity", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_vector_append_integers(buffer.baseAddress, buffer.count, true) + } + } + + self.addSimple( + title: "std::vector insert at front", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_vector_prepend_integers(buffer.baseAddress, buffer.count, false) + } + } + + self.addSimple( + title: "std::vector insert at front, reserving capacity", + input: [Int].self + ) { input in + input.withUnsafeBufferPointer { buffer in + cpp_vector_prepend_integers(buffer.baseAddress, buffer.count, true) + } + } + + self.addSimple( + title: "std::vector random insertions", + input: Insertions.self + ) { insertions in + insertions.values.withUnsafeBufferPointer { buffer in + cpp_vector_random_insertions(buffer.baseAddress, buffer.count, false) + } + } + + self.add( + title: "std::vector pop_back", + input: Int.self + ) { size in + return { timer in + let vector = CppVector(Array(0 ..< size)) + timer.measure { + cpp_vector_pop_back(vector.ptr) + } + vector.destroy() + } + } + + self.add( + title: "std::vector erase first", + input: Int.self + ) { size in + return { timer in + let vector = CppVector(Array(0 ..< size)) + timer.measure { + cpp_vector_pop_front(vector.ptr) + } + vector.destroy() + } + } + + self.add( + title: "std::vector random removals", + input: Insertions.self + ) { insertions in + let removals = Array(insertions.values.reversed()) + return { timer in + let vector = CppVector(Array(0 ..< removals.count)) + timer.measure { + removals.withUnsafeBufferPointer { buffer in + cpp_vector_random_removals(vector.ptr, buffer.baseAddress, buffer.count) + } + } + vector.destroy() + } + } + + self.add( + title: "std::vector sort", + input: [Int].self + ) { input in + return { timer in + let vector = CppVector(input) + timer.measure { + cpp_vector_sort(vector.ptr) + } + vector.destroy() + } + } + } +} diff --git a/Benchmarks/Benchmarks/Cpp/CppVectorBoolBenchmarks.swift b/Benchmarks/Benchmarks/Cpp/CppVectorBoolBenchmarks.swift new file mode 100644 index 00000000..7c8afcca --- /dev/null +++ b/Benchmarks/Benchmarks/Cpp/CppVectorBoolBenchmarks.swift @@ -0,0 +1,237 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark +import CppBenchmarks + +internal class CppVectorBool { + var ptr: UnsafeMutableRawPointer? + + init(repeating value: Bool, count: Int) { + self.ptr = cpp_vector_bool_create_repeating(count, value) + } + + init(count: Int, trueBits: ArraySlice) { + self.ptr = cpp_vector_bool_create_repeating(count, false) + trueBits.withUnsafeBufferPointer { buffer in + cpp_vector_bool_set_indices_subscript( + self.ptr, + buffer.baseAddress, + buffer.count) + } + withExtendedLifetime(self) {} + } + + deinit { + destroy() + } + + func destroy() { + if let ptr = ptr { + cpp_vector_bool_destroy(ptr) + } + ptr = nil + } +} + +extension Array where Element == Bool { + init(count: Int, trueBits: S) where S.Element == Int { + self.init(repeating: false, count: count) + for index in trueBits { + self[index] = true + } + } +} + +extension Benchmark { + internal mutating func _addCppVectorBoolBenchmarks() { + self.addSimple( + title: "std::vector create from integer buffer (subscript)", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let v = CppVectorBool(repeating: false, count: input.count) + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_set_indices_subscript( + v.ptr, + buffer.baseAddress, + trueCount) + } + v.destroy() + } + + self.addSimple( + title: "std::vector create from integer buffer (at)", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let v = CppVectorBool(repeating: false, count: input.count) + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_set_indices_at( + v.ptr, + buffer.baseAddress, + trueCount) + } + v.destroy() + } + + self.add( + title: "std::vector const_iterator", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. find true bits", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. count true bits", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. random-access offset lookups (subscript)", + input: ([Int], [Int]).self + ) { input, lookups in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. random-access offset lookups (at)", + input: ([Int], [Int]).self + ) { input, lookups in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. set bits to true (subscript)", + input: [Int].self + ) { input in + let v = CppVectorBool(repeating: false, count: input.count) + return { timer in + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_set_indices_subscript(v.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::vector set bits to true (at)", + input: [Int].self + ) { input in + let v = CppVectorBool(repeating: false, count: input.count) + return { timer in + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_set_indices_at(v.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::vector set bits to false (subscript)", + input: [Int].self + ) { input in + let v = CppVectorBool(repeating: true, count: input.count) + return { timer in + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_reset_indices_subscript(v.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::vector set bits to false (at)", + input: [Int].self + ) { input in + let v = CppVectorBool(repeating: true, count: input.count) + return { timer in + input.withUnsafeBufferPointer { buffer in + cpp_vector_bool_reset_indices_at(v.ptr, buffer.baseAddress, buffer.count) + } + } + } + + self.add( + title: "std::vector push_back", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let bools = Array(count: input.count, trueBits: input[.. push_back, reserving capacity", + input: [Int].self + ) { input in + let trueCount = input.count / 2 + let bools = Array(count: input.count, trueBits: input[.. pop_back", + input: [Int].self + ) { input in + return { timer in + let trueCount = input.count / 2 + let v = CppVectorBool(count: input.count, trueBits: input[.. Int { - cpp_priority_queue_pop(ptr) - } - - func popAll() { - cpp_priority_queue_pop_all(ptr) - } -} - - -extension Benchmark { - public mutating func addCppBenchmarks() { - cpp_set_hash_fn { value in value._rawHashValue(seed: 0) } - - self.addSimple( - title: "std::hash", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_hash(buffer.baseAddress, buffer.count) - } - } - - self.addSimple( - title: "custom_intptr_hash (using Swift.Hasher)", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_custom_hash(buffer.baseAddress, buffer.count) - } - } - - self.addSimple( - title: "std::vector push_back from integer range", - input: Int.self - ) { count in - cpp_vector_from_int_range(count) - } - - self.addSimple( - title: "std::deque push_back from integer range", - input: Int.self - ) { count in - cpp_deque_from_int_range(count) - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::vector constructor from buffer", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_vector_from_int_buffer(buffer.baseAddress, buffer.count) - } - } - - self.addSimple( - title: "std::deque constructor from buffer", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_deque_from_int_buffer(buffer.baseAddress, buffer.count) - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector sequential iteration", - input: [Int].self - ) { input in - let vector = CppVector(input) - return { timer in - cpp_vector_iterate(vector.ptr) - } - } - - self.add( - title: "std::deque sequential iteration", - input: [Int].self - ) { input in - let deque = CppDeque(input) - return { timer in - cpp_deque_iterate(deque.ptr) - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector random-access offset lookups (operator [])", - input: ([Int], [Int]).self - ) { input, lookups in - let vector = CppVector(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_vector_lookups_subscript(vector.ptr, buffer.baseAddress, buffer.count) - } - } - } - - self.add( - title: "std::deque random-access offset lookups (operator [])", - input: ([Int], [Int]).self - ) { input, lookups in - let vector = CppDeque(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_deque_lookups_subscript(vector.ptr, buffer.baseAddress, buffer.count) - } - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector random-access offset lookups (at)", - input: ([Int], [Int]).self - ) { input, lookups in - let deque = CppVector(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_vector_lookups_at(deque.ptr, buffer.baseAddress, buffer.count) - } - } - } - - self.add( - title: "std::deque at, random offsets", - input: ([Int], [Int]).self - ) { input, lookups in - let deque = CppDeque(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_deque_lookups_at(deque.ptr, buffer.baseAddress, buffer.count) - } - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::vector push_back", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_vector_append_integers(buffer.baseAddress, buffer.count, false) - } - } - - self.addSimple( - title: "std::vector push_back, reserving capacity", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_vector_append_integers(buffer.baseAddress, buffer.count, true) - } - } - - self.addSimple( - title: "std::deque push_back", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_deque_append_integers(buffer.baseAddress, buffer.count) - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::vector insert at front", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_vector_prepend_integers(buffer.baseAddress, buffer.count, false) - } - } - - self.addSimple( - title: "std::vector insert at front, reserving capacity", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_vector_prepend_integers(buffer.baseAddress, buffer.count, true) - } - } - - self.addSimple( - title: "std::deque push_front", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_deque_prepend_integers(buffer.baseAddress, buffer.count) - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::vector random insertions", - input: Insertions.self - ) { insertions in - insertions.values.withUnsafeBufferPointer { buffer in - cpp_vector_random_insertions(buffer.baseAddress, buffer.count, false) - } - } - - self.addSimple( - title: "std::deque random insertions", - input: Insertions.self - ) { insertions in - insertions.values.withUnsafeBufferPointer { buffer in - cpp_deque_random_insertions(buffer.baseAddress, buffer.count) - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector pop_back", - input: Int.self - ) { size in - return { timer in - let vector = CppVector(Array(0 ..< size)) - timer.measure { - cpp_vector_pop_back(vector.ptr) - } - vector.destroy() - } - } - - self.add( - title: "std::deque pop_back", - input: Int.self - ) { size in - return { timer in - let deque = CppDeque(Array(0 ..< size)) - timer.measure { - cpp_deque_pop_back(deque.ptr) - } - deque.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector erase first", - input: Int.self - ) { size in - return { timer in - let vector = CppVector(Array(0 ..< size)) - timer.measure { - cpp_vector_pop_front(vector.ptr) - } - vector.destroy() - } - } - - self.add( - title: "std::deque pop_front", - input: Int.self - ) { size in - return { timer in - let deque = CppDeque(Array(0 ..< size)) - timer.measure { - cpp_deque_pop_front(deque.ptr) - } - deque.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector random removals", - input: Insertions.self - ) { insertions in - let removals = Array(insertions.values.reversed()) - return { timer in - let vector = CppVector(Array(0 ..< removals.count)) - timer.measure { - removals.withUnsafeBufferPointer { buffer in - cpp_vector_random_removals(vector.ptr, buffer.baseAddress, buffer.count) - } - } - vector.destroy() - } - } - - self.add( - title: "std::deque random removals", - input: Insertions.self - ) { insertions in - let removals = Array(insertions.values.reversed()) - return { timer in - let deque = CppDeque(Array(0 ..< removals.count)) - timer.measure { - removals.withUnsafeBufferPointer { buffer in - cpp_deque_random_removals(deque.ptr, buffer.baseAddress, buffer.count) - } - } - deque.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.add( - title: "std::vector sort", - input: [Int].self - ) { input in - return { timer in - let vector = CppVector(input) - timer.measure { - cpp_vector_sort(vector.ptr) - } - vector.destroy() - } - } - - self.add( - title: "std::deque sort", - input: [Int].self - ) { input in - return { timer in - let deque = CppDeque(input) - timer.measure { - cpp_deque_sort(deque.ptr) - } - deque.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::unordered_set insert from integer range", - input: Int.self - ) { count in - cpp_unordered_set_from_int_range(count) - } - - self.addSimple( - title: "std::unordered_set constructor from buffer", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_unordered_set_from_int_buffer(buffer.baseAddress, buffer.count) - } - } - - self.add( - title: "std::unordered_set sequential iteration", - input: [Int].self - ) { input in - let set = CppUnorderedSet(input) - return { timer in - cpp_unordered_set_iterate(set.ptr) - } - } - - self.add( - title: "std::unordered_set successful find", - input: ([Int], [Int]).self - ) { input, lookups in - let set = CppUnorderedSet(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_set_lookups(set.ptr, buffer.baseAddress, buffer.count, true) - } - } - } - - self.add( - title: "std::unordered_set unsuccessful find", - input: ([Int], [Int]).self - ) { input, lookups in - let set = CppUnorderedSet(input) - let lookups = lookups.map { $0 + input.count } - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_set_lookups(set.ptr, buffer.baseAddress, buffer.count, false) - } - } - } - - self.addSimple( - title: "std::unordered_set insert", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_unordered_set_insert_integers(buffer.baseAddress, buffer.count, false) - } - } - - self.addSimple( - title: "std::unordered_set insert, reserving capacity", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_unordered_set_insert_integers(buffer.baseAddress, buffer.count, true) - } - } - - self.add( - title: "std::unordered_set erase", - input: ([Int], [Int]).self - ) { input, removals in - return { timer in - let set = CppUnorderedSet(input) - timer.measure { - removals.withUnsafeBufferPointer { buffer in - cpp_unordered_set_removals(set.ptr, buffer.baseAddress, buffer.count) - } - } - set.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::unordered_map insert from integer range", - input: Int.self - ) { count in - cpp_unordered_map_from_int_range(count) - } - - self.add( - title: "std::unordered_map sequential iteration", - input: [Int].self - ) { input in - let set = CppUnorderedMap(input) - return { timer in - cpp_unordered_map_iterate(set.ptr) - } - } - - self.add( - title: "std::unordered_map successful find", - input: ([Int], [Int]).self - ) { input, lookups in - let map = CppUnorderedMap(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_map_lookups(map.ptr, buffer.baseAddress, buffer.count, true) - } - } - } - - self.add( - title: "std::unordered_map unsuccessful find", - input: ([Int], [Int]).self - ) { input, lookups in - let map = CppUnorderedMap(input) - let lookups = lookups.map { $0 + input.count } - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_map_lookups(map.ptr, buffer.baseAddress, buffer.count, false) - } - } - } - - self.add( - title: "std::unordered_map subscript, existing key", - input: ([Int], [Int]).self - ) { input, lookups in - let map = CppUnorderedMap(input) - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_map_subscript(map.ptr, buffer.baseAddress, buffer.count) - } - } - } - - self.add( - title: "std::unordered_map subscript, new key", - input: ([Int], [Int]).self - ) { input, lookups in - let map = CppUnorderedMap(input) - let lookups = lookups.map { $0 + input.count } - return { timer in - lookups.withUnsafeBufferPointer { buffer in - cpp_unordered_map_subscript(map.ptr, buffer.baseAddress, buffer.count) - } - } - } - - self.addSimple( - title: "std::unordered_map insert", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_unordered_map_insert_integers(buffer.baseAddress, buffer.count, false) - } - } - - self.addSimple( - title: "std::unordered_map insert, reserving capacity", - input: [Int].self - ) { input in - input.withUnsafeBufferPointer { buffer in - cpp_unordered_map_insert_integers(buffer.baseAddress, buffer.count, true) - } - } - - self.add( - title: "std::unordered_map erase existing", - input: ([Int], [Int]).self - ) { input, removals in - return { timer in - let map = CppUnorderedMap(input) - timer.measure { - removals.withUnsafeBufferPointer { buffer in - cpp_unordered_map_removals(map.ptr, buffer.baseAddress, buffer.count) - } - } - map.destroy() - } - } - - self.add( - title: "std::unordered_map erase missing", - input: ([Int], [Int]).self - ) { input, removals in - return { timer in - let map = CppUnorderedMap(input.map { input.count + $0 }) - timer.measure { - removals.withUnsafeBufferPointer { buffer in - cpp_unordered_map_removals(map.ptr, buffer.baseAddress, buffer.count) - } - } - map.destroy() - } - } - - //-------------------------------------------------------------------------- - - self.addSimple( - title: "std::priority_queue construct from buffer", - input: [Int].self - ) { input in - let pq = CppPriorityQueue(input) - blackHole(pq) - } - - self.add( - title: "std::priority_queue push", - input: [Int].self - ) { input in - return { timer in - let pq = CppPriorityQueue() - timer.measure { - pq.push(input) - } - blackHole(pq) - pq.destroy() - } - } - - self.add( - title: "std::priority_queue pop", - input: [Int].self - ) { input in - return { timer in - let pq = CppPriorityQueue(input) - timer.measure { - pq.popAll() - } - blackHole(pq) - pq.destroy() - } - } - } -} diff --git a/Benchmarks/Benchmarks/FoundationBenchmarks.swift b/Benchmarks/Benchmarks/Foundation/CFBinaryHeapBenchmarks.swift similarity index 98% rename from Benchmarks/Benchmarks/FoundationBenchmarks.swift rename to Benchmarks/Benchmarks/Foundation/CFBinaryHeapBenchmarks.swift index 0f950c65..5f7bde4a 100644 --- a/Benchmarks/Benchmarks/FoundationBenchmarks.swift +++ b/Benchmarks/Benchmarks/Foundation/CFBinaryHeapBenchmarks.swift @@ -37,7 +37,7 @@ extension CFBinaryHeap { #endif extension Benchmark { - public mutating func addFoundationBenchmarks() { + internal mutating func _addCFBinaryHeapBenchmarks() { self.add( title: "CFBinaryHeapAddValue", input: [Int].self diff --git a/Benchmarks/Benchmarks/Foundation/CFBitVectorBenchmarks.swift b/Benchmarks/Benchmarks/Foundation/CFBitVectorBenchmarks.swift new file mode 100644 index 00000000..bea983fa --- /dev/null +++ b/Benchmarks/Benchmarks/Foundation/CFBitVectorBenchmarks.swift @@ -0,0 +1,161 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 CollectionsBenchmark + +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +import Foundation + +extension CFMutableBitVector { + static func _create( + count: Int, + trueBits: S + ) -> CFMutableBitVector where S.Element == Int { + let bits = CFBitVectorCreateMutable(nil, count)! + CFBitVectorSetCount(bits, count) + for index in trueBits { + CFBitVectorSetBitAtIndex(bits, index, 1) + } + return bits + } +} +#endif + +extension Benchmark { + internal mutating func _addCFBitVectorBenchmarks() { + self.add( + title: "CFBitVector create from integer buffer", + input: [Int].self + ) { input in +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) + return { timer in + let trueCount = input.count / 2 + let bits = CFMutableBitVector._create( + count: input.count, + trueBits: input[.. +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// Create a `std::vector` of the specified size, filling it with the +/// given value. Returns an opaque pointer to the created instance. +extern void *cpp_vector_bool_create_repeating(size_t count, bool value); + +/// Destroy a vector previously returned by `cpp_vector_bool_create`. +extern void cpp_vector_bool_destroy(void *ptr); + +extern void cpp_vector_bool_push_back(const bool *start, size_t count, bool reserve); + +extern void cpp_vector_bool_pop_back(void *ptr, size_t count); + +/// Set bits indexed by a buffer of integers to true, using the unchecked subscript. +extern void cpp_vector_bool_set_indices_subscript(void *ptr, const intptr_t *start, size_t count); + +/// Set bits indexed by a buffer of integers to true, using the checked `at` method. +extern void cpp_vector_bool_set_indices_at(void *ptr, const intptr_t *start, size_t count); + +/// Set bits indexed by a buffer of integers to false, using the unchecked subscript. +extern void cpp_vector_bool_reset_indices_subscript(void *ptr, const intptr_t *start, size_t count); + +/// Set bits indexed by a buffer of integers to false, using the checked `at` method. +extern void cpp_vector_bool_reset_indices_at(void *ptr, const intptr_t *start, size_t count); + +/// Retrieve all bits indexed by a buffer of integers, using the unchecked subscript. +extern void cpp_vector_bool_lookups_subscript(void *ptr, const intptr_t *start, size_t count); + +/// Retrieve all bits indexed by a buffer of integers, using the checked `at` method. +extern void cpp_vector_bool_lookups_at(void *ptr, const intptr_t *start, size_t count); + +/// Iterate through all the bits in a `vector`. +extern void cpp_vector_bool_iterate(void *ptr); + +/// Use `std::find` to visit every true bit in a `vector`, returning +/// the number of true bits found. +extern size_t cpp_vector_bool_find_true_bits(void *ptr); + +/// Use `std::count` to return a count of every true bit in a `vector`. +extern size_t cpp_vector_bool_count_true_bits(void *ptr); + +#ifdef __cplusplus +} +#endif + + +#endif /* CPPBENCHMARKS_VECTOR_BOOL_BENCHMARKS_H */ diff --git a/Benchmarks/CppBenchmarks/include/module.modulemap b/Benchmarks/CppBenchmarks/include/module.modulemap index 7fbcf933..82844245 100644 --- a/Benchmarks/CppBenchmarks/include/module.modulemap +++ b/Benchmarks/CppBenchmarks/include/module.modulemap @@ -6,5 +6,6 @@ module CppBenchmarks { header "UnorderedSetBenchmarks.h" header "UnorderedMapBenchmarks.h" header "PriorityQueueBenchmarks.h" + header "VectorBoolBenchmarks.h" export * } diff --git a/Benchmarks/CppBenchmarks/src/VectorBoolBenchmarks.cpp b/Benchmarks/CppBenchmarks/src/VectorBoolBenchmarks.cpp new file mode 100644 index 00000000..29cc320a --- /dev/null +++ b/Benchmarks/CppBenchmarks/src/VectorBoolBenchmarks.cpp @@ -0,0 +1,147 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections 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 +// +//===----------------------------------------------------------------------===// + +#include +#include +#include "VectorBoolBenchmarks.h" +#include "Utils.h" + +void * +cpp_vector_bool_create_repeating(size_t count, bool value) +{ + auto v = new std::vector(count, value); + return v; +} + +void +cpp_vector_bool_destroy(void *ptr) +{ + delete static_cast *>(ptr); +} + +void +cpp_vector_bool_push_back(const bool *start, size_t count, bool reserve) +{ + auto v = std::vector(); + + if (reserve) { + v.reserve(v.size() + count); + } + + for (auto p = start; p < start + count; ++p) { + v.push_back(*p); + } + + black_hole(&v); +} + +void +cpp_vector_bool_pop_back(void *ptr, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (size_t i = 0; i < count; ++i) { + v.pop_back(); + } +} + +void +cpp_vector_bool_set_indices_subscript(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + v[*p] = true; + } +} + +void +cpp_vector_bool_set_indices_at(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + v.at(*p) = true; + } +} + +void +cpp_vector_bool_reset_indices_subscript(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + v[*p] = false; + } +} + +void +cpp_vector_bool_reset_indices_at(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + v.at(*p) = false; + } +} + +void +cpp_vector_bool_lookups_subscript(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + black_hole(v[*p]); + } +} + +void +cpp_vector_bool_lookups_at(void *ptr, const intptr_t *start, size_t count) +{ + auto &v = *static_cast *>(ptr); + + for (auto p = start; p < start + count; ++p) { + black_hole(v.at(*p)); + } +} + +void +cpp_vector_bool_iterate(void *ptr) +{ + auto &v = *static_cast *>(ptr); + + for (auto it = v.cbegin(); it != v.cend(); ++it) { + black_hole(*it); + } +} + +size_t +cpp_vector_bool_find_true_bits(void *ptr) +{ + auto &v = *static_cast *>(ptr); + + size_t count = 0; + for (auto it = std::find(v.cbegin(), v.cend(), true); + it != v.cend(); + it = std::find(it, v.cend(), true)) { + ++count; + ++it; + } + return count; +} + +size_t +cpp_vector_bool_count_true_bits(void *ptr) +{ + auto &v = *static_cast *>(ptr); + + return std::count(v.cbegin(), v.cend(), true); +} diff --git a/Benchmarks/Libraries/BitSet.json b/Benchmarks/Libraries/BitSet.json new file mode 100644 index 00000000..900631a5 --- /dev/null +++ b/Benchmarks/Libraries/BitSet.json @@ -0,0 +1,78 @@ +{ + "kind": "group", + "title": "Bitset Benchmarks", + "directory": "Results", + "contents": [ + { + "kind": "group", + "title": "BitSet Operations", + "contents": [ + ] + }, + { + "kind": "group", + "title": "BitArray Operations", + "contents": [ + ] + }, + { + "kind": "group", + "title": "Comparisons against reference implementations", + "directory": "versus", + "contents": [ + { + "kind": "chart", + "title": "initializers", + "tasks": [ + "std::vector create from integer buffer (subscript)", + "std::vector create from integer buffer (at)", + "CFBitVector create from integer buffer" + ] + }, + { + "kind": "chart", + "title": "sequential iteration", + "tasks": [ + "std::vector const_iterator", + "CFBitVectorGetBitAtIndex (sequential iteration)" + ] + }, + { + "kind": "chart", + "title": "random-access lookups", + "tasks": [ + "std::vector random-access offset lookups (subscript)", + "std::vector random-access offset lookups (at)", + "CFBitVectorGetBitAtIndex (random-access lookups)" + ] + }, + { + "kind": "chart", + "title": "set random bits to true", + "tasks": [ + "std::vector set bits to true (subscript)", + "std::vector set bits to true (at)", + "CFBitVectorSetBitAtIndex (random-access set)" + ] + }, + { + "kind": "chart", + "title": "find true bits", + "tasks": [ + "std::vector find true bits", + "CFBitVectorGetFirstIndexOfBit" + ] + }, + { + "kind": "chart", + "title": "count true bits", + "tasks": [ + "std::vector count true bits", + "CFBitVectorGetCountOfBit" + ] + }, + ] + } + ] + +}