Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added a simple sort benchmark #917

Closed
wants to merge 3 commits into from

2 participants

Marek Šuppa Reini Urban
Marek Šuppa

A simple sort benchmark written in PIR.

Written for issue #175.

Reini Urban
Collaborator

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

Reini Urban rurban closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 6, 2013
  1. Marek Šuppa

    added a simple sort benchmark

    mrshu authored
  2. Marek Šuppa

    added command line option

    mrshu authored
  3. Marek Šuppa

    updated docs

    mrshu authored
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
View
@@ -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.