[PATCH] D42357: Under limitation of allocated buffer, inplace_merge() does NOT take usage of partial allocated buffer but applies native rotate directly.

WeiChungChang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 15:01:48 PST 2018


WeiChungChang added a comment.

Dear mclow:

Thanks a lot for your kindly reply!

I would like to briefly describe the purpose of this fix here.

**`This patch is in a series of 3 aimed targets.`**
I could explain them item-by-item in detail with experiment.
**//However, I mainly focus on algorithm so if there is any syntax issue, I may need your help to correct it.//**

Please refer to this report report <https://drive.google.com/open?id=1MTigPFnqy7tscE-eCPiw9Y8_1blDTL6O> about the final correction of algorithm in detail which may avoid unnecessary split, rotate under limited buffer.

Following list the 3 items I found when compared to GCC libstlc++.

1. ** sort is faster but merge is far slower than libstlc++ .**
2. ** unstable merge speed between backward & forward.**  (will open other ticket later)
3. ** efficient algorithm of pivot selection.** (will open other ticket later)

**This patch is for 1st item only**
Please refer to for my test code, it is simple to sort & merge two vectors. 
test source code & make file <https://drive.google.com/open?id=1JbP87q7czmaY6Xd4DByk92kM2kVj3hkV>

I will attached the comparison of merge speed under different cases later (different max allocated buffer constraint).

According to your suggestion, **`I also would like to know which object is representative instead of integer to analyze the problem.`**
So I can test it too.

Thanks a lot for your suggestions.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42357





More information about the cfe-commits mailing list