-
Notifications
You must be signed in to change notification settings - Fork 454
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
feat: add missingDocs linter #1390
Conversation
There is some performance cost here to running the linter, but I don't see any reason for the huge memory increase. The linter doesn't even have any state? I don't know much about how profiling works around here. Where did you get that report, and how can I test it locally? |
The report is at http://speedcenter.informatik.kit.edu/velcom/run-detail/1f93e04e-143b-4d33-b060-15d9f036265a, the benchmark spec is at lean4/tests/bench/speedcenter.exec.velcom.yaml Lines 1 to 20 in c76fa06
I don't think I've ever debugged a maxrss regression, but my hope would be that you can reproduce it locally using /usr/bin/time -v (on e.g. compilation of a random file, assuming that the regression is not specific to one or a few specific files).
|
The maxrss measurement does seem to be pretty noise-free, and something weird definitely happened on this commit, but notice that it's also only showing up in the stdlib-maxrss measurement, the other maxrss benchmarks are stable: http://speedcenter.informatik.kit.edu/velcom/repo-detail/bab50d33-13a1-40c4-85a0-fda5f93f8b22?zoomXStart=1659178852314.3838&zoomXEnd=1659344250354.632&dimensions=deriv%3Amaxrss%3A%3Aunionfind%3Amaxrss%3A%3Abinarytrees%3Amaxrss%3A%3Arbmap%3Amaxrss%3A%3Anew%20parser%20Core.lean%3Amaxrss%3A%3Arbmap_10%3Amaxrss%3A%3Astdlib%3Amaxrss%3A%3Aqsort%3Amaxrss%3A%3Arbmap_1%3Amaxrss%3A%3Aliasolver%3Amaxrss%3A%3Atests%2Fbench%2F%20interpreted%3Amaxrss%3A%3Aconst_fold%3Amaxrss&dayEquidistant=true So it might be that compiling the new file itself takes a lot of memory? |
Could be! But that in itself would be worth investigating. |
I did look into this a bit more, partially to test a new profiler, which apparently does a much better job at capturing deep stack traces (up to a limit of 64KB hard-coded in the kernel). Deep enough apparently that both Firefox and Chromium struggle to display even a small slice of the generated flamegraph, so I found a website dedicated to fast rendering of flamegraphs: https://www.speedscope.app/. You can load https://pp.ipd.kit.edu/~ullrich/tmp/coll (9MB) into it to get a pretty complete callgraph of |
The main addition is a linter for missing doc strings. It's approximately similar to the mathlib doc string linter, except that it works directly on syntax instead of looking at the environment. (I think new API is required to be able to quickly find out what declarations were added by a given command, if we want the environment-sensitive version like the mathlib4 linter. Otherwise it would be too slow to run after each command.)
The linter does not yet support any options and is not yet extensible to new user-defined commands. The extensibility should be fairly straightforward, and linter options require feedback from users to actually turn the linter on and get too many or too few linter warnings.
This linter is disabled by default, and of course it is not enabled in the lean repo itself. (Fun fact, if you do you get 10391 missing doc string warnings.) It hasn't yet been tested on mathlib, but hopefully it should be possible to enable there.
Declarations which will be linted if they don't have a docstring (unless the declaration is
local
/private
):abbrev
,axiom
,declare_config_elab
,declare_simp_like_tactic
,declare_syntax_cat
,def
,elab
,(class) inductive
,(builtin_)initialize
,macro
,opaque
,register_(builtin_)option
,register_simp_attr
,structure / class
,syntax
Declarations that take a docstring but are not linted:
elab_rules
,example
,inductive
,instance
,macro_rules
,theorem
,unif_hint
Other modifications:
linter.all
has been changed tofalse
, since we don't want all linters on by default (this will surely not be the last overly-pedantic lint).getLinterAll
function has been largely replaced bygetLinterValue
, which does the correct defaulting for a linter setting: if the specific linter option is set, use that, else uselinter.all
if set, else use the specific linter default value.declare_simp_like_tactic
takes a docstring now (and it is linted). It probably won't get external use but those tactics need docstrings anyway.