3

Optimize VecDeque::append by tabokie · Pull Request #88717 · rust-lang/rust · Gi...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88717
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

tabokie commented on Sep 7

edited

Optimize VecDeque::append to do unsafe copy rather than iterating through each element.

On my Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz, the benchmark shows 37% improvements:

Master:
custom-bench vec_deque_append 583164 ns/iter
custom-bench vec_deque_append 550040 ns/iter

Patched:
custom-bench vec_deque_append 349204 ns/iter
custom-bench vec_deque_append 368164 ns/iter

Additional notes on the context: this is the third attempt to implement a non-trivial version of VecDeque::append, the last two are reverted due to unsoundness or regression, see:

Both cases are covered by existing tests.

Signed-off-by: tabokie [email protected]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK