You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After doing a bit of profiling with clj-async-profiler, I noticed that some of the new formatting rules consume more CPU than they should need to. Of a sample flame graph where reformat-form took 43.47% of the measured CPU time, that time was spent:
21.25% cljstyle.format.type/reformat
8.85% cljstyle.format.indent/reindent
5.22%cljstyle.format.fn/line-break-functions
4.20% cljstyle.format.var/line-break-vars
3.95% other rules
This means that the type rules take almost half of the CPU time, despite type definitions being a small fraction of the actual code! It would be better to consider a more targeted approach, where the form is first searched for a relevant type form, then edits are applied to just that subform. The functions in rewrite-clj.zip.subedit might be useful for this.
The text was updated successfully, but these errors were encountered:
After doing a bit of profiling with clj-async-profiler, I noticed that some of the new formatting rules consume more CPU than they should need to. Of a sample flame graph where
reformat-form
took 43.47% of the measured CPU time, that time was spent:cljstyle.format.type/reformat
cljstyle.format.indent/reindent
cljstyle.format.fn/line-break-functions
cljstyle.format.var/line-break-vars
This means that the type rules take almost half of the CPU time, despite type definitions being a small fraction of the actual code! It would be better to consider a more targeted approach, where the form is first searched for a relevant type form, then edits are applied to just that subform. The functions in
rewrite-clj.zip.subedit
might be useful for this.The text was updated successfully, but these errors were encountered: