lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

perf: `infer_app` with `infer_only := false` (WIP)

Open leodemoura opened this issue 2 years ago • 6 comments

leodemoura avatar Oct 29 '23 02:10 leodemoura

!bench

leodemoura avatar Oct 29 '23 02:10 leodemoura

Here are the benchmark results for commit d1dd4b911b3a34645d823a6d3bfefa0e15eb83e3. There were significant changes against commit f76a17b33f85d714ea33d37e8975a02382abb28c:

  Benchmark                  Metric   Change
  ====================================================
+ tests/bench/ interpreted   maxrss    -1.1% (-11.5 σ)

leanprover-bot avatar Oct 29 '23 02:10 leanprover-bot

@leodemoura here is the comparison between Mathlib runs: http://speed.lean-fro.org/mathlib4/compare/e7b27246-a3e6-496a-b552-ff4b45c7236e/to/e7b27246-a3e6-496a-b552-ff4b45c7236e?hash1=1ca67b1a4b326c4224bb25a792b22c304c83b597&hash2=bb1b2648e3674b537c07efac0d4e66162fb7dab5

Unfortunately it doesn't look good: a 2.4% wallclock regression.

kim-em avatar Oct 30 '23 03:10 kim-em

Unfortunately it doesn't look good: a 2.4% wallclock regression.

I took a look at the results. This commit affects "type checking" time, and it seems it went down.

image

This commit minimizes the number of instantiate operations, but it is not caching the type for partial applications. That is, if we have f a b and f a c. The previous approach caches the result for f a, but this commit skips it. That being said, it seems "type checking" time still went down. It is unclear to me how the "wall clock" time went up.

leodemoura avatar Nov 05 '23 19:11 leodemoura

Either of these might or might not be noise, the instruction count suggests that there is probably no impact overall. We should try again on top of https://github.com/leanprover-community/mathlib4/pull/8224

Kha avatar Nov 06 '23 11:11 Kha