From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-27-2010 09:55 AM - last edited on 02-28-2010 09:53 AM by Support
Hi guys!
02-27-2010 11:38 AM
02-27-2010 11:44 AM
02-27-2010 11:46 AM
02-27-2010 11:59 AM
Hi Yamaeda,
for me the speed differences vary between 4:1 and 10:1.
There's a big problem (in terms of speed measurement) in your algorithm:
The speed varies very substantial due to different memory allocation needs. You constantly grow a lot of arrays (each bucket may grow in a different manner), making it hard to give a "correct" time for this type of sorting algorithm. It strongly depends on LV-internal memory allocation scheme (and of course of the data to be sorted). An advantage (???) may be that you need (a lot of) smaller chunks of memory for the sorting - but other algorithm do the sorting in place, needing no addtional memory.
Due to the (rather) complex additional layer of intermediate buffers this type of sorting will always suffer from "not perfect" memory allocation schemes. You may pre-allocate the buffers with a reasonable sized array (right now you use an initial empty array) - but then you add the overhead of keeping track of buffer usage...
02-27-2010 12:09 PM - edited 02-27-2010 12:13 PM
Hi Yamaeda,
some more testing:
For already sorted data your code is ~20 times slower, for reverse sorted data it's ~7 times slower than LV-internal sorting. For random data I "measured" ratios between 4 and 220 - and it has a tendency to produce even more bad numbers then getting better...
02-27-2010 12:19 PM
Try it again Gerd, it seems to be quite irregular in speed in my tries, probably due to memory management. For me it's been from 1,5 sec to 17 secs with 1m numbers, with most being about 2,5 sec with the corrected measurement. The removal of these wires didn't do alot of difference. (my previous post landed after your 1st)
02-27-2010 12:23 PM - edited 02-27-2010 12:25 PM
02-27-2010 04:22 PM - last edited on 02-28-2010 09:54 AM by Support