add std::vector instead of std::map
This commit is contained in:
@@ -126,8 +126,8 @@ class VertexAccessor final {
|
||||
}
|
||||
|
||||
storage::Result<std::vector<storage::PropertyValue>> SetProperties(
|
||||
std::map<storage::PropertyId, storage::PropertyValue> &properties) {
|
||||
return impl_.SetBatchProperties(properties);
|
||||
std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> &properties) {
|
||||
return impl_.SetProperties(properties);
|
||||
}
|
||||
|
||||
storage::Result<storage::PropertyValue> RemoveProperty(storage::PropertyId key) {
|
||||
|
||||
@@ -231,8 +231,6 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
||||
}
|
||||
|
||||
TypedValue Visit(SubscriptOperator &list_indexing) override {
|
||||
// auto start = std::chrono::steady_clock::now();
|
||||
|
||||
ReferenceExpressionEvaluator referenceExpressionEvaluator(frame_, symbol_table_, ctx_, dba_, view_);
|
||||
|
||||
auto *lhs = list_indexing.expression1_->Accept(referenceExpressionEvaluator);
|
||||
@@ -255,14 +253,6 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
||||
if (index_int >= static_cast<int64_t>(list.size()) || index_int < 0) return TypedValue(ctx_->memory);
|
||||
// NOTE: Explicit move is needed, so that we return the move constructed
|
||||
// value and preserve the correct MemoryResource.
|
||||
// auto end = std::chrono::steady_clock::now();
|
||||
// std::chrono::duration<double> dif = end - start;
|
||||
// total2 += dif;
|
||||
|
||||
// if (total2 > new_print2) {
|
||||
// std::cout << "Time difference visit = " << total2.count() << "[s]" << std::endl;
|
||||
// new_print2 += static_cast<std::chrono::duration<double>>(1.0);
|
||||
// }
|
||||
return TypedValue(list[index_int]);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,12 +212,10 @@ VertexAccessor &CreateLocalVertex(const NodeCreationInfo &node_info, Frame *fram
|
||||
// TODO: PropsSetChecked allocates a PropertyValue, make it use context.memory
|
||||
// when we update PropertyValue with custom allocator.
|
||||
|
||||
// auto start = std::chrono::steady_clock::now();
|
||||
|
||||
std::map<storage::PropertyId, storage::PropertyValue> properties;
|
||||
std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> properties;
|
||||
if (const auto *node_info_properties = std::get_if<PropertiesMapList>(&node_info.properties)) {
|
||||
for (const auto &[key, value_expression] : *node_info_properties) {
|
||||
properties.emplace(key, value_expression->Accept(evaluator));
|
||||
properties.emplace_back(key, value_expression->Accept(evaluator));
|
||||
// PropsSetChecked(&new_node, key, );
|
||||
}
|
||||
new_node.SetProperties(properties);
|
||||
@@ -228,14 +226,6 @@ VertexAccessor &CreateLocalVertex(const NodeCreationInfo &node_info, Frame *fram
|
||||
PropsSetChecked(&new_node, property_id, value);
|
||||
}
|
||||
}
|
||||
// auto end = std::chrono::steady_clock::now();
|
||||
// std::chrono::duration<double> dif = end - start;
|
||||
// total += dif;
|
||||
|
||||
// if (total > new_print) {
|
||||
// std::cout << "Time difference props set checked = " << total.count() << "[s]" << std::endl;
|
||||
// new_print += static_cast<std::chrono::duration<double>>(10.0);
|
||||
// }
|
||||
|
||||
(*frame)[node_info.symbol] = new_node;
|
||||
return (*frame)[node_info.symbol].ValueVertex();
|
||||
|
||||
@@ -1167,7 +1167,7 @@ bool PropertyStore::SetProperty(PropertyId property, const PropertyValue &value)
|
||||
}
|
||||
|
||||
// use this function only when inserting new properties
|
||||
bool PropertyStore::SetProperties(std::map<storage::PropertyId, storage::PropertyValue> &properties) {
|
||||
bool PropertyStore::SetProperties(std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> &properties) {
|
||||
uint64_t size;
|
||||
uint8_t *data;
|
||||
std::tie(size, data) = GetSizeData(buffer_);
|
||||
|
||||
@@ -61,7 +61,7 @@ class PropertyStore {
|
||||
/// @throw std::bad_alloc
|
||||
bool SetProperty(PropertyId property, const PropertyValue &value);
|
||||
|
||||
bool SetProperties(std::map<storage::PropertyId, storage::PropertyValue> &properties);
|
||||
bool SetProperties(std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> &properties);
|
||||
|
||||
/// Remove all properties and return `true` if any removal took place.
|
||||
/// `false` is returned if there were no properties to remove. The time
|
||||
|
||||
@@ -245,8 +245,8 @@ Result<PropertyValue> VertexAccessor::SetProperty(PropertyId property, const Pro
|
||||
return std::move(current_value);
|
||||
}
|
||||
|
||||
Result<std::vector<storage::PropertyValue>> VertexAccessor::SetBatchProperties(
|
||||
std::map<storage::PropertyId, storage::PropertyValue> &properties) {
|
||||
Result<std::vector<storage::PropertyValue>> VertexAccessor::SetProperties(
|
||||
std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> &properties) {
|
||||
// Be careful when calling this function
|
||||
// It will set properties in batch, without checking if property already exists
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ class VertexAccessor final {
|
||||
/// @throw std::bad_alloc
|
||||
Result<PropertyValue> SetProperty(PropertyId property, const PropertyValue &value);
|
||||
|
||||
Result<std::vector<storage::PropertyValue>> SetBatchProperties(
|
||||
std::map<storage::PropertyId, storage::PropertyValue> &properties);
|
||||
Result<std::vector<storage::PropertyValue>> SetProperties(
|
||||
std::vector<std::pair<storage::PropertyId, storage::PropertyValue>> &properties);
|
||||
|
||||
/// Remove all properties and return the values of the removed properties.
|
||||
/// @throw std::bad_alloc
|
||||
|
||||
Reference in New Issue
Block a user