### Author Topic: Rule of thumb on Sorting...supposedly  (Read 2674 times)

#### Raistlin

• Member
• Posts: 552
##### Rule of thumb on Sorting...supposedly
« on: March 28, 2020, 03:46:37 AM »
Disclaimer:
More of a click-bait post, counter to my normal musings.
You have been warned.

Sorting algos listed fastests (above others in
the same grouping [Log Scale] as proclaimed generizable assertion)
according to assembly enthusiast you-tuber (reference on PM request
if interested):
Small number of elements = Insertion sort (max 50 to 100 elements)
Mid size number of elements = STD-STL sort (up to max 1500 or so)
Large sizes = Radix sort (very large 2000+ and beyond)

Your thoughts appreciated. My own crappy code attempt
to follow.

Regards
Raistlin
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

#### daydreamer

• Member
• Posts: 2398
• my kind of REAL10 Blonde
##### Re: Rule of thumb on Sorting...supposedly
« Reply #1 on: March 28, 2020, 05:45:03 AM »
Different way of sort, new kinda challenge , wonder what will be fastest with unicode Chinese numbers?,ascii is simple 0-9 all in right order
Chinese unicode number characters, is random order 1,2,3,4,5,6,7,8,9,10,100,1000,10000...
Is placed maybe complexity or number of lines among cjk kanji characters?
http://masm32.com/board/index.php?topic=8416.msg92116#new
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

#### jj2007

• Member
• Posts: 13951
• Assembly is fun ;-)
##### Re: Rule of thumb on Sorting...supposedly
« Reply #2 on: March 28, 2020, 11:02:18 AM »
Large sizes = Radix sort (very large 2000+ and beyond)

ArraySort() uses a radix sort. It is very fast, and beats all other algos when sorting small integers, e.g. up to 2^16 or so. For strings I use a stable MergeSort instead.

For all sorts 2000+ is not "very large" but rather "tiny". Sorting 44,000 strings takes typically 70ms, but for one Million strings you need a full second. Sorting small numbers of elements (<10,000) is always blazing fast. The real challenge starts above one Million.

• Member
• Posts: 249
##### Re: Rule of thumb on Sorting...supposedly
« Reply #3 on: March 28, 2020, 10:18:17 PM »
Maybe you'll be interested in Skip-list algo for Large sizes lists.

#### jj2007

• Member
• Posts: 13951
• Assembly is fun ;-)
##### Re: Rule of thumb on Sorting...supposedly
« Reply #4 on: March 29, 2020, 01:29:34 AM »
Maybe you'll be interested in Skip-list algo for Large sizes lists.

Quote
a linked list-like structure that allows insertion, which is not possible in an array

Written by a linked list fan

• Member
• Posts: 249
##### Re: Rule of thumb on Sorting...supposedly
« Reply #5 on: March 29, 2020, 07:45:08 AM »
Written by a linked list fan
Really, I mean algo that in cases decrease amount of comparations, for sorting algo - for huge amount of data good.

#### daydreamer

• Member
• Posts: 2398
• my kind of REAL10 Blonde
##### Re: Rule of thumb on Sorting...supposedly
« Reply #6 on: March 29, 2020, 09:55:32 PM »
special case:but wasnt BSP tree slowest when precalculating and fastest when its just traverse a Binary tree to a leaf that tells it which walls are visible?
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding