@Peter: while creating STL wrappers for pfc containers I found a weird piece of code:
T pfc::list_base_const_t::operator[](t_size n) const {
T temp;
get_item_ex(temp,n);
return std::move(temp);
}
For some reason this operator returns by value instead of reference, resulting in a needless constructor call every time an element is accessed.
Another thing that is present in this method and in some other parts of SDK is `return std::move(...);`: such return prevents Return Value Optimization and results in a needless object creation/move. `std::move` should be removed for RVO to function properly (which is actually guaranteed by C++17 in this case).
On entirely different note: while I was refactoring my code, I've found out that your `pfc::sort_t` is much better than `std::sort` (43% faster)! Really great job! But recently I've stumbled upon an interesting sorting algorithm called `timsort`, which does an excellent job at sorting arrays of strings and non-integral types (e.g. metadb_handle_list_helper::sort_by_relative_path):
sort_by_relative_path:
4.8k sorted elements.
Sort_Std Time: 27 msec
Sort_Pfc Time: 33 msec
Sort_Tim Time: 13 msec
4.8k uniformally distributed elements.
Sort_Std Time: 46 msec
Sort_Pfc Time: 32 msec
Sort_Tim Time: 31 msec
20k partially sorted (every 10% block is sorted).
Sort_Std Time: 239 msec
Sort_Pfc Time: 174 msec
Sort_Tim Time: 77 msec
20k uniformally distributed elements.
Sort_Std Time: 255 msec
Sort_Pfc Time: 178 msec
Sort_Tim Time: 168 msec
Benchmark was performed using the following `timsort` implementation: https://github.com/tvanslyke/timsort-cpp
Anyways, I hope at least some part of this would be useful to you. Keep up the good job and have a nice day =)