Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
81bdbcb
implement something for fast_io deque
trcrsired Jan 19, 2026
71697ee
[skip ci] deque fixes the compilation issues
trcrsired Jan 19, 2026
cd20789
[skip ci] the insert still has logic bugs
trcrsired Jan 19, 2026
d0105a5
deque insertation deal with back
trcrsired Jan 21, 2026
b405c0e
add deque insert fuzzing
trcrsired Jan 21, 2026
df7c6ab
[skip ci] deque iterator +, -, +=, -=, [] etc should take a fast path
trcrsired Jan 22, 2026
62e10ff
[skip ci] reimplement deque's iterator random access operations
trcrsired Jan 22, 2026
9d2c073
deque add benchmarks for indexing
trcrsired Jan 22, 2026
c35b71f
deque should not shadow variables
trcrsired Jan 22, 2026
456049a
add a test to test sorting of deque iterators to ensure deque's iterator
trcrsired Jan 23, 2026
cf0ef98
deque's clone method contains bug which should be fromcontrollerwq
trcrsired Jan 23, 2026
610e45b
deque add a sorting benchmark
trcrsired Jan 23, 2026
3594322
deque iterator test for deque should just use copy. and use clang-for…
trcrsired Jan 23, 2026
8be93d0
deque fix the insertation size part not entire insertation
trcrsired Jan 24, 2026
8fbc2da
deque should not move +n if it is the same block
trcrsired Jan 24, 2026
f4cc414
[skip ci] backup deque code for boundary conditions for insert
trcrsired Jan 26, 2026
008ba44
[skip ci] have figured out where the bug is
trcrsired Jan 26, 2026
e3cc7f6
[skip ci] deque insert balancing with extra blocks
trcrsired Jan 27, 2026
dca8e83
[skip ci] trying to merge deque_reserve_back_blocks_impl into deque_g…
trcrsired Jan 27, 2026
2ee58aa
[deque] try to merge insert code with push and then run code
trcrsired Jan 27, 2026
a059ac3
[skip ci] the implementation is still buggy, let's use the old one first
trcrsired Jan 27, 2026
3e8a7f1
[deque] deque push_back try to reuse the code from insertation
trcrsired Jan 27, 2026
0c61d4f
[skip ci] implement push_front with nb function to allow insert at begin
trcrsired Jan 28, 2026
13debbf
[skip] backup deque code
trcrsired Jan 28, 2026
af0181f
front_backspaces should prevent end() goes before begin()
trcrsired Jan 29, 2026
9f29758
add allocate_conditional_zero to win32_heapalloc as example for future
trcrsired Jan 29, 2026
74a83d7
[skip ci] deque add a toggle for switching to new implementation
trcrsired Jan 29, 2026
3907d9a
back_backspace may also go too far
trcrsired Jan 29, 2026
41f5858
[skip ci] deque insert implementing front decision
trcrsired Jan 29, 2026
5e6ee56
deque removes all old push back/front code but just using insert
trcrsired Jan 29, 2026
eab427f
deque add insert benchmark.
trcrsired Jan 29, 2026
8428d07
[skip ci] std not fast_io in deque insert_range bench
trcrsired Jan 29, 2026
75c14e4
uninitialized algos add hooks
trcrsired Jan 30, 2026
c4df109
Merge remote-tracking branch 'refs/remotes/origin/next' into next
trcrsired Jan 30, 2026
1f36a6f
[skip ci] backup type code for algo since it may be useless
trcrsired Jan 30, 2026
602df4b
[deque] add hooks to freestanding algos
trcrsired Jan 30, 2026
f2d302b
[deque] use copy_backward and copy should work for deque
trcrsired Feb 2, 2026
db7e9a7
[deque] add hooks for uninitialized_relocate_backward
trcrsired Feb 3, 2026
cccb282
[deque] implement relocate for all types
trcrsired Feb 3, 2026
ec94df7
avoid invoking ~ for uninitialized_copy_n since msvc would complain
trcrsired Feb 3, 2026
6d003fe
remove unused variable for startpos
trcrsired Feb 3, 2026
8fbbc43
.test_prop
trcrsired Feb 3, 2026
84763e7
update module to it compiles successfully on wasm
trcrsired Feb 9, 2026
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
2 changes: 2 additions & 0 deletions benchmark/0011.containers/deque/.test_prop.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
["0003.insert_range"]
ignore = true
33 changes: 33 additions & 0 deletions benchmark/0011.containers/deque/0003.insert_range/fast_io.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/deque.h>
#include <cstddef>

int main()
{
fast_io::timer tm(u8"fast_io::deque");
fast_io::deque<std::size_t> dq;
constexpr std::size_t n{50000};

{
fast_io::timer t(u8"insert_range_index");
for (std::size_t i{}; i != n; ++i)
{
::std::size_t dqsz{dq.size()};
std::size_t pos = dqsz ? (i % dqsz) : 0;
std::size_t tmp[4]{i, i + 1, i + 2, i + 3};
dq.insert_range_index(pos, tmp);
}
}

std::size_t sum{};
{
fast_io::timer t(u8"loop");
for (auto const e : dq)
{
sum += e;
}
}

fast_io::io::perrln("sum=", sum);
}
33 changes: 33 additions & 0 deletions benchmark/0011.containers/deque/0003.insert_range/std.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <deque>
#include <cstddef>

int main()
{
fast_io::timer tm(u8"std::deque");
::std::deque<std::size_t> dq;
constexpr std::size_t n{50000};

{
fast_io::timer t(u8"insert_range");
for (std::size_t i{}; i != n; ++i)
{
::std::size_t dqsz{dq.size()};
std::size_t pos = dqsz ? (i % dqsz) : 0;
std::size_t tmp[4]{i, i + 1, i + 2, i + 3};
dq.insert_range(dq.cbegin() + pos, tmp);
}
}

std::size_t sum{};
{
fast_io::timer t(u8"loop");
for (auto const e : dq)
{
sum += e;
}
}

fast_io::io::perrln("sum=", sum);
}
26 changes: 26 additions & 0 deletions benchmark/0011.containers/deque/0005.indexing/fast_io.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/deque.h>

int main()
{
::fast_io::timer tm(u8"fast_io::deque");
::fast_io::deque<std::size_t> deq;
constexpr std::size_t n{100000000};
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(i);
}
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"indexing loop");
for (::std::size_t i{}, sz{deq.size()}; i != sz; ++i)
{
sum += deq[i];
}
}
::fast_io::io::perrln("sum=", sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/deque.h>

int main()
{
::fast_io::timer tm(u8"fast_io::deque unchecked");
::fast_io::deque<std::size_t> deq;
constexpr std::size_t n{100000000};
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(i);
}
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"indexing unchecked loop");
for (::std::size_t i{}, sz{deq.size()}; i != sz; ++i)
{
sum += deq.index_unchecked(i);
}
}
::fast_io::io::perrln("sum=", sum);
}
26 changes: 26 additions & 0 deletions benchmark/0011.containers/deque/0005.indexing/fast_io_vec.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/vector.h>

int main()
{
::fast_io::timer tm(u8"fast_io::vector");
::fast_io::vector<std::size_t> vec;
constexpr std::size_t n{100000000};
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
vec.push_back(i);
}
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"indexing loop");
for (::std::size_t i{}, sz{vec.size()}; i != sz; ++i)
{
sum += vec[i];
}
}
::fast_io::io::perrln("sum=", sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/vector.h>

int main()
{
::fast_io::timer tm(u8"fast_io::vector reserve");
::fast_io::vector<std::size_t> vec;
constexpr std::size_t n{100000000};
vec.reserve(n);
{
fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
vec.push_back(i);
}
}
::std::size_t sum{};
{
fast_io::timer tm1(u8"indexing loop");
for (::std::size_t i{}, sz{vec.size()}; i != sz; ++i)
{
sum += vec[i];
}
}
::fast_io::io::perrln("sum=", sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/vector.h>

int main()
{
::fast_io::timer tm(u8"fast_io::vector unchecked");
::fast_io::vector<std::size_t> vec;
constexpr std::size_t n{100000000};
vec.reserve(n);
{
fast_io::timer tm1(u8"push_back_unchecked");
for (std::size_t i{}; i != n; ++i)
{
vec.push_back_unchecked(i);
}
}
::std::size_t sum{};
{
fast_io::timer tm1(u8"indexing unchecked loop");
for (::std::size_t i{}, sz{vec.size()}; i != sz; ++i)
{
sum += vec.index_unchecked(i);
}
}
::fast_io::io::perrln("sum=", sum);
}
26 changes: 26 additions & 0 deletions benchmark/0011.containers/deque/0005.indexing/std.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <deque>

int main()
{
fast_io::timer tm(u8"std::deque");
::std::deque<std::size_t> deq;
constexpr std::size_t n{100000000};
{
fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(i);
}
}
::std::size_t sum{};
{
fast_io::timer tm1(u8"indexing loop");
for (::std::size_t i{}, sz{deq.size()}; i != sz; ++i)
{
sum += deq[i];
}
}
::fast_io::io::perrln("sum=", sum);
}
35 changes: 35 additions & 0 deletions benchmark/0011.containers/deque/0006.sort/fast_io.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/deque.h>
#include <algorithm>
#include <random>

int main()
{
constexpr std::size_t n{1000000};
::std::mt19937_64 eng;
::std::uniform_int_distribution<::std::size_t> dis(0, SIZE_MAX);

::fast_io::timer tm(u8"fast_io::deque");
::fast_io::deque<std::size_t> deq;
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(dis(eng));
}
}
{
::fast_io::timer tm1(u8"sort");
::std::ranges::sort(deq);
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"loop");
for (auto const &e : deq)
{
sum += e;
}
}
::fast_io::io::perrln("sum=", sum);
}
35 changes: 35 additions & 0 deletions benchmark/0011.containers/deque/0006.sort/fast_io_vec.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <fast_io_dsal/vector.h>
#include <algorithm>
#include <random>

int main()
{
constexpr std::size_t n{1000000};
::std::mt19937_64 eng;
::std::uniform_int_distribution<::std::size_t> dis(0, SIZE_MAX);

::fast_io::timer tm(u8"fast_io::vector");
::fast_io::vector<std::size_t> deq;
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(dis(eng));
}
}
{
::fast_io::timer tm1(u8"sort");
::std::ranges::sort(deq);
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"loop");
for (auto const &e : deq)
{
sum += e;
}
}
::fast_io::io::perrln("sum=", sum);
}
35 changes: 35 additions & 0 deletions benchmark/0011.containers/deque/0006.sort/std.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <fast_io.h>
#include <fast_io_driver/timer.h>
#include <deque>
#include <algorithm>
#include <random>

int main()
{
constexpr std::size_t n{1000000};
::std::mt19937_64 eng;
::std::uniform_int_distribution<::std::size_t> dis(0, SIZE_MAX);

::fast_io::timer tm(u8"std::deque");
::std::deque<std::size_t> deq;
{
::fast_io::timer tm1(u8"push_back");
for (std::size_t i{}; i != n; ++i)
{
deq.push_back(dis(eng));
}
}
{
::fast_io::timer tm1(u8"sort");
::std::ranges::sort(deq);
}
::std::size_t sum{};
{
::fast_io::timer tm1(u8"loop");
for (auto const &e : deq)
{
sum += e;
}
}
::fast_io::io::perrln("sum=", sum);
}
Loading