Commit graph

4405 commits

Author SHA1 Message Date
Leonardo de Moura
c57731f8c6 chore(tests/compiler/rbmap): fix test 2019-05-13 12:30:01 -07:00
Leonardo de Moura
deb2310b6d feat(util/map_foreach): add helper functions for traversing Lean maps 2019-05-13 12:27:59 -07:00
Sebastian Ullrich
13603060cc fix(tests/playground/binarytrees): fix test 2019-05-12 13:43:36 +02:00
Leonardo de Moura
25879c97fa test(tests/playground/envtest): add small environment extension test 2019-05-11 17:53:27 -07:00
Leonardo de Moura
c46608ced5 feat(library/init/io): implement unsafeIO in Lean
Motivation: avoid closure allocation.
2019-05-11 16:28:11 -07:00
Leonardo de Moura
9e246b365e feat(library/init/lean): add SMap for implementing Environment 2019-05-09 07:38:26 -07:00
Leonardo de Moura
18aa7de408 feat(library/init/data): add ByteArray 2019-05-08 16:43:00 -07:00
Leonardo de Moura
b782191d0b chore(tests/lean/run/float_cases_bug): fix test 2019-05-07 15:22:01 -07:00
Leonardo de Moura
fd25827d3e fix(library/init/lean/compiler/ir/resetreuse): must use livevars instead of freevars
The file badreset contains two functions where the new `reset/reuse`
insertion procedure implemented in Lean produces better results than the
one implemented in C++.

cc @kha
2019-05-07 11:09:51 -07:00
Leonardo de Moura
ac747c5f6e feat(library/init/data/rbmap): add erase 2019-05-04 15:58:30 -07:00
Leonardo de Moura
8db0474571 feat(library/init/data/random): random numbers
It is useful for creating tests.
2019-05-04 15:57:42 -07:00
Leonardo de Moura
cae5ee075e test(tests/playground/badreset): add test that exposes a bad reset/reuse placement
The generated code is safe, but the `reset/reuse` optimization will
never be applicable at runtime. The issue is that
`insert_reset_reuse_fn` is not checking the joint points.
I will fix the bug only at `resetreuse.lean`.
2019-05-03 17:13:29 -07:00
Leonardo de Moura
4c9a488446 chore(library/init/data/array): naming convention
@kha Trying again :)
I started using the prefix `f` for the `Fin` version (e.g., `fswap` and
`fswapAt`). So, it seemed natural to use the prefix `f` for the `Fin`
versions of `get` and `set`.
BTW, is it too crazy to use `a[i]` (without spaces) as notation for
`a.get i`? The constraint is to make sure `f a [i]` is not ambiguous.
That is, `f a[i]` is `f (a.get i)` and `f a [i]` is `f a (i::nil)`.
This is doable with the new parser.

Then, we could have `a[i]` as notation for `a.fget i` if `i` is a `Fin`,
and `a.get i` if `i` is `Nat`.
Similarly, `a[i := v]` would be notation for `a.fset i v` if `i` is
`Fin`, and `a.set i` if `i` is `Nat`.

It would also be awesome to have
```
let a[i] := v in
e
```
as notation for
```
let a := a[i := v] in
```
2019-05-02 10:23:53 -07:00
Leonardo de Moura
970941db2c feat(library/init/data/array/basic): add Array.filter 2019-05-02 09:51:08 -07:00
Leonardo de Moura
1707628b6b feat(library/init/data/array/basic): Array.reverse 2019-05-01 17:38:44 -07:00
Leonardo de Moura
45d09d3044 fix(library/compiler/ir): bug at LLNF -> IR 2019-05-01 17:38:44 -07:00
Leonardo de Moura
ed5e461130 feat(library/init/lean/compiler/ir): add maxVar 2019-05-01 17:38:44 -07:00
Leonardo de Moura
fa0b4bff40 chore(tests/playground/parser/syntax): fix experiment 2019-04-30 18:06:03 -07:00
Leonardo de Moura
d433811c64 test(tests/playground): add "checkpoint" variant for rbmap benchmark
@kha I created a variant of the `rbmap` example where we create a tree
but also save "checkpoints". The idea is to simulate the idiom frequently
used in a backtracking search where we "save" the "context" before each
case split in a "trail stack".
The benchmark has two parameters: the number of nodes to be inserted, and a "frequency" (how often we create a "checkpoint").
The command `rbmap_checkpoint.lean.out n n` behaves like the original
`rbmap` benchmark, and `rbmap_checkpoint.lean.out n 1` creates a
checkpoint after each insertion. The frequency provides a simple way to
control the amount of sharing. We can provide performance numbers for
different frequencies, and show the impact on the `reset/reuse` optimization.

BTW, the performance numbers are much better than I expected. For
example,
`./rbmap_checkpoint.lean.out 1000000 10` is only 30% slower than
`./rbmap_checkpoint.lean.out 1000000 1000000`
although 100k checkpoints were created.

Another good news is that we are faster than Haskell even for
`./rbmap_checkpoint.lean.out 1000000 1`
2019-04-30 10:41:23 -07:00
Leonardo de Moura
e0821be132 chore(tests/playground/ir): fix test 2019-04-29 10:50:10 -07:00
Leonardo de Moura
5298841def test(tests/playground/ir): small test 2019-04-29 10:47:51 -07:00
Leonardo de Moura
df84868ab4 feat(library/init/data/array/basic): array helper functions 2019-04-28 10:10:24 -07:00
Leonardo de Moura
aefe49d575 test(tests/playground): add new rbmap experiment 2019-04-27 08:02:32 -07:00
Leonardo de Moura
e1a84d2f2c fix(library/compiler/struct_cases_on): performance problem exposed by badupdate1.lean 2019-04-26 16:30:19 -07:00
Leonardo de Moura
240ca3fc68 test(tests/playground/badupdate1): add test for exposing performance bug at struct_cases_on_fn
```
./run.sh badupdate1.lean 4000
8000
test1 2.12s
8000
test2 1.11ms
```
2019-04-26 15:04:39 -07:00
Leonardo de Moura
1a1105b533 test(tests/playground/lazylist): perf tests 2019-04-26 13:12:39 -07:00
Leonardo de Moura
a5128484a1 test(tests/playground/lazylist): perf tests 2019-04-26 12:05:16 -07:00
Leonardo de Moura
9a39eb254a chore(tests/playground): fix tests 2019-04-25 16:48:06 -07:00
Leonardo de Moura
9fb404353e test(tests/playground/lazylist): add cycle 2019-04-25 11:04:04 -07:00
Leonardo de Moura
c8a045d69f test(tests/playground/parser/parser): add HasAndthen and HasOrelse instances 2019-04-24 14:05:45 -07:00
Leonardo de Moura
014c7e3374 test(tests/playground/parser/parser): "liftable" longestMatch
For lists of size 0, 1 and 2, it avoids the overhead of creating
temporary lists of closures. I measure the overhead with `test1.lean`
and there is no overhead in this case.
`test1.lean` has a test for length = 4, and the overhead is 7%.
We only use longestMatch to implement the Pratt Parser.
The lists should be small. So, the overhead is acceptable.
If it is not. We can add back the `longestMatch` specific for `TermParser`.

cc @kha
2019-04-24 11:23:06 -07:00
Leonardo de Moura
5991337279 test(tests/playground/parser/test1): add test and timeit 2019-04-24 11:20:44 -07:00
Leonardo de Moura
5188adc685 test(tests/playground/parser): add longestMatch and other helper functions 2019-04-23 17:29:38 -07:00
Leonardo de Moura
3d8c3d5789 test(tests/playground/parser/parser): add unicodeSymbol parser 2019-04-23 09:34:41 -07:00
Leonardo de Moura
cac080f504 test(tests/playground/mapVShmap): use {x with ...} notation in the test 2019-04-22 13:42:53 -07:00
Leonardo de Moura
32f41f60d3 feat(runtime/object): add dbgTraceIfShared primitive for debugging RC reuse issues 2019-04-19 16:26:45 -07:00
Leonardo de Moura
363f7dc6f4 test(tests/playground/mapVShmap): add example where hmap is almost 3x faster than map 2019-04-19 14:52:52 -07:00
Leonardo de Moura
e844afb64a test(tests/playground/parser/syntax): propagate lazy macro scopes 2019-04-19 14:52:52 -07:00
Leonardo de Moura
6659836734 chore(tests/playground): fix tests 2019-04-18 17:29:49 -07:00
Leonardo de Moura
2eed00039a chore(tests/playground/parser/parser): remove Thunk hack
The artificial `Thunk` was being used just to make sure a `Parser`
object was small enough to be inlined. We don't need this hack anymore.
Commit 0ea944a adds a new transformation that makes sure the size of
field `info` does not impact the decision on whether field `fn` will be
inlined or not.
2019-04-18 13:18:31 -07:00
Leonardo de Moura
0ea944ad9f feat(library/compiler/csimp): add transformation to complement eager lambda lifting 2019-04-18 13:12:11 -07:00
Leonardo de Moura
e3dfc73b3a chore(tests/playground/deriv): fix test 2019-04-17 18:12:08 -07:00
Leonardo de Moura
6b53700d60 test(tests/playground/parser/test1): improve 2019-04-13 08:15:56 -07:00
Leonardo de Moura
a716528067 fix(tests/playground/parser/parser): reset position 2019-04-13 08:07:29 -07:00
Leonardo de Moura
68e8faeef1 test(tests/playground/parser/parser): add sepBy and sepBy1 2019-04-13 07:56:35 -07:00
Leonardo de Moura
52fa06ad38 fix(tests/playground/parser/parser): fix tryFn 2019-04-13 07:36:48 -07:00
Leonardo de Moura
2377b10c2c test(tests/playground/parser): minor 2019-04-12 09:05:22 -07:00
Leonardo de Moura
d7de85e1e7 fix(tests/playground/parser/parser): small bugs 2019-04-12 08:58:02 -07:00
Leonardo de Moura
48ba69775a fix(tests/playground/parser/syntax): initialization 2019-04-12 08:25:47 -07:00
Leonardo de Moura
e53cb81255 test(tests/playground/parser): replace parser.lean with parser2.lean 2019-04-12 07:50:50 -07:00