chore(tests/bench): move out from playground/
This commit is contained in:
parent
d082a7e42f
commit
9b9465d299
50 changed files with 44 additions and 31 deletions
5
tests/bench/.gitignore
vendored
Normal file
5
tests/bench/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
*.out
|
||||
*.lean.cpp
|
||||
*.cmi
|
||||
*.cmx
|
||||
*.o
|
||||
28
tests/bench/compile.sh
Executable file
28
tests/bench/compile.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: compile.sh [file]"
|
||||
exit 1
|
||||
fi
|
||||
ulimit -s 8192
|
||||
BIN_DIR=../../bin
|
||||
LEAN=$BIN_DIR/lean
|
||||
export LEAN_PATH=../../library:.
|
||||
ff=$1
|
||||
|
||||
if [[ "$OSTYPE" == "msys" ]]; then
|
||||
# Windows running MSYS2
|
||||
# Replace /c/ with c:, and / with \\
|
||||
ff=$(echo $ff | sed 's|^/\([a-z]\)/|\1:/|' | sed 's|/|\\\\|g')
|
||||
fi
|
||||
|
||||
$LEAN --cpp="$ff".cpp "$ff"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to compile $ff into C++ file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$BIN_DIR/leanc -O3 -o "$ff.out" $ff.cpp
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to compile C++ file $ff.cpp"
|
||||
exit 1
|
||||
fi
|
||||
2
tests/bench/leanpkg.path
Normal file
2
tests/bench/leanpkg.path
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
builtin_path
|
||||
path .
|
||||
9
tests/bench/run.sh
Executable file
9
tests/bench/run.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: run.sh [file] [args]*"
|
||||
exit 1
|
||||
fi
|
||||
ff=$1
|
||||
./compile.sh $ff
|
||||
shift 1
|
||||
time "./$ff.out" $*
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
for bench in "$@"; do
|
||||
echo "benchmarking $bench"
|
||||
time $bench >/dev/null
|
||||
done
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
{ pkgs ? import ./nixpkgs.nix }:
|
||||
|
||||
let
|
||||
lean = cmakeFlags: (pkgs.callPackage ../../default.nix { stdenv = pkgs.llvmPackages_7.stdenv; }).overrideAttrs (_: { inherit cmakeFlags; });
|
||||
ghc = hsPkgs: (pkgs.haskellPackages.ghcWithPackages hsPkgs).override { ghc = pkgs.haskell.compiler.ghc865; withLLVM = true; };
|
||||
ocaml = pkgs.ocaml-ng.ocamlPackages_4_07.ocaml;
|
||||
# note that this will need to be compiled from source
|
||||
ocamlFlambda = ocaml.override { flambdaSupport = true; };
|
||||
in {
|
||||
buildLean = { name, src, cmakeFlags ? "", leancFlags ? "-O3" }: pkgs.stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
buildCommand = "${lean cmakeFlags}/bin/lean --cpp=$src.cpp $src && ${lean cmakeFlags}/bin/leanc $src.cpp -o $out";
|
||||
};
|
||||
buildHs = { name, src, opts, hsPkgs ? (p : []) }: pkgs.stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
buildCommand = "${ghc hsPkgs}/bin/ghc ${opts} $src -o $out";
|
||||
};
|
||||
buildOCaml = { name, src, opts }: pkgs.stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
buildCommand = "${ocaml}/bin/ocamlopt.opt ${opts} $src -o $out";
|
||||
};
|
||||
buildOCamlFlambda = { name, src, opts }: pkgs.stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
buildCommand = "${ocamlFlambda}/bin/ocamlopt.opt ${opts} $src -o $out";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue