Skip to content

Conversation

@jszuppe
Copy link
Contributor

@jszuppe jszuppe commented Mar 26, 2015

This addresses issue #325 .

I've added find() algorithm benchmarks for Boost.Compute, STL, Thrust. Benchmarks are based on worst-case scenario (searching for element that isn't in vector).

Boost.Compute, STL and Thrust benchmarks for find() algorithm.
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I tried running this version a few times with varying data sizes but always got the same very small time. This usually means the compiler is optimizing out the call the std::find() entirely because the result is not actually used. I'd add something to store the result in a variable and compare it against host_vector.end().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have that issue. Are performance tests built with -O3 by default?

Nevertheless, I will commit fix immediately and to be sure it won't happen again with Thrust performance test I will add there the same check.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not by default, but when I'm running the performance benchmarks and comparing against the STL I enable optimizations (else the results are not very fair). I usually do this by setting CMAKE_BUILD_TYPE=Release which enables gcc -03.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! That's exactly what I need to know. From now on I will use that setting when testing performance, especially against STL.

@kylelutz
Copy link
Collaborator

Minor issue with the STL version. After fixing that it should be good to merge. Thanks!

Making sure that compiler won't cut out std::find() and thrust:find()
calls while optimizing the code.
@jszuppe
Copy link
Contributor Author

jszuppe commented Mar 27, 2015

It's interesting that Travis build failed. I'm not sure why.

kylelutz added a commit that referenced this pull request Mar 27, 2015
Benchmarks for find() algorithm #325
@kylelutz kylelutz merged commit 415e7a0 into boostorg:develop Mar 27, 2015
@kylelutz
Copy link
Collaborator

Looks great! Merged!

@kylelutz
Copy link
Collaborator

And don't worry about the g++-4.8: internal compiler error Travis build error for GCC. It's not related to your change. I've been looking into it. For now, as long as the clang passes it should be good.

@jszuppe jszuppe deleted the find_benchmark branch March 27, 2015 16:47
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

Successfully merging this pull request may close these issues.

2 participants