Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr #4

Merged
merged 58 commits into from
Sep 25, 2024
Merged

pr #4

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
52b4561
Merge pull request #2 from cppfastio/next
havedifficultyinfindingnames Aug 22, 2024
f50fad4
Merge pull request #817 from trcrsired/master
trcrsired Aug 24, 2024
af8e988
Merge pull request #818 from trcrsired/master
trcrsired Aug 24, 2024
8d2a736
Merge pull request #819 from trcrsired/master
trcrsired Aug 24, 2024
a0db5f4
Merge pull request #820 from trcrsired/master
trcrsired Aug 27, 2024
0fdd553
Merge pull request #821 from trcrsired/master
trcrsired Aug 27, 2024
857a8e0
Merge branch 'next' of github.com:havedifficultyinfindingnames/fast_i…
havedifficultyinfindingnames Aug 29, 2024
32f989f
fix compile bug using msvc
havedifficultyinfindingnames Aug 29, 2024
a20b847
Merge pull request #823 from havedifficultyinfindingnames/next
havedifficultyinfindingnames Aug 29, 2024
9c71dd0
Merge pull request #824 from trcrsired/master
trcrsired Sep 14, 2024
378ec86
Merge pull request #825 from trcrsired/master
trcrsired Sep 14, 2024
ea6310b
Merge pull request #827 from trcrsired/master
trcrsired Sep 17, 2024
0fd39cf
Merge pull request #829 from trcrsired/master
trcrsired Sep 18, 2024
b6bd828
Merge pull request #830 from trcrsired/master
trcrsired Sep 18, 2024
8ef33c9
Merge pull request #4 from cppfastio/next
havedifficultyinfindingnames Sep 20, 2024
c419cfd
add template keyword for function specialization
havedifficultyinfindingnames Sep 20, 2024
7790ce6
Merge branch 'next' of github.com:havedifficultyinfindingnames/fast_i…
havedifficultyinfindingnames Sep 20, 2024
c082d8f
Merge pull request #831 from havedifficultyinfindingnames/next
havedifficultyinfindingnames Sep 20, 2024
181b99d
operations::defines, not define
havedifficultyinfindingnames Sep 20, 2024
50351d5
Merge pull request #832 from havedifficultyinfindingnames/next
havedifficultyinfindingnames Sep 20, 2024
cb2a3d3
ordinal
havedifficultyinfindingnames Sep 21, 2024
cbf7278
Merge pull request #835 from havedifficultyinfindingnames/next
havedifficultyinfindingnames Sep 21, 2024
f3b53a8
make use of print_freestanding_okay
havedifficultyinfindingnames Sep 21, 2024
022f957
Merge remote-tracking branch 'parent/next'
trcrsired Sep 21, 2024
fc814c1
initial attempt to fix libc++
trcrsired Sep 21, 2024
5f0db0c
fix libc++
trcrsired Sep 21, 2024
e67297f
Merge pull request #837 from trcrsired/master
trcrsired Sep 21, 2024
5da8455
Merge pull request #836 from havedifficultyinfindingnames/next
trcrsired Sep 21, 2024
a735c6e
add clang-format off comment in io.h
trcrsired Sep 21, 2024
4bd04dd
Merge pull request #838 from trcrsired/master
trcrsired Sep 21, 2024
a78fd36
replace concat with concat_std since we have too many concat function…
trcrsired Sep 21, 2024
6ff460b
deprecated concat
trcrsired Sep 21, 2024
22aa0fc
fix example
trcrsired Sep 21, 2024
4193cf9
conat vs format
trcrsired Sep 21, 2024
19586ba
add u32concat bench
trcrsired Sep 21, 2024
32b7af2
use memcpy for string move
trcrsired Sep 21, 2024
c699d04
add string push_back benchmark
trcrsired Sep 21, 2024
f77c09a
Add benchmark push_back test
trcrsired Sep 21, 2024
1f5ff99
Merge pull request #839 from trcrsired/master
trcrsired Sep 21, 2024
3721fff
middle string test
trcrsired Sep 22, 2024
42b1375
Merge pull request #840 from trcrsired/master
trcrsired Sep 22, 2024
f5000d6
add custom implementation for freestanding
trcrsired Sep 22, 2024
54ab784
chore(.gitignore): add compile_commands.json
ShelpAm Sep 22, 2024
3e6a956
feat: implement part of forward_list
ShelpAm Sep 22, 2024
a5d4d43
add uninitialized_copy
trcrsired Sep 22, 2024
3f61945
remove sso implementation for string. only allow "sso" for empty string
trcrsired Sep 22, 2024
2476c9b
reallocate_at_least not reallocate_at_least_zero for adapters
trcrsired Sep 22, 2024
64e2963
fix warnings for ci
trcrsired Sep 22, 2024
22573c4
fix reallocate_at_least for string
trcrsired Sep 22, 2024
bca4a1c
move string_push_back to seperate benchmark
trcrsired Sep 22, 2024
76d2c99
Merge pull request #841 from ShelpAm/next
trcrsired Sep 22, 2024
97a24a4
Merge remote-tracking branch 'parent/next'
trcrsired Sep 22, 2024
e604c42
string push back benchmark should be std one
trcrsired Sep 22, 2024
50e5b1a
add concat_fast_io bench
trcrsired Sep 22, 2024
35f1a36
fix string.h when realloc does not exist
trcrsired Sep 22, 2024
057e56c
fix c_file.cc
trcrsired Sep 24, 2024
cd70cea
fix vector usage
trcrsired Sep 24, 2024
531894d
fix io.h
trcrsired Sep 24, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ build
*.html
*.txt
!CMakeLists.txt
compile_commands.json
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/c_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::u8c_file ibf(u8"c_file.txt", fast_io::open_mode::in);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/c_file_unlocked.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::u8c_file_unlocked ibf(u8"c_file_unlocked.txt", fast_io::open_mode::in);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/c_file_unlocked_text.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::u8c_file_unlocked ibf(u8"c_file_unlocked_text.txt", fast_io::open_mode::in | fast_io::open_mode::text);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/filebuf_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::filebuf_file ibf(u8"filebuf_file.txt", fast_io::open_mode::in);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/fstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
obf.fb->sputc('\n');
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::filebuf_file ibf(u8"fstream.txt", fast_io::open_mode::in);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/fstreamtext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
obf.fb->sputc('\n');
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::filebuf_file ibf(u8"fsmtext.txt", fast_io::open_mode::in | fast_io::open_mode::text);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_file_lockable_big.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main()
println(obf.unlocked_handle(), i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::ibuf_file_lockable ibf(u8"iobuf_file_lockable_big.txt");
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_io_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::iobuf_io_file ibf(::fast_io::io_cookie_type<::fast_io::native_file>, "iobuf_io_file.txt",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_io_file_eol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::iobuf_io_file ibf(::fast_io::io_cookie_type<::fast_io::native_file>, "iobuf_io_file_eol.txt",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_io_file_eol_dbg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::iobuf_io_file ibf(::fast_io::io_cookie_type<::fast_io::native_file>, "iobuf_io_file_eol.txt",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_io_file_lf_cr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::iobuf_io_file ibf(::fast_io::io_cookie_type<::fast_io::native_file>, "iobuf_io_file_lf_cr.txt",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/iobuf_io_file_lf_crlf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
println(obf, i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::iobuf_io_file ibf(::fast_io::io_cookie_type<::fast_io::native_file>, "iobuf_io_file_lf_crlf.txt",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/0002.file_io_tsc/time/stdiotext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()
fprintf(obf.fp, "%zu\n", i);
}
}
std::vector<std::size_t> vec(N);
::fast_io::vector<std::size_t> vec(N);
{
fast_io::timer t(u8"input");
fast_io::c_file ibf(u8"stdiotext.txt", fast_io::open_mode::in | fast_io::open_mode::text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ int main()
{
constexpr std::size_t N(10000000);
{
fast_io::timer t(u8"concat_string");
fast_io::obuf_file obf("concat_string.txt");
fast_io::timer t(u8"concat_fast_io");
fast_io::obuf_file obf("concat_fast_io.txt");
for (std::size_t i{}; i != N; ++i)
{
print(obf, fast_io::concatln(i));
print(obf, fast_io::concatln_fast_io(i));
}
}
}
32 changes: 27 additions & 5 deletions benchmark/0007.concat/concat_vs_format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ inline ::fast_io::string color_concat_fast_io(std::uint_least8_t r, std::uint_le
return ::fast_io::concat_fast_io("Red: ", r, ", Green: ", g, ", Blue: ", b);
}

inline ::std::string color_concat(std::uint_least8_t r, std::uint_least8_t g, std::uint_least8_t b)
inline ::std::string color_concat_std(std::uint_least8_t r, std::uint_least8_t g, std::uint_least8_t b)
{
return ::fast_io::concat("Red: ", r, ", Green: ", g, ", Blue: ", b);
return ::fast_io::concat_std("Red: ", r, ", Green: ", g, ", Blue: ", b);
}

inline ::fast_io::u32string color_u32concat_fast_io(std::uint_least8_t r, std::uint_least8_t g, std::uint_least8_t b)
{
return ::fast_io::u32concat_fast_io(U"Red: ", r, U", Green: ", g, U", Blue: ", b);
}

inline ::std::u32string color_u32concat_std(std::uint_least8_t r, std::uint_least8_t g, std::uint_least8_t b)
{
return ::fast_io::u32concat_std(U"Red: ", r, U", Green: ", g, U", Blue: ", b);
}

inline std::string color_ostringstream(std::uint_least8_t r, std::uint_least8_t g, std::uint_least8_t b)
Expand Down Expand Up @@ -86,8 +96,12 @@ int main()
auto format_time = benchmark(color_format);
#endif
auto concat_fast_io_time = benchmark(color_concat_fast_io);
auto concat_time = benchmark(color_concat);
auto concat_std_time = benchmark(color_concat_std);
auto u32concat_fast_io_time = benchmark(color_u32concat_fast_io);
auto u32concat_std_time = benchmark(color_u32concat_std);
#if !defined(DISABLE_OSTRINGSTREAM_BENCH)
auto ostringstream_time = benchmark(color_ostringstream);
#endif
#if __has_include(<fmt/core.h>) && defined(ENABLE_FMT_BENCH)
auto fmt_format_time = benchmark(color_fmt_format);
#if __has_include(<fmt/compile.h>)
Expand All @@ -103,12 +117,20 @@ int main()
"fast_io::concat_fast_io (total size: ",
concat_fast_io_time.total_size, ") took ", concat_fast_io_time.timestamp,
"s.\n"
"fast_io::concat (total size: ",
concat_time.total_size, ") took ", concat_time.timestamp,
"fast_io::concat_std (total size: ",
concat_std_time.total_size, ") took ", concat_std_time.timestamp,
"s.\n"
"fast_io::u32concat_fast_io (total size: ",
u32concat_fast_io_time.total_size, ") took ", u32concat_fast_io_time.timestamp,
"s.\n"
"fast_io::u32concat_std (total size: ",
u32concat_std_time.total_size, ") took ", u32concat_std_time.timestamp,
"s.\n"
#if !defined(DISABLE_OSTRINGSTREAM_BENCH)
"std::ostringstream (total size: ",
ostringstream_time.total_size, ") took ", ostringstream_time.timestamp,
"s.\n"
#endif
#if __has_include(<fmt/core.h>) && defined(ENABLE_FMT_BENCH)
"fmt::format (total size:",
fmt_format_time.total_size, ") took ", fmt_format_time.timestamp,
Expand Down
18 changes: 18 additions & 0 deletions benchmark/0007.concat/u32concat_fast_io.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <fast_io_dsal/string.h>
#include <fast_io.h>
#include <fast_io_device.h>
#include <fast_io_driver/timer.h>
using namespace fast_io::io;

int main()
{
constexpr std::size_t N(10000000);
{
fast_io::timer t(u8"u32concat_fast_io");
fast_io::u32obuf_file obf(u8"u32concat_fast_io.txt");
for (std::size_t i{}; i != N; ++i)
{
print(obf, fast_io::u32concatln_fast_io(i));
}
}
}
18 changes: 18 additions & 0 deletions benchmark/0007.concat/u32concat_std.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <string>
#include <fast_io.h>
#include <fast_io_device.h>
#include <fast_io_driver/timer.h>
using namespace fast_io::io;

int main()
{
constexpr std::size_t N(10000000);
{
fast_io::timer t(u8"u32concat_std");
fast_io::u32obuf_file obf(u8"u32concat_std.txt");
for (std::size_t i{}; i != N; ++i)
{
print(obf, fast_io::u32concatln_std(i));
}
}
}
17 changes: 17 additions & 0 deletions benchmark/0009.concatstring/concat_fast_io.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <fast_io_dsal/string.h>
#include <fast_io.h>
#include <fast_io_driver/timer.h>
using namespace fast_io::io;

int main()
{
int test_i{};
::fast_io::string test_s("hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello");
::fast_io::string re;
auto t0{fast_io::posix_clock_gettime(fast_io::posix_clock_id::realtime)};
for (std::size_t i{}; i != 1000000; ++i)
{
re = fast_io::concat_fast_io("hello", test_i, test_s);
}
print(fast_io::posix_clock_gettime(fast_io::posix_clock_id::realtime) - t0, "s ", re);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main()
auto t0{fast_io::posix_clock_gettime(fast_io::posix_clock_id::realtime)};
for (std::size_t i{}; i != 1000000; ++i)
{
re = fast_io::concat("hello", test_i, test_s);
re = fast_io::concat_std("hello", test_i, test_s);
}
print(fast_io::posix_clock_gettime(fast_io::posix_clock_id::realtime) - t0, "s ", re);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<fast_io_dsal/vector.h>
#include<fast_io_dsal/string.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::fast_io::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_fast_io");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back(u8"hello world\n").size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<fast_io_dsal/vector.h>
#include<fast_io_dsal/string.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::fast_io::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_fast_io_empty");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back().size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<fast_io_dsal/vector.h>
#include<fast_io_dsal/string.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::fast_io::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_fast_io");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back(u8"hello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\n").size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<fast_io_dsal/vector.h>
#include<fast_io_dsal/string.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::fast_io::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_fast_io");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back(u8"hello world\nhello world\nhello world\n").size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<string>
#include<fast_io_dsal/vector.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::std::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_std");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back(u8"hello world\n").size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<string>
#include<fast_io_dsal/vector.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::std::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_std_empty");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back().size();
}
}
::fast_io::io::println(total_sum);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<string>
#include<fast_io_dsal/vector.h>
#include<fast_io_driver/timer.h>

int main()
{
::fast_io::vector<::std::u8string> vec;
::std::size_t total_sum{};
{
::fast_io::timer t(u8"string_push_back_std");
for(::std::size_t i{};i!=1000000u;++i)
{
total_sum+=vec.emplace_back(u8"hello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\nhello world\n").size();
}
}
::fast_io::io::println(total_sum);
}
Loading
Loading