Skip to content
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

Performance improvements #28

Closed
greglook opened this issue Jan 23, 2020 · 1 comment
Closed

Performance improvements #28

greglook opened this issue Jan 23, 2020 · 1 comment

Comments

@greglook
Copy link
Owner

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.

@greglook
Copy link
Owner Author

Largely done in 0a125ab...b86b22f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant