Skip to content

Conversation

@aalkin
Copy link
Member

@aalkin aalkin commented Jan 27, 2021

  • extended Variant
  • added JSON/ptree conversions
  • added cases to workflow serializer/deserializer
  • added tests
  • added example

* extened Variant
* added JSON/ptree conversions
* added cases to workflow serializer/deserializer
* added tests
@aalkin aalkin requested review from a team, iarsene and jgrosseo as code owners January 27, 2021 10:53
Array2D<T> values;
std::vector<std::string> labels_rows;
std::vector<std::string> labels_cols;
std::unordered_map<std::string, uint32_t> rowmap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really need the unordered_map?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the easiest way to make label getter work without too much performance drop. I will try to rework this later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check what was the actual performance issue? I strongly believe that in get(std::string, std::string) the most time consuming part is allocating the strings, not the lookup. Why not using get(char const*, char const*)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getter arguments should've been references... The issue was that using std::find on string vector was slower than map lookup even for sizes below 10. And since typical usage would be getting non-sequential values of the array to use in multiple if statements in process() that could be a problem. But I do not like using unordered_map and intend to rewrite it with the hash trick we use in registries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if they are references, if the common usage is get("foo", "bar"), as I assume it is, it will do two allocations for each invocation (because char const* is not a string). At least you should provide an overload, if that is a typical usecase.

@ktf ktf merged commit b85705a into AliceO2Group:dev Jan 27, 2021
@ktf
Copy link
Member

ktf commented Jan 27, 2021

Merged to speed up developments. Could you rework stuff so that the unordered_map is not needed and the methods parts which do not require templated code are factored out in a non template (private) policy?

@aalkin aalkin deleted the integrate-labeled-array branch May 30, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants