# parrot/parrot

### Subversion checkout URL

You can clone with
or
.

# Added a simple sort benchmark#917

Closed
wants to merge 3 commits into from
+48 −0

### 2 participants

A simple sort benchmark written in PIR.

Written for issue #175.

 mrshu added a simple sort benchmark eaecde7 mrshu added command line option 45be9e7 mrshu updated docs 1248f2c
Collaborator

Thanks. Added as mrshu/simple_sort_benchmark-gh175. See GH #175

closed this
to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 6, 2013
1. mrshu committed
2. mrshu committed
3. mrshu committed
This page is out of date. Refresh to see the latest.
Showing with 48 additions and 0 deletions.
1. +48 −0 examples/benchmarks/sort.pir
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: +
Something went wrong with that request. Please try again.