|
!ArmSort
v4.09 (10 Apr 2021)
|
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 Flash and Shell Sort techniques 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.
The !ArmSort application is a Program Generation facility which enables BASIC programs to
be easily created and run to sort a variety of files using the ArmSort module.
They are deliberately single-tasking, to keep them simple.
The generated programs can be run and edited from within !ArmSort,
or can be used as a basis for other manually written programs.
Changes with v4.09 (10 Apr 2021)
- First changes for nearly nine years!
- Added facility to enable sorting of Unsigned Integers.
- Updated ArmSort application to v1.06.
Changes with v4.08 (17 Jun 2012)
- Now works with processors up to ARMv7 (eg BeagleBoard), even with Alignment Exceptions on.
- Fixed problem with error 'String over 16 MB' which should be 'Duplicate Array'.
- A number of minor changes and improvements to the !ArmSort application, which is now v1.02.
Summary of ArmSort Facilities
- Easy *Sort command for use of all facilities eg *Sort Form$(e) Surname$(1i) Firstname$(2i)
- Much easier and many more facilities than OS_HeapSort for array sorting.
- 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.
- Optional sort of Integer numbers as unsigned - useful for 32-bit addresses.
- 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.
- Indirect Strings can be sorted (i.e. strings anywhere in memory),
of any length (even >255), with their addresses in an Integer array.
- 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 15KB 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.
- Example programs supplied.
- The supplied !ArmSort application can generate BASIC sort programs.
- Comprehensive Help information in StrongHelp format for ease of use.
- 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.
- Works on all ARMv2-v8 processors, including IGEPv5, IMx6, Titanium, RPi1-4.
- Uses fast Shell Sort, plus additional Flash Sort first where possible.
- Statistics option with *SortOpts command.
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 10.6 4.5 23.3
BeagleBoard 100,000 0.1 0.3 0.2 0.6
xM revC 1,000,000 1.8 7.3 2.6 15.0
10,000,000 20.6 111.3 40.5 188.0
Titanium 1,000,000 0.3 1.1 0.4 1.6
10,000,000 4.5 2.73 6.2 26.9
16,000,000 7.6 41.1 10.5 43.0
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, and 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.09 please click on
!ArmSort (72 kByte Zip Archive)
Please click home to return to the Avisoft home page.
E&OE. © Copyright Martin Avison, 2012.
Last updated: Tue 16th November 2021
Please send any queries or comments to
This site is hosted by Force9 on Plusnet