Skip to content
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

Non-recursive shell sort #101

Closed
wants to merge 1 commit into from

Conversation

funny-falcon
Copy link

Shell-sort is straight-forward non-recursive algorithm.
It is comparable in performance to naive qsort up to million items.

Shell-sort is straight-forward non-recursive algorithm.
It is comparable in performance to naive qsort up to million items.
@ianlancetaylor
Copy link
Owner

The libbacktrace sort time is a big percentage of its performance on large programs. I have not seen any complaints about running out of stack space during the sort. So this doesn't seem like a desirable change.

Have you run any benchmarks on large programs?

@funny-falcon
Copy link
Author

funny-falcon commented Jan 5, 2023

I've integrated libbacktrace into PostgreSQL, and by 'perf record' shell sort is just a bit slower (3-7%). (ie 12% vs 13% of total cpu usage).

To be honestly, looking on swap function it was hard to guess sorting is performance critical.

Given all array elements passed to backtrace_qsort are pointer-aligned, I've made PR #102. It makes sorting 2.5 times faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants