-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Lean.Elab.Deriving.FromToJson
#5292
refactor: Lean.Elab.Deriving.FromToJson
#5292
Conversation
WIP |
7d21c09
to
74706a8
Compare
Mathlib CI status (docs):
|
Mathlib CI status (docs):
|
74706a8
to
84463ab
Compare
awaiting-review |
Mathlib CI status (docs):
|
!bench |
Ah, we unfortunately don't have a benchmark for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks plausible to me. How good is the test coverage, and how confident are you?
def mkFromJsonAuxFunction (ctx : Context) (i : Nat) : TermElabM Command := do | ||
let auxFunName := ctx.auxFunNames[i]! | ||
let indval := ctx.typeInfos[i]! | ||
let header ← mkFromJsonHeader indval --TODO fix header info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left-over TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a leftover from #3160 indeed, I should remove it before merging IMO.
Lean.Elab.Deriving.FromToJson.lean
Lean.Elab.Deriving.FromToJson
Thanks for flagging! It wouldn’t affect performance if the generated code is going to be the same, and it’s just refactoring the meta-code, right? |
Yes, and the benchmark would help confirm that the generated code is identical. |
|
Here are the benchmark results for commit 84463ab. Benchmark Metric Change
==========================================================
+ ilean roundtrip branch-misses -8.5% (-11.9 σ)
+ stdlib attribute application -1.1% (-29.5 σ) |
Thanks for checking! |
That said, a benchmark for the generated code would of course be great to have more assurance with subsequent changes. Would you be up to writing one? |
Mathlib CI status (docs):
|
I'm not sure how I should go about writing such a benchmark, I have yet to write one... any indications are welcome :) |
I also wouldn't know. And not a requirement, just a suggestion :-) |
Refactors the derive handlers for `ToJson` and `FromJson` in preparation for leanprover#3160. This splits up the different parts of the handler according to how other similar handlers are implemented while keeping the original logic intact. This makes the changes necessary to adapt the file in leanprover#3160 much easier.
Refactors the derive handlers for
ToJson
andFromJson
in preparation for #3160.This splits up the different parts of the handler according to how other similar handlers are implemented while keeping the original logic intact. This makes the changes necessary to adapt the file in #3160 much easier.