Commit graph

4224 commits

Author SHA1 Message Date
Sebastian Ullrich
76753a0696 test(tests/playground/expr_const_folding): add Swift translation 2019-02-19 11:24:10 +01:00
Sebastian Ullrich
ddab7bcea8 test(tests/playground/expr_const_folding): Haskell version 2019-02-18 14:59:33 +01:00
Sebastian Ullrich
59d19aee2b test(tests/playground/expr_const_folding): fix Lean version 2019-02-18 14:29:07 +01:00
Leonardo de Moura
aff5f96a3d test(tests/playground): simple task benchmarks 2019-02-17 11:47:02 -08:00
Leonardo de Moura
dfce086c9e test(tests/compiler/array_test): basic array test 2019-02-16 16:08:49 -08:00
Leonardo de Moura
821bdcdac0 chore(tests/playground): add helper files 2019-02-15 18:13:37 -08:00
Leonardo de Moura
542bd432f8 test(tests/compiler): uint constant folding tests 2019-02-15 14:53:29 -08:00
Sebastian Ullrich
03456ab752 chore(tests/compiler/t2): fix test 2019-02-15 12:13:45 -08:00
Sebastian Ullrich
b8900fad80 chore(tests/compiler/test.sh): rename to conventional test_single.sh so that (lean4-diff-test-file) works 2019-02-15 12:13:45 -08:00
Leonardo de Moura
eef60279e4 tests(tests/playground/expr_const_folding): another example for the paper
@kha I implemented a more complex example for the paper. The difference
in performance is awesome. On my Linux desktop:

Lean time:  3.34  secs
OCaml time: 11.72 secs

I believe that the difference in performance is due to destructive
updates happening in transformation functions such as `reassoc` and
`const_folding`. I will add a flag to Lean to disable `reuse/reset`
automatic insertion.

BTW, this test requires `ulimit -s unlimited` to avoid stack overflows.
2019-02-15 12:07:52 -08:00
Leonardo de Moura
f879cdb12f test(tests/playground): add new example in Lean and OCaml
@kha I wrote a simple test in Lean and OCaml. Right now, the numbers on
my machine are

arith_eval.ml         8.13 secs
arith_eval_nat.lean   10.71 secs

OCaml is computing with machine boxed integers, and we are computing
with `nat`. Our version is more expensive since we have to check
whether the number is small or big, and whether the result needs to be a
mpz value or not.

Almost half of our runtime is spent deallocating the big object returned
by `mk_expr`. The deferred free feature does not help here because
we don't deallocate the object in the end but as we execute `eeval`.
So, we perform many small invocations to `del`. None of them take
long, but the overall cost is super high. I can use a different strategy
where `del(o)` just updates the `g_to_free` list, and we deallocate
at most `LEAN_DEFERRED_FREE_QUOTA` at each allocation. The current
deferred free approach would also work if we could use the borrowed
annotations in `eeval`. In this case, we would not delete the input
expression as we evaluate it.

As an experiment, I manually added a `lean::inc` before invoking
`eeval`. The idea was prevent memory deallocation. With this
modification, the program runs in 5.87 secs.

BTW, I also wrote a version using uint32 (arith_eval_uint32.lean),
but the current compiler generates poor code for it.
I know how to fix the performance problem.
2019-02-14 15:50:07 -08:00
Leonardo de Moura
6083bde3bc chore(tests/playground/deriv): add example for testing in the playground 2019-02-14 10:49:46 -08:00
Leonardo de Moura
b6d1506434 fix(tests/compiler/t2): pause at the end
@kha I figured out why we had a long pause in the end of this benchmark
when using `11` instead of `9`. The function `deriv` was computing
`d := d "x" f` (the expensive computation), printing the size of `f` and
returning `d`. So, in the last step we were quickly printing the size
of the input 40230090 (when using `nest deriv 11 f`), and then computing
`d := d "x" f` which returns an object of size 374429936 which is never
used for anything.
That is, the pause had nothing to do with memory deallocation. I found
this issue after I implemented the deferred free feature which did not
fix the pause :)
2019-02-14 10:44:59 -08:00
Leonardo de Moura
1716f1f6c9 test(tests/playground/perf): performance test
On my macbook,
- with default kind STHeap: 3.15 secs
- with default kind MTHeap: 3.75 secs

@cc kha
2019-02-14 08:43:04 -08:00
Leonardo de Moura
6f852cf7af feat(tests/playground): add run.sh script for running tests
@kha I have added `timeit` for running experiments for the paper.
We have to be careful because `timeit` may produce incorrect results
due to compiler optimizations (e.g., ground term extraction).
Here are examples that do not produce the result we expect:

```
def main : io uint32 :=
timeit "tst" (io.println' ("result " ++ to_string (tst 1000000))) *>
pure 0
```

```
def main (xs : list string) : io uint32 :=
timeit "tst" (io.println' ("result " ++ to_string (tst xs.head.to_nat))) *>
pure 0
```
2019-02-13 17:17:14 -08:00
Leonardo de Moura
19e111c2ff feat(library/compiler): allow main function to also have type io uint32 2019-02-13 16:29:10 -08:00
Leonardo de Moura
06bb9b7ea8 test(tests/compiler): add simple test for expr 2019-02-13 16:22:01 -08:00
Sebastian Ullrich
534b507aff feat(library/init/lean/frontend): rework error reporting 2019-02-12 13:34:32 +01:00
Leonardo de Moura
7e8f9e6f66 feat(library/compiler): add [extern] attribute 2019-02-09 18:53:44 -08:00
Sebastian Ullrich
67f8f7a2da chore(tests/compiler/append): add expected output 2019-02-09 20:02:26 +01:00
Leonardo de Moura
6cb96331b1 chore(tests/compiler): add .gitignore 2019-02-08 16:59:17 -08:00
Leonardo de Moura
5dcbb9c50d test(tests/compiler/append): append test 2019-02-08 16:52:41 -08:00
Leonardo de Moura
01119b529f test(tests/compiler): add thunk test
This test will take a long time if `thunk` result is not cached.
2019-02-08 11:01:33 -08:00
Leonardo de Moura
e2ee2d4bd9 chore(tests/compiler): add deriv test 2019-02-07 16:56:40 -08:00
Leonardo de Moura
259941c184 chore(tests/compiler/test_flags): include release flags
@kha The `-O3` option is not at CMAKE_CXX_FLAGS, but in build mode
specific configuration. I added this hack because I want to include
performance tests too. Perhaps, I should move performance tests to a
different directory.
2019-02-07 16:30:30 -08:00
Leonardo de Moura
109d569310 feat(tests/compiler): add first test 2019-02-07 12:14:25 -08:00
Leonardo de Moura
dc8edd3894 feat(tests/compiler): script skeleton
cc @kha
2019-02-07 11:54:46 -08:00
Sebastian Ullrich
4c0f836305 chore(shell/lean): reduce lean interface to taking a single file, assuming all dependencies have already been built 2019-01-25 18:27:38 +01:00
Sebastian Ullrich
9f90dbfd3d feat(library/init/lean/parser/syntax): improve syntax.get_pos for more error positions 2019-01-22 11:16:00 +01:00
Sebastian Ullrich
69e363446d fix(library/init/lean/{parser/term,elaborator}): local notations override previous notations 2019-01-20 16:25:15 +01:00
Leonardo de Moura
c3dfb613d5 test(tests/lean/run/rc_tests): basic explicit_rc_fn tests 2019-01-17 15:25:27 -08:00
Sebastian Ullrich
3611eda136 fix(frontends/lean/vm_elaborator): message order 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
3d66e7dbe1 fix(library/pos_info_provider): row and column were swapped 2019-01-16 19:12:40 +01:00
Sebastian Ullrich
5660a8e690 feat(library/init/lean/elaborator): transmit position information 2019-01-15 18:28:35 +01:00
Sebastian Ullrich
9ac41835ba test(tests/lean/parser1): add some name resolution tests 2019-01-06 18:22:18 +01:00
Sebastian Ullrich
32a3c0e62e feat(library/init/lean/frontend,bin/lean-bootstrapped): expose new frontend as executable 2018-12-20 14:28:18 +01:00
Sebastian Ullrich
0911d16bc3 feat(library/init/lean): compute and show error positions 2018-12-20 14:28:18 +01:00
Sebastian Ullrich
e5aaf391ff fix(library/init/lean/parser/syntax): macro_scopes.flip 2018-12-19 15:04:48 +01:00
Sebastian Ullrich
1d524476b7 chore(tests/lean/parser1): restore #exit... 2018-12-12 11:06:52 +01:00
Sebastian Ullrich
94dec2cb9f feat(library/init/lean/elaborator): elaborate universe 2018-12-11 19:01:41 +01:00
Sebastian Ullrich
11e5d1a8a2 chore(tests/lean/parser1): reintroduce #exit in front of core.lean test 2018-12-06 13:23:25 +01:00
Sebastian Ullrich
143ac0e58a feat(library/init/lean/expander): also normalize bracketed binders in e.g. declarations 2018-12-06 13:23:12 +01:00
Sebastian Ullrich
58def30036 chore(tests/lean/parser1): clearly delimit components in profiler output 2018-12-04 12:31:13 +01:00
Leonardo de Moura
607d22ae58 fix(library/compiler/csimp): bug at float_cases_on_core
The bug occurs when floating `cases_on` application in code of the form
```
let x := C.cases_on ...
in t
```
and when the type of `t` depends on `x`.
The issue here is that the `x` declaration disappears after the float, but the resulting type still depends on it.
We fix the bug by replacing `x` with its value in the type.

cc @kha
2018-11-30 11:40:41 -08:00
Sebastian Ullrich
fd121f03bd feat(library/init/lean/expander): make set of transformers configurable 2018-11-21 18:13:38 +01:00
Sebastian Ullrich
222fff8862 refactor(library/init/lean/elaborator): introduce simple lambda binder 2018-11-21 18:13:38 +01:00
Sebastian Ullrich
6d0b3afa7e fix(library/compiler/compiler): do not silently abort on user-given sorrys 2018-11-17 18:00:55 +01:00
Leonardo de Moura
04227701d6 chore(tests/lean/run): fix the tests
@kha I found the real issue with these two tests.
You have modified the compiler to ignore definitions containing `sorry` :)
2018-11-15 11:21:12 -08:00
Leonardo de Moura
d0ccaa1083 chore(tests/lean): fix tests
TODO: `io` modifications performed yesterday may have affected `eval`.
2018-11-15 10:56:03 -08:00
Leonardo de Moura
c0ac39f7f0 chore(tests/lean/parser1): fix test output 2018-11-12 08:53:57 -08:00