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

Improve indent performance #6

Open
Deraen opened this issue Dec 29, 2020 · 0 comments · May be fixed by #31
Open

Improve indent performance #6

Deraen opened this issue Dec 29, 2020 · 0 comments · May be fixed by #31
Assignees
Labels
indentation Affects indentation performance Affects performance

Comments

@Deraen
Copy link
Member

Deraen commented Dec 29, 2020

guns/vim-clojure-static#88

With 6b18b4e test script, master:

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
29646              4.656598  <SNR>35_syn_id_name()
 1532   5.261001   0.407066  <SNR>35_match_pairs()
29028   4.712738   0.186393  <SNR>35_ignored_region()
28332   4.856748   0.155025  <SNR>35_is_paren()
30068              0.059254  <SNR>35_current_char()
  417   5.570994   0.033857  GetClojureIndent()
  417   5.439542   0.032423  <SNR>35_clojure_indent_pos()
  315   1.959061   0.012072  <SNR>35_clojure_is_method_special_case_worker()
  416   0.112460   0.006156  <SNR>35_clojure_check_for_string_worker()
  416   0.116510   0.004050  <SNR>35_check_for_string()
  581              0.003795  <SNR>35_strip_namespace_and_macro_chars()
  130              0.003790  <SNR>35_match_one()
  581              0.003502  <SNR>35_current_word()
  315   1.962500   0.003439  <SNR>35_is_method_special_case()
 1395              0.002532  <SNR>35_bracket_type()
  315              0.001042  <SNR>35_is_reader_conditional_special_case()

Because indent uses the syntax rules, #5 branch already improves this a quite bit:

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
29646              1.478719  <SNR>35_syn_id_name()
 1532   2.199816   0.404030  <SNR>35_match_pairs()
29028   1.617763   0.185423  <SNR>35_ignored_region()
28332   1.798798   0.156209  <SNR>35_is_paren()
30068              0.059659  <SNR>35_current_char()
  417   2.391534   0.034190  GetClojureIndent()
  417   2.312287   0.032532  <SNR>35_clojure_indent_pos()
  315   0.809202   0.011783  <SNR>35_clojure_is_method_special_case_worker()
  416   0.046043   0.006287  <SNR>35_clojure_check_for_string_worker()
  130              0.004105  <SNR>35_match_one()
  581              0.004033  <SNR>35_strip_namespace_and_macro_chars()
  416   0.050047   0.004003  <SNR>35_check_for_string()
  581              0.003524  <SNR>35_current_word()
  315   0.812542   0.003340  <SNR>35_is_method_special_case()
 1395              0.002603  <SNR>35_bracket_type()
  315              0.001093  <SNR>35_is_reader_conditional_special_case()

Testing against Reagent src/reagent/impl/component.cljs.

@Deraen Deraen mentioned this issue Dec 30, 2020
Merged
@axvr axvr self-assigned this Apr 21, 2023
axvr added a commit that referenced this issue Apr 27, 2023
The objectives are:

    1. Simplify the indentation code; previous implementation has become
       so complex it is impossible to maintain,

    2. Significantly improve performance; previous indentation code was
       painfully slow, (see issue #6)

    3. Maximum configurability; should be configured similarly to cljfmt
       and make previously impossible things possible (e.g. issue #21).

As of this commit, objectives 1 and 2 have been met, but work on
objective 3 has not yet begun.  There will continue to be further
improvements, particularly around performance and the "what if syntax
highlighting is disabled?" scenario.

These changes will unfortunately be backwards incompatible, but
hopefully the improved performance and API will make up for it.
@axvr axvr linked a pull request Apr 27, 2023 that will close this issue
16 tasks
@axvr axvr added indentation Affects indentation performance Affects performance labels Jun 23, 2023
@axvr axvr linked a pull request Jun 23, 2023 that will close this issue
16 tasks
@axvr axvr added this to the Indentation overhaul milestone Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
indentation Affects indentation performance Affects performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants