Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Funny way how NOT to speedup sorting of small arrays
Re: Funny way how NOT to speedup sorting of small arrays [message #22937 is a reply to message #19909] Mon, 31 August 2009 01:38 Go to previous messageGo to previous message
piotr5 is currently offline  piotr5
Messages: 107
Registered: November 2005
Experienced Member
a small update since I wont get the time to make a full test:

with my particular test-data I can only confirm that nothing can drastically outperform a simple sort-loop. (i.e. exchange the minimum with the first element, and continue without that first element.) only through full speed-optimization the divide-and-conquer search for a minimum can really keep up with the loop. especially shell-search isn't much faster than even bubble-sort (all that with sorting only 16 integers)! however, with a trick I managed to find a sorting-algorithm which is about twice as fast: insert-sort. insert-sort in combination with binary search and a mem-copy for the insertion is faster (with my particular test-data) than any of them. it isn't much, but it's noticable. unfortunately memcpy() isn't fair since it doesn't take care of any pick-beaurocracy -- but it certainly is faster than any piece-by-piece swapping or shifting.

in my previous message I said something which is wrong: Rolling Eyes
shell-sort is done by applying insert-sort, and not
as I said by recursively applying the same method.
recursive shell-sort would only re-do what has already
been done in the previous step!
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 1538 compilation fails
Next Topic: German language added to Docking.t of bazar/Docking
Goto Forum:
  


Current Time: Sun Apr 27 22:19:08 CEST 2025

Total time taken to generate the page: 0.03912 seconds