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

"Hand Coded" Performance Comparisons #1

Open
timothy-shields opened this issue Jun 13, 2013 · 0 comments
Open

"Hand Coded" Performance Comparisons #1

timothy-shields opened this issue Jun 13, 2013 · 0 comments

Comments

@timothy-shields
Copy link
Owner

For typical hand coded patterns, compare performance of functionally equivalent linq-cpp queries.

For example, compare the performance of A and B below:

std::vector<int> x = ...;

// A
std::vector<int> y(x.size());
std::transform(x.begin(), x.end(), y.begin(), [](int n){ return n * n; });
std::remove_if(y.begin(), y.end(), [](int n){ return (n % 3) != 0; });

// B
auto y = ix::from(x.begin(), x.end())
    .select([](int n){ return n * n; })
    .where([](int n){ return (n % 3) == 0; })
    .to_vector();
@ghost ghost assigned timothy-shields Jun 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant