The new `partial def`s allow us to define `fix` in Lean, but the Lean implementation is not as efficient as the native one. The native one in C++ use weak pointers to prevent a closure allocation at every recursive invocation. This commit also fixes the `fixCore` helper functions that were broken after we switched to camelCase. We have updated the test `fix1.lean` to demonstrate the native implementation is faster. Here are the numbers on my desktop. ``` ./run.sh fix1.lean 24 721420279 Time for 'native fix': 816ms 721420279 Time for 'fix in lean': 1.34s ```
9 lines
286 B
Text
9 lines
286 B
Text
/-
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
Authors: Leonardo de Moura
|
|
-/
|
|
prelude
|
|
import init.core init.control init.data.basic
|
|
import init.coe init.wf init.data init.io init.util
|
|
import init.fix
|