Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ forfun_target_config(
forfun_target_config(
forfun_lock_free
HEADERS
"forfun/concurrency/spsc_bound_queue.hpp"
"forfun/concurrency/swmr_append_buffer.hpp"
SOURCES
"forfun/concurrency/spsc_bound_queue.cpp"
"forfun/concurrency/swmr_append_buffer.cpp"
)

forfun_target_config(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ leveraged by this project:
- EditorConfig
- Markdown
- Diagramming with Mermaid
- Lock-free and wait-free algorithms
- Lock-free and wait-free algorithms and data structure

## Index

Expand Down Expand Up @@ -121,7 +121,7 @@ leveraged by this project:
| Valid Anagram | [`include/forfun/valid_anagram.hpp`](include/forfun/valid_anagram.hpp) |
| Valid Parentheses | [`src/forfun/valid_parentheses.cpp`](src/forfun/valid_parentheses.cpp) |
| Valid Sudoku | [`include/forfun/valid_sudoku.hpp`](include/forfun/valid_sudoku.hpp) |
| Wait-free (lock-free) SPSC append-only bounded queue | [`include/forfun/concurrency/spsc_bound_queue.hpp`](include/forfun/concurrency/spsc_bound_queue.hpp) |
| Wait-free (lock-free) SWMR append buffer | [`include/forfun/concurrency/swmr_append_buffer.hpp`](include/forfun/concurrency/swmr_append_buffer.hpp) |

## Disclaimer

Expand Down
92 changes: 0 additions & 92 deletions benchmark/concurrency/spsc_bound_queue_benchmark.cpp

This file was deleted.

100 changes: 100 additions & 0 deletions benchmark/concurrency/swmr_append_buffer_benchmark.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Copyright (c) Omar Boukli-Hacene. All rights reserved.
// Distributed under an MIT-style license that can be
// found in the LICENSE file.

// SPDX-License-Identifier: MIT

#include <cstddef>
#include <new>

#include <catch2/catch_test_macros.hpp>

#include <nameof.hpp>

#include <nanobench.h>

#include <forfun/concurrency/swmr_append_buffer.hpp>

TEST_CASE("SWMR append buffer benchmarking", "[benchmark][swmr_append_buffer]")
{
using namespace forfun::concurrency;

static constexpr std::size_t const capacity{16};

ankerl::nanobench::Bench()

.title("SWMR append buffer")
.relative(true)

.run(
NAMEOF_RAW(
wait_free::swmr_append_buffer<
int,
capacity,
std::hardware_destructive_interference_size>{}
)
.c_str(),
[] noexcept -> void {
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
int volatile val /*[[indeterminate]]*/;

wait_free::swmr_append_buffer<
int,
capacity,
std::hardware_destructive_interference_size>
buffer{};

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

buffer.emplace_back(502807);
val = buffer.to_span().back();

ankerl::nanobench::doNotOptimizeAway(&val);
}
)

;
}
2 changes: 1 addition & 1 deletion cmake/BenchmarkTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ forfun_target_config(
SOURCES_DIR "benchmark"
SOURCES
"benchmark.cpp"
"concurrency/spsc_bound_queue_benchmark.cpp"
"concurrency/swmr_append_buffer_benchmark.cpp"
)
target_link_libraries(
benchmark_driver_lock_free
Expand Down
4 changes: 2 additions & 2 deletions cmake/TestTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ forfun_target_config(
"common/concepts_statictest.cpp"
"common/limits_statictest.cpp"
"common/type_traits_statictest.cpp"
"concurrency/spsc_bound_queue_statictest.cpp"
"concurrency/swmr_append_buffer_statictest.cpp"
"container/forward_list_cycle_statictest.cpp"
"container/forward_list_statictest.cpp"
"container/internal/list_const_iterator_statictest.cpp"
Expand Down Expand Up @@ -199,7 +199,7 @@ forfun_target_config(
test_driver_lock_free
SOURCES_DIR "test"
SOURCES
"concurrency/spsc_bound_queue_test.cpp"
"concurrency/swmr_append_buffer_test.cpp"
)
target_link_libraries(
test_driver_lock_free
Expand Down
2 changes: 1 addition & 1 deletion docs/problem_alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ benchmarks.
| List Bidirectional Iterator |
| Primality Test |
| Tower of Hanoi |
| Wait-free (lock-free) SPSC append-only bounded queue |
| Wait-free (lock-free) SWMR append buffer |

### LeetCode problems

Expand Down
Loading
Loading