!ArmSort
v4.01 03 Mar 2008)
ArmSort is a module which provides BASIC programmers with very easy and
fast facilities for sorting arrays on an Acorn RISC machine.
ArmSort caters automatically for ANY number of ANY type of single or
multiple dimension BASIC array, in ANY combination of Integer, String, Indirect String or
Floating Point arrays, in ANY key sequence. It also has flexible
parameters and comprehensive error checking. ArmSort is VERY fast (see
below), using the Shell Sort technique in ARM Machine Code, and it is
therefore very capable of complex sorts on the large data volumes that the
Archimedes and RISC PC are able to hold and process.
Fixes in v4.01
- Fixed Flash Class error with SuperFPEm.
- Fixed problem with SortOpt from Obey file.
New Facilities of v4
- Significant performance improvements by
(a) improving the existing Shell Sort, and
(b) using an additional Flash Sort first where possible.
Reductions in time of 50% are normal; up to 80% has been seen!
- Removal of 16MB WimpSlot limit for sorting String arrays.
Any BASIC strings can now be sorted, certainly up to 400MB and
hopefully more!
- New ability to sort Indirect Strings, i.e. strings anywhere in memory,
of any length (even >255), with their addresses in an Integer array.
- There are NO changes to the *Sort command interface, so any programs
using v3.20 will work unchanged.... but maybe faster!
- Removal of message when ArmSort module is loaded or removed.
- New Statistics option and *SortOpts command.
- New !ArmSort application v1.00, which can be used for generating
programs for occasional sorts, or as a basis for inclusion in your
programs. This is an initial release, and may have some limitations!
Facilities of v3.20
- Much easier and many more facilities than OS_HeapSort for array sorting.
- Easy *Sort command for use of all facilities eg *Sort Form$(e) Surname$(1i) Firstname$(2i)
- Will sort Multiple dimension arrays as well as Single dimension.
- Sorts Ascending by default, or optionally Descending.
- Handles variable length strings, which may contain any hex value.
- Optional sort of lower case string characters as upper case.
- Optional sort of Integer or Floating Point numbers ignoring sign.
- Sorts null strings high by default, or optionally low.
- String sorts can start at any position in the string.
- Strings can be sorted by length of the string.
- 64 bit Floating Point arrays can be sorted in BASIC VI (BASIC64).
- Can sort many arrays together, as if one long concatenated variable.
- Multiple arrays can be concatenated in any sequence for sort key.
- Can Exclude arrays used only for reference, not part of sort key.
- Can sort all elements or only specified elements of arrays.
- Different options can be used with each array.
- Relocatable Module only 6k bytes long - and needs little extra storage.
- Help is included in the module - use *HELP Sort.
- Escape will interrupt sort.
- Sort capacity (elements and arrays) limited only by memory size for arrays.
- Comprehensive parameter validation and explanatory error messages.
- ArmSort is supplied as an application to simplify use.
- Revised Help information in StrongHelp format for ease of use.
- Example programs supplied.
- FindProcs procedure library enables fast and easy searching of sorted arrays.
- Will run with all known versions of BASIC V and BASIC VI.
- Will run with all known RISC OS versions 3 to 5.
Simple Use of ArmSort
To sort an array in a BASIC program, the program must define the array, put some data into it, then just include a line in the program with the command
*Sort Arrayname()
and when the program is run the array should be sorted into sequence!
If the program lists the contents of the array before and after the *Sort you
will see the effects of the sort.
It really is that easy!
However, there are many more sophisticated options which are described in the !Help documentation, but which are hopefully just as easy to use.
Performance
Approximate times in seconds for sample sorts using ArmSort are as follows:
Machine Elements Integer String Float Multiple
RPC 203Mhz SA 10,000 0.0 0.5 0.1 2.1
100,000 0.5 1.7 0.8 28.5
1,000,000 6.5 24.1 10.3 ----
Iyonix 10,000 0.0 0.3 0.0 0.9
100,000 0.2 0.8 0.3 13.0
1,000,000 2.8 11.5 4.5 188.3
Note that these times were with randomly generated values, with 10% of them set to the same value. The strings were varying 1-10 alpha characters, with 10% null.
Actual times will vary obviously with the machine model, but also depending on the actual values sorted, their initial sequence, possibly the screen MODE.
The sorts were single arrays, except Multiple which was 3 (Integer, String, and a Real).
Indirect Strings are very similar times to normal Strings.
With BASIC VI, the Floating Point times are roughly the same.
How to obtain ArmSort
To download complete v4.01 please click on
!ArmSort (67 kByte Zip Archive)
To download update from v4.00 please click on
!ArmSort update (35 kByte Zip Archive)
Please click home to return to the Avisoft home page.
E&OE. © Copyright Martin Avison, 2008.
Last updated: Tue 25th March 2008
Please send any queries or comments to
This site is hosted by Force9 Internet