Skip to content

Commit

Permalink
remove the old .nqp-based benchmarks. Replace with a series of pir-ba…
Browse files Browse the repository at this point in the history
…sed benchmarks with a factored library file
  • Loading branch information
Whiteknight committed Feb 7, 2010
1 parent 4861ec0 commit cb7ecff
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 505 deletions.
95 changes: 95 additions & 0 deletions benchmarks/benchmarker.pir
@@ -0,0 +1,95 @@
.sub push_shift_benchmarks
.param string targettype
.param int numtrials
.param int preallocate

$P0 = new [targettype]
$P1 = new ['Integer']
$P1 = 5
$I0 = numtrials
$N0 = time

if preallocate goto preallocate_storage
goto storage_is_ok
preallocate_storage:
$P0 = numtrials
storage_is_ok:

push_loop_top:
push $P0, $P1
$I0 = $I0 - 1
if $I0 == 0 goto push_loop_bottom
goto push_loop_top
push_loop_bottom:
$N1 = time
$I0 = numtrials
shift_loop_top:
$P2 = shift $P0
$I0 = $I0 - 1
if $I0 == 0 goto shift_loop_bottom
goto shift_loop_top
shift_loop_bottom:
$N2 = time
$N3 = $N1 - $N0
$N4 = $N2 - $N1
$N5 = $N2 - $N0
print_partial_result(targettype, "push ", numtrials, $N3)
print_partial_result(targettype, "shift", numtrials, $N4)
print_partial_result(targettype, "total", numtrials, $N5)
.end

.sub push_pop_benchmarks
.param string targettype
.param int numtrials
.param int preallocate

$P0 = new [targettype]
$P1 = new ['Integer']
$P1 = 5
$I0 = numtrials
$N0 = time

if preallocate goto preallocate_storage
goto storage_is_ok
preallocate_storage:
$P0 = numtrials
storage_is_ok:

push_loop_top:
push $P0, $P1
$I0 = $I0 - 1
if $I0 == 0 goto push_loop_bottom
goto push_loop_top
push_loop_bottom:
$N1 = time
$I0 = numtrials
shift_loop_top:
$P2 = pop $P0
$I0 = $I0 - 1
if $I0 == 0 goto shift_loop_bottom
goto shift_loop_top
shift_loop_bottom:
$N2 = time
$N3 = $N1 - $N0
$N4 = $N2 - $N1
$N5 = $N2 - $N0
print_partial_result(targettype, "push ", numtrials, $N3)
print_partial_result(targettype, "pop ", numtrials, $N4)
print_partial_result(targettype, "total", numtrials, $N5)
.end

.sub print_partial_result
.param string targettype
.param string operation
.param int numtrials
.param num totaltime

print "("
print targettype
print ") Time to "
print operation
print " "
print numtrials
print ": "
say totaltime
.end
103 changes: 0 additions & 103 deletions benchmarks/fixedpmcqueue.nqp

This file was deleted.

11 changes: 11 additions & 0 deletions benchmarks/fixedpmcqueue.pir
@@ -0,0 +1,11 @@
.sub main :main
.local pmc pds
pds = loadlib "./dynext/pds_group"
if pds goto has_pds_group
exit 1
has_pds_group:
push_shift_benchmarks("FixedPMCQueue", 100000, 1)
say ""
.end

.include "benchmarks/benchmarker.pir"
101 changes: 0 additions & 101 deletions benchmarks/fixedpmcstack.nqp

This file was deleted.

11 changes: 11 additions & 0 deletions benchmarks/fixedpmcstack.pir
@@ -0,0 +1,11 @@
.sub main :main
.local pmc pds
pds = loadlib "./dynext/pds_group"
if pds goto has_pds_group
exit 1
has_pds_group:
push_pop_benchmarks("FixedPMCStack", 1000000, 1)
say ""
.end

.include "benchmarks/benchmarker.pir"
13 changes: 13 additions & 0 deletions benchmarks/resizablepmcarray.pir
@@ -0,0 +1,13 @@
.sub main :main
.local pmc pds
pds = loadlib "./dynext/pds_group"
if pds goto has_pds_group
exit 1
has_pds_group:
push_pop_benchmarks("ResizablePMCArray", 1000000, 0)
say ""
push_shift_benchmarks("ResizablePMCArray", 100000, 0)
say ""
.end

.include "benchmarks/benchmarker.pir"

0 comments on commit cb7ecff

Please sign in to comment.