Commit graph

4275 commits

Author SHA1 Message Date
Sebastian Ullrich
f160fd8de0 chore(tests): compile tests using -O3 again 2019-03-18 17:55:28 +01:00
Sebastian Ullrich
f6d3062524 feat(bin/leanc): add simple C++ compiler wrapper script 2019-03-18 16:11:30 +01:00
Leonardo de Moura
1da4782483 feat(runtime, library/init/io): add io.ref 2019-03-16 22:16:28 -07:00
Leonardo de Moura
b1c187f717 feat(library/compiler): allow io unit as main function result type
When `io unit` is used, we use `return 0` for `result.ok`, and `return
1` for `result.except`.
2019-03-16 16:05:45 -07:00
Leonardo de Moura
6d0ec3a8c9 refactor(library/init/io): implement io monad using estate monad 2019-03-16 15:34:58 -07:00
Leonardo de Moura
3eedc327c7 feat(tests/playground/flat_parser): tail recursive many combinator 2019-03-14 16:11:51 -07:00
Leonardo de Moura
39dd079e37 feat(runtime): low tech allocation profiler
```
@[extern 4 "lean_io_allocprof"]
constant allocprof {α : Type} (msg : @& string) (fn : io α) : io α
```
2019-03-14 15:15:29 -07:00
Leonardo de Moura
39e752d28a chore(tests/playground/flat_parser): remove debugging stuff 2019-03-14 11:05:13 -07:00
Leonardo de Moura
44cdb1fc56 chore(tests/playground/flat_parser): add new file_map
Goal: minimize the number of constructor object allocations.
They derailed me when I was looking for performance bottlenecks in the
flat_parser.
2019-03-14 08:38:08 -07:00
Leonardo de Moura
e50d8e0b92 chore(tests/playground/flat_parser): continue experiment 2019-03-13 16:40:12 -07:00
Leonardo de Moura
3fe6858a93 feat(library/compiler/csimp): make csimp simplifies unreachable branches
`let x := lc_unreachable in e` => `lc_unreachable`
`let x := e in lc_unreachable` => `lc_unreachable`
2019-03-13 11:45:40 -07:00
Leonardo de Moura
cf3bbd7e25 feat(runtime): add utf8_prev and utf8_set
Next goal: implement string.iterator in Lean
2019-03-11 18:05:40 -07:00
Leonardo de Moura
d55a439542 test(tests/playground/fix_1): add fix.lean variant: fix_1.lean
`fix.lean` and `fix_1.lean` are very similar, but fix.lean is almost
twice as fast. Reason: `fix.lean` uses `fix_2` instead of `fix_1` and
avoid the creation of many closures. Here are runtime numbers on my
machine.

```
time ./fix_1.lean.out 23
352321527

real	0m0.729s
user	0m0.724s
sys	0m0.000s
```

```
~/projects/lean4/tests/playground (master +)$ time ./fix.lean.out 23
352321527

real	0m0.396s
user	0m0.388s
sys	0m0.004s
```

TODO: modify the compiler to replace `fix_core_n f a_1 ... a_m`
with `fix_core_m f a_1 ... a_m` whenever `n < m`.
This feature is quite useful for writing reusable/generic code. For
example, we cannot write an efficient `rec_t` without it because we
don't know the arity of `m A` when we write `rec_t`.
2019-03-11 13:44:07 -07:00
Leonardo de Moura
1e821d4057 chore(library/init/fix): rename primitives 2019-03-11 13:41:13 -07:00
Leonardo de Moura
5402178f73 test(tests/playground): fix tests
Forgot to add them.
2019-03-11 08:11:00 -07:00
Leonardo de Moura
01b4983fa2 fix(runtime/object): string_utf8_extract 2019-03-09 12:57:51 -08:00
Leonardo de Moura
67944a6c81 test(tests/compiler/str): new test for utf8 primitives 2019-03-09 12:41:33 -08:00
Leonardo de Moura
114f7ed190 feat(tests/playground/flat_parser): minor edits
We need a low level string.iterator to efficiently implement
primitives such as `str`.
2019-03-09 08:08:37 -08:00
Leonardo de Moura
489eaf3b71 test(tests/playground/flat_parser): experiment 2019-03-08 17:09:42 -08:00
Leonardo de Moura
7b1d15ec43 fix(library/compiler/specialize): avoid work duplication in the specializer 2019-03-08 11:21:49 -08:00
Sebastian Ullrich
e0bbc094ad chore(library/init): remove coroutines from stdlib 2019-03-08 15:34:17 +01:00
Leonardo de Moura
8e9b0d2799 fix(library/compiler): inferred types for stage2 declarations 2019-03-06 17:24:43 -08:00
Sebastian Ullrich
3b06c52d4f test(tests/playground/Makefile): re-add original ocamlopt parameters
This reverts commit 8e212ef9d9.
2019-03-05 15:44:42 +01:00
Sebastian Ullrich
069c07fa39 test(tests/playground/Makefile): update 2019-03-05 15:44:39 +01:00
Sebastian Ullrich
90a058a655 test(tests/playground/Makefile): bench fallback, all Lean tests 2019-03-05 15:44:03 +01:00
Sebastian Ullrich
467799c6c3 test(tests/playground/run.sh): fix 2019-03-05 15:37:11 +01:00
Leonardo de Moura
e5950cf710 test(tests/playground/gen): simple lean file generator
@kha
I am using this little program to generate big lean files to test the
new front end. For the output produced for `gen 5000`, the new frontend
is almost 10x slower than the old one.
I used `valgrind --tool=callgrind` to collect profiling data.
The number of closures is too big. For example, `free_closure_obj` was
invoked 38.5 million times. The total number of deallocated objects is around
49.5 million.
2019-03-04 16:19:50 -08:00
Leonardo de Moura
9cc41c4f3d chore(frontends/lean/inductive_cmds): disable broken check
@kha I have disabled this check. It was implemented 2 years ago by
Daniel, and I don't want to fix it. It seems you have already fixed a
bug there. AFAICT, this check is just for improving error messages.
I believe we may not even need it since the kernel now supports nested
inductive types. AFAIR, Daniel implemented this check here because the
inductive compiler was introducing a lot of auxiliary declarations
that were making the kernel error messages unreadable.
2019-03-04 11:05:21 -08:00
Sebastian Ullrich
5e7970dca3 test(tests/playground/deriv): Haskell version 2019-02-28 14:57:57 +01:00
Leonardo de Moura
b25c0db35d tests(tests/playground/deriv): deriv in OCaml 2019-02-27 11:15:52 -08:00
Leonardo de Moura
f4302a5f48 test(tests/playground): new versions of unionfind1
@kha I'm just trying to understand the performance numbers.
2019-02-26 16:47:53 -08:00
Leonardo de Moura
d128af10f9 test(tests/playground): add union find examples
@kha I tried to make the examples self contained.

- unionfind1.lean uses the modified StateT and ExceptT
- unionfind2.lean uses the standard StateT and ExceptT
2019-02-26 13:44:16 -08:00
Sebastian Ullrich
f366af76ac test(tests/playground/rbmap): consistent naming 2019-02-26 20:27:23 +01:00
Sebastian Ullrich
850001b996 test(tests/playground): rbmap.hs, Makefile 2019-02-26 20:26:55 +01:00
Sebastian Ullrich
c4bc783ef4 test(tests/playground/run.sh): split out compile.sh 2019-02-26 20:25:30 +01:00
Leonardo de Moura
6f73f19d19 chore(tests/playground/rbmap_standalone): make sure lean version mirrors the OCaml one 2019-02-26 10:37:12 -08:00
Leonardo de Moura
b883388d66 chore(tests/playground/rbmap_standalone): add missing [specialize] and remove alias 2019-02-26 10:06:18 -08:00
Leonardo de Moura
397be6d1c0 test(tests/playground/rbmap_standalone): add standalone rbmap benchmark 2019-02-26 09:56:59 -08:00
Sebastian Ullrich
d258f325f1 test(tests/playground/binarytrees.lean): further opt 2019-02-26 18:08:09 +01:00
Sebastian Ullrich
24ad2e2b89 test(tests/playground/binarytrees.lean): optimize 2019-02-26 17:47:14 +01:00
Sebastian Ullrich
8e212ef9d9 test(tests/playground/Makefile): these ocamlopt parameters do nothing 2019-02-26 17:26:37 +01:00
Sebastian Ullrich
70a5c6d585 test(tests/playground/binarytrees.lean): more coarse parallelization 2019-02-26 17:21:45 +01:00
Sebastian Ullrich
9724491dc2 test(tests/playground/binarytrees.lean): parallelize 2019-02-26 16:16:34 +01:00
Sebastian Ullrich
cf0bf911c8 test(tests/playground): binarytrees benchmarks game benchmark in Lean, OCaml & Haskell 2019-02-25 23:46:10 +01:00
Sebastian Ullrich
c4740b7295 test(tests/playground/rbmap.ml): take the same input as Lean version 2019-02-25 14:51:16 +01:00
Leonardo de Moura
ccea4c2043 chore(tests/playground/rbmap): use +1 instead of +k to avoid big number arithmetic when we increase number of elements inserted 2019-02-24 08:49:38 -08:00
Leonardo de Moura
483125f828 test(tests/playground/rbmap): rbmap in OCaml 2019-02-22 17:43:27 -08:00
Leonardo de Moura
8decfcae74 test(tests/playground): manually optimized rbmap3 2019-02-20 11:00:54 -08:00
Leonardo de Moura
1fc058503d fix(tests/playground/rbmap3): bug 2019-02-19 22:40:22 -08:00
Leonardo de Moura
3e8c8bf3a1 chore(tests/playground/rbmap2): remove debugging options 2019-02-19 22:34:38 -08:00