Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
Find a file
Leonardo de Moura 04dfd55f94 perf(kernel/expr): fix hash consing performance problem
The kernel support opportunistic hash consing.
At commit e63c79c81e we have enabled this feature during
tactic execution, and fixed performance problems in the Certigrad
project (by @dselsam).
However, this change produced unexpected performance problems in
other Lean files (example: @JasonGross example at issue #1646 was 10x
slower after the commit above).
After analyzing the performance logs, I conjecture the hash_consing
may produce a substantial performance overhead if the following property
doesn't hold.

- Let `cache` be the hash_consing cache, then for each `e` in `cache`,
all children of `e` are also in the `cache`.

If the property above is not true, we may have problem whenever
we add an expression `t` containing multiple copies of a big term `T`.
For example, support we insert `f T_1 T_2`, where `T_1` and `T_2` are
structurally equal but are not pointer equal. Then, if we try to insert
`f T_2 T_1`, we will have to compare the huge terms twice, and the
comparison will be proportional to the size of `T_i`.

This commit tries to address this performance problem by enforcing
the property above. This is not a perfect solution since we may keep
trying to create terms using big terms created before hash_consing
has been enabled. After this commit, the example at issue #1646
is only 1.4x slower. It didn't impact the standard library
compilation (memory nor time).

I'm using this commit is a temporary workaround. We should probably
remove the hash_consing support from the kernel, and implement it
in key places. For example, for Certigrad, we can control memory
consumption by using hash_consing only during `simp`,
`instantiate_mvars` and `elaborator` finalization procedure.

@gebner @kha Any ideas/suggestions for this hash_consing issue?
2017-06-23 12:41:35 -07:00
.github chore(.github/PULL_REQUEST_TEMPLATE): typo 2017-06-12 09:56:15 -07:00
bin chore(bin/lean-gdb): pretty-print lean::optional 2017-05-09 16:02:41 -07:00
doc doc(changes): update 2017-06-22 08:07:25 -07:00
extras feat(extras/depgraph): add dependency-free version of leandeps 2017-06-12 15:40:46 +02:00
images chore(CMakeLists.txt): move Lean logo to make sure we can test leanemacs without installing Lean 2015-01-31 17:38:49 -08:00
leanpkg refactor(library): add has_to_string back (but it produces unquoted values) 2017-06-18 18:30:10 -07:00
library feat(library/type_context): unfold lemmas in major premise of acc.rec 2017-06-22 08:33:11 -07:00
script chore(script/test_registry): don't stop on failure 2017-06-09 20:30:48 +02:00
src perf(kernel/expr): fix hash consing performance problem 2017-06-23 12:41:35 -07:00
tests fix(library/string): correctly escape non-printable characters 2017-06-23 20:39:41 +02:00
tmp feat(frontends/lean,library/equations_compiler): store tactics for generating well founded relation and decreasing proofs 2017-05-23 15:00:29 -07:00
.appveyor.yml chore(*): update change log, and bump work in progress version to 3.2.1 2017-06-18 11:15:09 -07:00
.appveyor.yml.in chore(.appveyor.yml): separate upgrading and installing new packages 2017-06-03 17:42:48 +02:00
.clang-format feat(library/vm/process): add basic process support 2017-03-28 18:08:06 -07:00
.codecov.yml feat(.travis.yml): add codecov 2016-12-02 17:01:58 -08:00
.gitignore chore(gitignore): ignore nix files 2017-06-19 13:16:04 +02:00
.travis.yml fix(.travis.yml): move -t0 test to a release configuration 2017-06-19 20:35:11 +02:00
.travis.yml.in fix(.travis.yml): move -t0 test to a release configuration 2017-06-19 20:35:11 +02:00
LICENSE Add LICENSE file 2013-07-15 18:55:48 -07:00
README.md feat(doc/changes.md): create change log 2017-06-14 22:42:08 -07:00

logo

LicenseWindowsLinux / macOSTest CoverageChat
Codecov Join the gitter chat

About

Requirements

Build Instructions

Miscellaneous

Roadmap