Commit b29a5402 authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

Add benchmark for product.

* configure.ac,
* src/bench/Makefile.am,
* src/bench/generate_bench.sh: Add new makefiles/directories.
* src/bench/product/Makefile.bench,
* src/bench/product/product_aut_b_bool_bench.hh,
* src/bench/product/product_aut_b_z_bench.hh: New. Implementation.
parent 71fbd82b
2009-06-19 d-halluin <d-halluin@lrde.epita.fr>
Add benchmark for product.
* configure.ac,
* src/bench/Makefile.am,
* src/bench/generate_bench.sh: Add new makefiles/directories.
* src/bench/product/Makefile.bench,
* src/bench/product/product_aut_b_bool_bench.hh,
* src/bench/product/product_aut_b_z_bench.hh: New. Implementation.
2009-06-19 d-halluin <d-halluin@lrde.epita.fr>
 
Benchmarks: rename aut_ab into aut_b.
......
......@@ -299,6 +299,7 @@ AC_CONFIG_FILES([
src/bench/iterators/Makefile
src/bench/accessible/Makefile
src/bench/minimization/Makefile
src/bench/product/Makefile
src/bench/quotient/Makefile
tools/Makefile
include/Makefile
......
......@@ -19,12 +19,12 @@
SUBDIRS = common determinization \
minimization derived_terms \
quotient composition eps_removal \
iterators accessible
iterators accessible product
BENCHDIRS = determinization minimization \
derived_terms quotient \
composition eps_removal \
iterators accessible
iterators accessible product
bench:
for f in $(BENCHDIRS); do \
......
#!/bin/sh
e#!/bin/sh
# Vaucanson, a generic library for finite state machines.
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 The Vaucanson Group.
......@@ -101,7 +101,7 @@ case $1:$# in
BENCH_DIRS="determinization \
minimization derived_terms \
quotient composition eps_removal \
iterators accessible"
iterators accessible product"
;;
--all:* | *:0)
echo >&2 "invalid arguments: $@"
......
# product/Makefile.bench * -*- Makefile -*-
bench: all
@mkdir aut_b_bool; \
mkdir aut_b_z; \
echo '==============='; \
echo '|Product bench|'; \
echo '==============='; \
for n in $$(seq 5 13); do \
echo "----------------------For $$n"; \
echo "--------------VCSN (over Z):"; \
./product_aut_b_z_bench $$n; \
echo "--------------VCSN (over B):"; \
./product_aut_b_bool_bench $$n; \
done;
bench-clean:
rm -rf aut_b_bool
rm -rf aut_b_z
// product_aut_b_bench.hh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2005, 2006 The Vaucanson Group.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
#include <vaucanson/boolean_automaton.hh>
#include <vaucanson/algorithms/product.hh>
#include <iostream>
#include <fstream>
using namespace vcsn;
using namespace vcsn::boolean_automaton;
#include <common/bench_constructs.hh>
void product_aut_b_bool_bench(int n)
{
automaton_t a = aut_b();
automaton_t b = a;
std::stringstream n_str;
n_str << n;
BENCH_START("Vaucanson product (over B)",
"Automaton product benchmark using Vaucanson.\n"
"\n"
"Input automaton is aut_b.\n"
"(see src/bench/common/README_AUTOMATA for aut_b).\n"
"\n"
"Process:\n"
"\n"
"1. Generate a and b, both aut_b.\n"
"2* Do a = product(a, b) n times.\n");
n--;
while (n--)
a = product(a, b);
BENCH_STOP();
// Set extra parameters/results
BENCH_PARAMETER("_n_", n_str.str());
BENCH_PARAMETER("over", "B");
BENCH_RESULT("product states", (long) a.states().size());
BENCH_RESULT("product transitions", (long) a.transitions().size());
std::string name = "aut_b_bool/bench_product_aut_b_bool_" + n_str.str();
// Save and print
BENCH_VCSN_SAVE_AND_PRINT(name);
}
// product_aut_b_bench.hh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2005, 2006 The Vaucanson Group.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
#include <vaucanson/z_automaton.hh>
#include <vaucanson/algorithms/product.hh>
#include <iostream>
#include <fstream>
using namespace vcsn;
using namespace vcsn::z_automaton;
#include <common/bench_constructs.hh>
void product_aut_b_z_bench(int n)
{
automaton_t a = aut_b();
automaton_t b = a;
std::stringstream n_str;
n_str << n;
BENCH_START("Vaucanson product (over Z)",
"Automaton product benchmark using Vaucanson.\n"
"\n"
"Input automaton is aut_b.\n"
"(see src/bench/common/README_AUTOMATA for aut_b).\n"
"\n"
"Process:\n"
"\n"
"1. Generate a and b, both aut_b.\n"
"2* Do a = product(a, b) n times.\n");
n--;
while (n--)
a = product(a, b);
BENCH_STOP();
// Set extra parameters/results
BENCH_PARAMETER("_n_", n_str.str());
BENCH_PARAMETER("over", "Z");
BENCH_RESULT("product states", (long) a.states().size());
BENCH_RESULT("product transitions", (long) a.transitions().size());
std::string name = "aut_b_z/bench_product_aut_b_z_" + n_str.str();
// Save and print
BENCH_VCSN_SAVE_AND_PRINT(name);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment