summaryrefslogtreecommitdiff
path: root/lib/sort.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-11-21 22:25:14 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-21 22:25:14 +0000
commit84d4ea48280f6b54fdc70fe4c8b9494e3331071e (patch)
tree67eb1ba8c72d793358608e97b8bcb9aa431b1d71 /lib/sort.t
parentc85707204c5d2a93ef021c88e43a92ba2d602304 (diff)
downloadperl-84d4ea48280f6b54fdc70fe4c8b9494e3331071e.tar.gz
Implement the sort pragma. Split sort code from pp_ctl.c
to pp_sort.c. Includes the quicksort stabilizing layer from John P. Linderman. -Msort=qsort or -Msort=fast is faster than without (or with -Msort=mergesort or -Msort=safe) for short random inputs, but for some reason not quite as fast as 5.6.1 qsort. More benchmarking, profiling, tuning, and optimizing definitely needed. p4raw-id: //depot/perl@13179
Diffstat (limited to 'lib/sort.t')
-rw-r--r--lib/sort.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sort.t b/lib/sort.t
new file mode 100644
index 0000000000..6b607161d0
--- /dev/null
+++ b/lib/sort.t
@@ -0,0 +1,17 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+use Test::More tests => 2;
+
+BEGIN {
+ require "sort.pm"; # require sort; does not work
+ ok(sort::current() eq 'mergesort');
+}
+
+use sort 'fast';
+ok(sort::current() eq 'quicksort fast');
+