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

Refactor DataProvider::get_values interface and implementations to avoid excess allocation and copying #809

Open
PhilMiller opened this issue May 2, 2024 · 0 comments

Comments

@PhilMiller
Copy link
Contributor

virtual std::vector<data_type> get_values(const selection_type& selector, ReSampleMethod m=SUM) = 0;

The member function signature in the DataProvider interface demands the allocation of a temporary vector and the likely copying of data from that temporary vector by the consumer.

The signature ought to be

virtual void get_values(boost::span<data_type> output, selection_type const&  selector, ReSampleMethod = SUM);

We could phase the refactoring by

  • adding this as an overload to the interface, with a default implementation that just calls the existing get_values and copies the data
  • Implement for various DataProvider implementations
  • Exploit in DataProvider::get_values callers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant