-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[All] Replace qsort with faster std sort #62
Conversation
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
==========================================
- Coverage 84.76% 84.73% -0.04%
==========================================
Files 251 251
Lines 19932 19897 -35
==========================================
- Hits 16896 16859 -37
- Misses 3036 3038 +2
Continue to review full report at Codecov.
|
Does this noticeably speed up preprocessing ? I found mixed results when experimenting with std::sort for matrix assembly. |
It probably takes pretty big sorts to notice a major difference. At least with std::sort the compiler has more opportunity for optimizations. Even if it's similar in runtime, I find the syntax with passing the comparison function as a lambda to be more clear than having a bunch of static comparison functions laying around. |
Two things to contemplate:
I was able to refactor matrix assembly to avoid global sorts - perhaps we can do something smarter with topology too? |
I agree with your comments, lambda syntax is bizarre when you first see it. But that aside, I still find the std::sort syntax cleaner and more flexible than qsort since we can explicitly pass in the comparison function rather than a function pointer declared elsewhere and having to type cast a bunch of void*s. If anything this will be more akin to how we would make a device sort routine, by passing a .okl comparison function as a string. And, of course, this may all be moot later as we move more things to the device and replace std::sort instances. I'm not welded to this change, you can have final say. If you're ok with it, feel free to merge, otherwise you can close. |
I’ll merge it given that this will mostly be replaced by on device sorts. Setting up a flexible device sort would be a good step forward. I strongly recommend avoiding going further the down the C++ rabbit hole. Using iterators comes to mind as one trap that will make it tricky to offload. |
No description provided.