2727#include < seastar/core/chunked_fifo.hh>
2828#include < seastar/core/circular_buffer.hh>
2929#include < seastar/util/split-list.hh>
30+ #include < seastar/core/chunked_fifo.hh>
3031#include < seastar/testing/random.hh>
3132
3233using trivial_elem = int ;
@@ -262,6 +263,8 @@ class sum_perf {
262263 using split_list = seastar::internal::split_list<element, 16 , &element::sl_next>;
263264 split_list _split_list_16;
264265
266+ seastar::chunked_fifo<element*, 128 > _chunked_fifo;
267+
265268public:
266269 void init_once (unsigned nr) {
267270 if (_elements.size () != 0 ) {
@@ -286,11 +289,13 @@ class sum_perf {
286289
287290 // Finally -- populate collections
288291 _array_of_pointers.reserve (nr);
292+ _chunked_fifo.reserve (nr);
289293 for (unsigned i = 0 ; i < nr; i++) {
290294 element* e = &_elements[idx[i]];
291295 _array_of_pointers.push_back (e);
292296 _singly_linked_list.push_back (*e);
293297 _split_list_16.push_back (e);
298+ _chunked_fifo.push_back (e);
294299 }
295300 }
296301
@@ -332,6 +337,14 @@ class sum_perf {
332337 return ret;
333338 }
334339
340+ uint64_t sum_fifo () const noexcept {
341+ uint64_t ret = 0 ;
342+ for (auto i = _chunked_fifo.begin (); i != _chunked_fifo.end (); i++) {
343+ ret += (*i)->value ;
344+ }
345+ return ret;
346+ }
347+
335348 template <unsigned N, uint64_t (sum_perf::*Fn)() const noexcept >
336349 auto do_test () {
337350 init_once (N);
@@ -442,3 +455,28 @@ PERF_TEST_F(sum_perf, sum_sl16_100000) {
442455PERF_TEST_F (sum_perf, sum_sl16_1000000) {
443456 return sum_perf::do_test<1000000 , &sum_perf::sum_sl16>();
444457}
458+
459+ // Chunked fifo
460+ PERF_TEST_F (sum_perf, sum_fifo_10) {
461+ return sum_perf::do_test<10 , &sum_perf::sum_fifo>();
462+ }
463+
464+ PERF_TEST_F (sum_perf, sum_fifo_100) {
465+ return sum_perf::do_test<100 , &sum_perf::sum_fifo>();
466+ }
467+
468+ PERF_TEST_F (sum_perf, sum_fifo_1000) {
469+ return sum_perf::do_test<1000 , &sum_perf::sum_fifo>();
470+ }
471+
472+ PERF_TEST_F (sum_perf, sum_fifo_10000) {
473+ return sum_perf::do_test<10000 , &sum_perf::sum_fifo>();
474+ }
475+
476+ PERF_TEST_F (sum_perf, sum_fifo_100000) {
477+ return sum_perf::do_test<100000 , &sum_perf::sum_fifo>();
478+ }
479+
480+ PERF_TEST_F (sum_perf, sum_fifo_1000000) {
481+ return sum_perf::do_test<1000000 , &sum_perf::sum_fifo>();
482+ }
0 commit comments