Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'mrshu/simple_sort_benchmark-gh175'

  • Loading branch information...
commit 5260e25d17e9e7d1e5bcc45e2e69fb99e10c8e62 2 parents f08b160 + 2dbfd6a
@leto leto authored
Showing with 49 additions and 0 deletions.
  1. +1 −0  MANIFEST
  2. +48 −0 examples/benchmarks/sort.pir
View
1  MANIFEST
@@ -506,6 +506,7 @@ examples/benchmarks/primes2.rb [examples]
examples/benchmarks/primes2_i.pir [examples]
examples/benchmarks/primes_i.pasm [examples]
examples/benchmarks/rand.pir [examples]
+examples/benchmarks/sort.pir [examples]
examples/benchmarks/stress.pasm [examples]
examples/benchmarks/stress.pl [examples]
examples/benchmarks/stress.rb [examples]
View
48 examples/benchmarks/sort.pir
@@ -0,0 +1,48 @@
+# Copyright (C) 2013, Parrot Foundation.
+
+=head1 NAME
+
+examples/benchmarks/sort.pir - Sort an FixedIntegetArray of N integers
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/sort.pir
+
+=head1 DESCRIPTION
+
+Sorts an FixedIntegetArray of N random integers using builtin sort
+function for FixedIntegetArray. The argument N is specified from the
+command line.
+
+=cut
+
+.loadlib 'math_ops'
+
+.sub main :main
+ .param pmc argv
+ .local int N, i, j
+
+ N = argv[1]
+ $P0 = new ['FixedIntegerArray'], N
+ i = 0
+ j = 0
+
+LOOP:
+ j = rand 0, N
+ $P0[i] = j
+ inc i
+ if i < N goto LOOP
+
+ $P0.'sort'()
+
+.end
+
+
+=cut
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+
Please sign in to comment.
Something went wrong with that request. Please try again.