Repository navigation
perf: memoize env lookups across top-level forms - #1599
Draft
eriksvedang wants to merge 5 commits into
Draft
eriksvedang wants to merge 5 commits into
eriksvedang wants to merge 5 commits into
Conversation
hellerve
reviewed
Oct 20, 2026
| if instancePath `elem` visitedDefinitions | ||
| -- Already defined by an earlier form: it and its own dependencies | ||
| -- are in the environment, so concretizing it again is wasted work. | ||
| if instancePath `elem` visitedDefinitions || isDefinedInstance instancePath |
Member
There was a problem hiding this comment.
i think this means i cannot override deleters anymore if i already had an instance. concretely, the new check skips an existing specialization without checking whether its source changed.
i specced out a repro with codex:
(deftype (Crate a) [value a])
(defmodule Crate
(sig delete (Fn [(Crate a)] ()))
(defn delete [x] (IO.println "old")))
; we find it here and specialize
(defn before []
(let [x (Crate.init 1)] ()))
(defmodule Crate
(defn delete [x] (IO.println "new")))
; old deleter here too
(defn main [] (let [x (Crate.init 2)] ()))This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow up PR to #1598 (it contains its changes too).
It makes things super fast but needs thorough review before we merge it. I just pushed it so that interested parties can try it out :)
Disclosure: also written by Claude