Re: Optimizing basic operations

new topic     » goto parent     » topic index » view thread      » older message » newer message
Spock said...

James, I've done my own tests on various sort types and came to the same conclusions as you have. Here are a couple of suggestions:

1) Don't try and optimize the sort now, just get your overall algo functioning as it should and then optimize the sort later.

2) If what you're sorting is not simple, like a flat sequence of ints or strings, you might be better off sorting a sequence of indexes to the data, rather than the data itself. Of course, you'll have to make your own sort routine - just copy an existing one and edit it and change the comparison section inside it.

3) Get some stats of your algorithm (eg, like the histogram of all the data lengths that get sorted). This could be quite insightfull as to deciding which sort would be best.

4) Being able to sort data is quite nice. But would the algorithm (what you're trying to ultimately achieve) still work if NO sorting were done?

5) If what you're sorting IS simple (like a flat sequence of ints) and you really did need Fast_Sort_Now there's always ASM Shell sort, which somebody can help with..

regards, Spock

1) I have the logic. Now working on the algorithm. The problem is complex... so, I'm trying to divide and conquer.

2) The data structure is simple enough so as not to need an index as far as I know.

3) Data lengths are all the same.

4) Yes, the algorithm would technically work but the results wouldn't be correct.

5) My data structure basically looks like this: { evaluation, {group 1 of integers}, {group 2 of integers} }. The evaluation starts out as a division / floating point, but I can convert it to an integer as approximate may be good enough. Group 1 and Group 2 always have the same length, so list could be made flat for sorting and re-grouped later. Only the evaluation needs to be sorted. The rest just come along for the ride. ASM shell sort sounds nice. How do I find this?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu