[% setvar title C algorithm to be selectable at compile time %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

sort algorithm to be selectable at compile time

VERSION

  Maintainer: Simon Cozens <simon@brecon.co.uk>
  Date: 25 Sep 2000
  Mailing List: perl6-internals@perl.org
  Number: 304
  Version: 1
  Status: Developing

ABSTRACT

Quicksort and mergesort both have their uses. Let the user choose which Perl uses.

DESCRIPTION

While this RFC is ostensibly to allow the user to say something like this:

    { 
        use sort 'quick';
        @array2 = sort @array;
    }
    use sort 'merge';
    ...

the real benefit comes when the code is being compiled into a standalone executable; given sufficient magic, the compiler can analyze the expected data flow and guess what the most suitable sort algorithm should be for each instance of sort.

IMPLEMENTATION

Provide multiple sort algorithms, and have a pragma select which Perl uses; when a program is being compiled, analyze the data and heuristically select the better algorithm if possible.

REFERENCES

None.