Decreased footprint of union in StoredProperty.
This commit is contained in:
parent
537730ed94
commit
e1e7f3759d
@ -5,6 +5,10 @@
|
||||
|
||||
#include "storage/model/properties/flags.hpp"
|
||||
|
||||
// TODO: more bytes can be saved if this is array with exact size as number
|
||||
// of elements.
|
||||
// TODO: even more bytes can be saved if this is one ptr to structure which
|
||||
// holds len followed by len sized array.
|
||||
template <class T>
|
||||
using ArrayStore = std::vector<T>;
|
||||
|
||||
@ -61,6 +65,8 @@ public:
|
||||
// operator const Arr &() const { return value(); };
|
||||
|
||||
private:
|
||||
// TODO: PropertyHolder can be 8B smaller if this uses custom shared_ptr
|
||||
// which has only one ptr here.
|
||||
std::shared_ptr<Arr> data;
|
||||
};
|
||||
|
||||
|
@ -72,5 +72,9 @@ public:
|
||||
|
||||
private:
|
||||
using props_t = std::vector<StoredProperty<TG>>;
|
||||
// TODO: more bytes can be saved if this is array with exact size as number
|
||||
// of elements.
|
||||
// TODO: even more bytes can be saved if this is one ptr to structure which
|
||||
// holds len followed by len sized array.
|
||||
props_t props;
|
||||
};
|
||||
|
@ -11,12 +11,14 @@ class String
|
||||
public:
|
||||
const static Type type;
|
||||
|
||||
String(std::string const &d) : data(d) {}
|
||||
String(std::string &&d) : data(std::move(d)) {}
|
||||
String(std::string const &d) : data(std::make_shared<std::string>(d)) {}
|
||||
String(std::string &&d) : data(std::make_shared<std::string>(std::move(d)))
|
||||
{
|
||||
}
|
||||
|
||||
std::string &value() { return data; }
|
||||
std::string &value() { return *data.get(); }
|
||||
|
||||
std::string const &value() const { return data; }
|
||||
std::string const &value() const { return *data.get(); }
|
||||
|
||||
std::ostream &print(std::ostream &stream) const;
|
||||
|
||||
@ -31,5 +33,5 @@ public:
|
||||
// operator const std::string &() const;
|
||||
|
||||
private:
|
||||
std::string data;
|
||||
std::shared_ptr<std::string> data;
|
||||
};
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
#include <unordered_map>
|
||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
||||
#include "import/csv_import.hpp"
|
||||
#include "utils/command_line/arguments.hpp"
|
||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -23,6 +23,8 @@ int main(int argc, char **argv)
|
||||
|
||||
import_csv_from_arguments(db, para);
|
||||
|
||||
usleep(1000 * 1000 * 10);
|
||||
|
||||
{
|
||||
DbAccessor t(db);
|
||||
|
||||
|
@ -28,6 +28,12 @@ using in_edge_iterator_t =
|
||||
|
||||
int main()
|
||||
{
|
||||
cout << "std::string: " << sizeof(std::string)
|
||||
<< " aligment: " << alignof(std::string) << endl;
|
||||
|
||||
cout << "StoredProperty: " << sizeof(StoredProperty<TypeGroupVertex>)
|
||||
<< " aligment: " << alignof(StoredProperty<TypeGroupVertex>) << endl;
|
||||
|
||||
cout << "DbAccessor.vertex_access(): size: "
|
||||
<< sizeof(vertex_access_iterator)
|
||||
<< " aligment: " << alignof(vertex_access_iterator) << endl;
|
||||
|
@ -14,12 +14,12 @@ State *Init::parse(Session &session, Message &message)
|
||||
{
|
||||
auto struct_type = session.decoder.read_byte();
|
||||
|
||||
if (UNLIKELY((struct_type & 0x0F) <= pack::Rule::MaxInitStructSize)) {
|
||||
if (UNLIKELY((struct_type & 0x0F) > pack::Rule::MaxInitStructSize)) {
|
||||
logger.debug("{}", struct_type);
|
||||
|
||||
logger.debug(
|
||||
"Expected struct marker of max size 0x{:02} instead of 0x{:02X}",
|
||||
(unsigned) pack::Rule::MaxInitStructSize, (unsigned) struct_type);
|
||||
(unsigned)pack::Rule::MaxInitStructSize, (unsigned)struct_type);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ foreach(test ${unit_test_names})
|
||||
target_link_libraries(${test_name} cypher_lib)
|
||||
target_link_libraries(${test_name} Threads::Threads)
|
||||
target_link_libraries(${test_name} ${fmt_static_lib})
|
||||
target_link_libraries(${test_name} ${yaml_static_lib})
|
||||
add_test(NAME ${test_name} COMMAND ${test_name})
|
||||
set_property(TARGET ${test_name} PROPERTY CXX_STANDARD 14)
|
||||
endforeach()
|
||||
@ -54,6 +55,7 @@ foreach(test ${concurrency_test_names})
|
||||
target_link_libraries(${test_name} memgraph)
|
||||
target_link_libraries(${test_name} Threads::Threads)
|
||||
target_link_libraries(${test_name} ${fmt_static_lib})
|
||||
target_link_libraries(${test_name} ${yaml_static_lib})
|
||||
add_test(NAME ${test_name} COMMAND ${test_name})
|
||||
set_property(TARGET ${test_name} PROPERTY CXX_STANDARD 14)
|
||||
endforeach()
|
||||
@ -65,6 +67,7 @@ add_executable(integration_queries integration/queries.cpp)
|
||||
target_link_libraries(integration_queries memgraph)
|
||||
target_link_libraries(integration_queries Threads::Threads)
|
||||
target_link_libraries(integration_queries ${fmt_static_lib})
|
||||
target_link_libraries(integration_queries ${yaml_static_lib})
|
||||
add_test(NAME integration_queries COMMAND integration_queries)
|
||||
set_property(TARGET integration_queries PROPERTY CXX_STANDARD 14)
|
||||
|
||||
@ -73,6 +76,7 @@ add_executable(cleaning integration/cleaning.cpp)
|
||||
target_link_libraries(cleaning memgraph)
|
||||
target_link_libraries(cleaning Threads::Threads)
|
||||
target_link_libraries(cleaning ${fmt_static_lib})
|
||||
target_link_libraries(cleaning ${yaml_static_lib})
|
||||
add_test(NAME cleaning COMMAND cleaning)
|
||||
set_property(TARGET cleaning PROPERTY CXX_STANDARD 14)
|
||||
|
||||
@ -95,6 +99,7 @@ add_executable(manual_cypher_ast manual/cypher_ast.cpp)
|
||||
target_link_libraries(manual_cypher_ast memgraph)
|
||||
target_link_libraries(manual_cypher_ast Threads::Threads)
|
||||
target_link_libraries(manual_cypher_ast ${fmt_static_lib})
|
||||
target_link_libraries(manual_cypher_ast ${yaml_static_lib})
|
||||
target_link_libraries(manual_cypher_ast cypher_lib)
|
||||
set_property(TARGET manual_cypher_ast PROPERTY CXX_STANDARD 14)
|
||||
|
||||
@ -103,6 +108,7 @@ add_executable(manual_queries manual/queries.cpp)
|
||||
target_link_libraries(manual_queries memgraph)
|
||||
target_link_libraries(manual_queries Threads::Threads)
|
||||
target_link_libraries(manual_queries ${fmt_static_lib})
|
||||
target_link_libraries(manual_queries ${yaml_static_lib})
|
||||
target_link_libraries(manual_queries cypher_lib)
|
||||
set_property(TARGET manual_queries PROPERTY CXX_STANDARD 14)
|
||||
|
||||
@ -110,6 +116,7 @@ set_property(TARGET manual_queries PROPERTY CXX_STANDARD 14)
|
||||
add_executable(manual_query_engine manual/query_engine.cpp)
|
||||
target_link_libraries(manual_query_engine memgraph)
|
||||
target_link_libraries(manual_query_engine ${fmt_static_lib})
|
||||
target_link_libraries(manual_query_engine ${yaml_static_lib})
|
||||
target_link_libraries(manual_query_engine dl)
|
||||
target_link_libraries(manual_query_engine cypher_lib)
|
||||
target_link_libraries(manual_query_engine Threads::Threads)
|
||||
@ -119,6 +126,7 @@ set_property(TARGET manual_query_engine PROPERTY CXX_STANDARD 14)
|
||||
add_executable(manual_query_hasher manual/query_hasher.cpp)
|
||||
target_link_libraries(manual_query_hasher memgraph)
|
||||
target_link_libraries(manual_query_hasher ${fmt_static_lib})
|
||||
target_link_libraries(manual_query_hasher ${yaml_static_lib})
|
||||
target_link_libraries(manual_query_hasher Threads::Threads)
|
||||
set_property(TARGET manual_query_hasher PROPERTY CXX_STANDARD 14)
|
||||
|
||||
@ -126,4 +134,5 @@ set_property(TARGET manual_query_hasher PROPERTY CXX_STANDARD 14)
|
||||
add_executable(manual_cpp_generator manual/cpp_generator.cpp)
|
||||
target_link_libraries(manual_cpp_generator memgraph)
|
||||
target_link_libraries(manual_cpp_generator ${fmt_static_lib})
|
||||
target_link_libraries(manual_cpp_generator ${yaml_static_lib})
|
||||
set_property(TARGET manual_cpp_generator PROPERTY CXX_STANDARD 14)
|
||||
|
Loading…
Reference in New Issue
Block a user