3 ms·
Might as well plug mine too: https://github.com/ludocode/pottery https://github.com/ludocode/pottery I'm not really sure what makes a project take off on HN.
by ludocode 6y ago
Might as well plug mine too:
https://github.com/ludocode/pottery https://github.com/ludocode/pottery
I'm not really sure what makes a project take off on HN. I posted mine here a couple weeks ago and got one single upvote :(. I'm glad to see the new style of #include templates getting more attention though. I think in general it's the right way to do templates in C.
- eesmith 6y agoFWIW, for sorting in a template-like C package I use https://github.com/swenson/sort/ https://github.com/swenson/sort/ .
- ludocode 6y agoThat library is included in Pottery's benchmarks! :) It's another of the very few C libraries that use the #include template style. Pottery's intro_sort has comparable or better performance to swenson's quick_sort but with a lot more features. You can supply a move or swap expression to Pottery to swap non-bitwise-movable types, you can supply array access expressions to sort non-contiguous arrays, and it has the heapsort fallback to guarantee O(nlogn) performance. I don't have a Timsort yet though. For that, swenson's implementation is surely the best.
- eesmith 6y ago:) I'm using it for Timsort. Though in truth that's because I come from Python where it has a special fame - I haven't actually tested its performance against the other ones on my data set.