Macro bench_specializations#786
Conversation
59baaf3 to
50961c6
Compare
50961c6 to
110a0aa
Compare
phimuemue
left a comment
There was a problem hiding this comment.
Hi @Philippe-Cholet, thanks for this. I'm inclined to merge this, but I have some questions:
- There's
$iteratorand$first_its. When do we use which? Could we unify (and, thus, potentially simplify code)? - (Not directly related to this PR:) What's our general benchmarking story? Are benchmarks to be run within our CI or before we
cargo publisha new version to ensure we have no regressions?
Please let me know if I you want to amend something or if I should merge this right away.
| black_box(x); | ||
| }) | ||
| })); | ||
| }; |
There was a problem hiding this comment.
Should this also incllude all (such as the specialization tests)?
There was a problem hiding this comment.
I listed the currently missing (stable) methods:
Iterator:
- Depends on
foldby default:for_each partition reduce max min max_by_key max_by min_by_key min_by. - Depends on
try_foldby default:all any find find_map position cmp partial_cmp eq ne lt le gt ge. - Depends on
try_rfoldby default:rposition.
DoubleEndedIterator:
- Depends on
try_rfoldby default:rfind.
I'm inclined to not add them at the moment as they rely on one of [try_][r]fold.
Obviously, we can change our mind later.
| DoubleEndedIterator | ||
| ExactSizeIterator |
There was a problem hiding this comment.
Neat idea! Maybe we should do this in specialization tests, too.
There was a problem hiding this comment.
I like it too.
ExactSizeIterator might be unnecessary since we are I think unlikely to specialize len but it was easy to add once DoubleEndedIterator was added.
|
@phimuemue I don't know what's "our general benchmarking story". I assume we simply use them to avoid performance regressions (and most likely real improvements) in pull requests like the recent and various I changed the macro syntax a lot before I was satisfied. What do you think? Before merging, I would like @jswrenn to give a little feedback on it as he wrote the initial issue and might have a different idea in mind? Plus, I'm discovering a lot of "criterion" parts here. What do you think about my first comment (copied below)? I think it's decent to assume
|
|
@phimuemue I'm also a bit unsure about |
110a0aa to
d1df7bf
Compare
|
Now that there are no opened PR about "fold" specializations, I moved benchmarks of I should probably take time to create other "specialization benchmarks" to avoid work in future PRs. But it will be another PR though. |
Similar to `nth` benchmark. With this, all iterator method specializations are considered except for methods that rely on `[r]fold/try_[r]fold` by default. We might want to add others later.
e8fd17b to
25b2cd8
Compare
Related to #766
Macro to be able to benchmark iterator methods.
Currently, there is only one example in the used macro (put none would lead to a compiler failure).
The expression
$iteratoris supposed to be fast, negligeable compared to the rest. Otherwise, we could usebencher.iter_batched(|| { $iterator }, |mut it| { ... }, ...).