mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
DragonBox integration
This commit is contained in:
parent
67c82eb61b
commit
64549702a2
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -209,3 +209,6 @@
|
|||||||
path = contrib/abseil-cpp
|
path = contrib/abseil-cpp
|
||||||
url = https://github.com/ClickHouse-Extras/abseil-cpp.git
|
url = https://github.com/ClickHouse-Extras/abseil-cpp.git
|
||||||
branch = lts_2020_02_25
|
branch = lts_2020_02_25
|
||||||
|
[submodule "contrib/dragonbox"]
|
||||||
|
path = contrib/dragonbox
|
||||||
|
url = https://github.com/kitaisreal/dragonbox.git
|
||||||
|
2
contrib/CMakeLists.txt
vendored
2
contrib/CMakeLists.txt
vendored
@ -322,3 +322,5 @@ endif()
|
|||||||
if (USE_INTERNAL_ROCKSDB_LIBRARY)
|
if (USE_INTERNAL_ROCKSDB_LIBRARY)
|
||||||
add_subdirectory(rocksdb-cmake)
|
add_subdirectory(rocksdb-cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(dragonbox)
|
1
contrib/dragonbox
vendored
Submodule
1
contrib/dragonbox
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 17d07b00f9c70d61c60c3bd1046c2ef6814d14c6
|
@ -155,6 +155,7 @@ function clone_submodules
|
|||||||
contrib/croaring
|
contrib/croaring
|
||||||
contrib/miniselect
|
contrib/miniselect
|
||||||
contrib/xz
|
contrib/xz
|
||||||
|
contrib/dragonbox
|
||||||
)
|
)
|
||||||
|
|
||||||
git submodule sync
|
git submodule sync
|
||||||
|
@ -243,6 +243,7 @@ target_link_libraries (clickhouse_common_io
|
|||||||
common
|
common
|
||||||
${DOUBLE_CONVERSION_LIBRARIES}
|
${DOUBLE_CONVERSION_LIBRARIES}
|
||||||
ryu
|
ryu
|
||||||
|
dragonbox_to_chars
|
||||||
)
|
)
|
||||||
|
|
||||||
if(RE2_LIBRARY)
|
if(RE2_LIBRARY)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <IO/DoubleConverter.h>
|
#include <IO/DoubleConverter.h>
|
||||||
#include <IO/WriteBufferFromString.h>
|
#include <IO/WriteBufferFromString.h>
|
||||||
|
|
||||||
#include <ryu/ryu.h>
|
#include <dragonbox/dragonbox_to_chars.h>
|
||||||
|
|
||||||
#include <Formats/FormatSettings.h>
|
#include <Formats/FormatSettings.h>
|
||||||
|
|
||||||
@ -228,14 +228,14 @@ inline size_t writeFloatTextFastPath(T x, char * buffer)
|
|||||||
if (DecomposedFloat64(x).is_inside_int64())
|
if (DecomposedFloat64(x).is_inside_int64())
|
||||||
result = itoa(Int64(x), buffer) - buffer;
|
result = itoa(Int64(x), buffer) - buffer;
|
||||||
else
|
else
|
||||||
result = d2s_buffered_n(x, buffer);
|
result = jkj::dragonbox::to_chars_n(x, buffer) - buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DecomposedFloat32(x).is_inside_int32())
|
if (DecomposedFloat32(x).is_inside_int32())
|
||||||
result = itoa(Int32(x), buffer) - buffer;
|
result = itoa(Int32(x), buffer) - buffer;
|
||||||
else
|
else
|
||||||
result = f2s_buffered_n(x, buffer);
|
result = jkj::dragonbox::to_chars_n(x, buffer) - buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result <= 0)
|
if (result <= 0)
|
||||||
|
@ -82,6 +82,7 @@ target_link_libraries (zlib_ng_bug PRIVATE ${ZLIB_LIBRARIES})
|
|||||||
|
|
||||||
add_executable (ryu_test ryu_test.cpp)
|
add_executable (ryu_test ryu_test.cpp)
|
||||||
target_link_libraries (ryu_test PRIVATE ryu)
|
target_link_libraries (ryu_test PRIVATE ryu)
|
||||||
|
target_link_libraries (ryu_test PRIVATE dragonbox_to_chars)
|
||||||
|
|
||||||
add_executable (zstd_buffers zstd_buffers.cpp)
|
add_executable (zstd_buffers zstd_buffers.cpp)
|
||||||
target_link_libraries (zstd_buffers PRIVATE clickhouse_common_io)
|
target_link_libraries (zstd_buffers PRIVATE clickhouse_common_io)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ryu/ryu.h>
|
#include <ryu/ryu.h>
|
||||||
|
#include <dragonbox/dragonbox_to_chars.h>
|
||||||
|
|
||||||
struct DecomposedFloat64
|
struct DecomposedFloat64
|
||||||
{
|
{
|
||||||
@ -84,9 +84,14 @@ int main(int argc, char ** argv)
|
|||||||
double x = argc > 1 ? std::stod(argv[1]) : 0;
|
double x = argc > 1 ? std::stod(argv[1]) : 0;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
|
std::cout << "ryu output" << std::endl;
|
||||||
d2s_buffered(x, buf);
|
d2s_buffered(x, buf);
|
||||||
std::cout << buf << "\n";
|
std::cout << buf << "\n";
|
||||||
|
|
||||||
|
std::cout << "dragonbox output" << std::endl;
|
||||||
|
jkj::dragonbox::to_chars(x, buf);
|
||||||
|
std::cout << buf << "\n";
|
||||||
|
|
||||||
std::cout << DecomposedFloat64(x).isInsideInt64() << "\n";
|
std::cout << DecomposedFloat64(x).isInsideInt64() << "\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user