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

Requires with lots of refers seems very slow when calling cljr-remove-unused-requires #51

Closed
AeroNotix opened this issue Mar 30, 2014 · 16 comments

Comments

@AeroNotix
Copy link
Contributor

(ns payments.schema_test
  (:require [payments.utils :refer [uuid]]
            [payments.schemavalidation :refer [account-create
                                               order-schema
                                               credit-card-schema
                                               payment-base-schema
                                               payment-status-schema]]
            [clojure.test :refer :all]
            [closchema.core :refer [validate report-errors]]))

This seems very slow when calling cljr-remove-unused-requires.

@AeroNotix AeroNotix changed the title Requires with lots of uses seems very slow when calling cljr-remove-unused-requires Requires with lots of refers seems very slow when calling cljr-remove-unused-requires Mar 30, 2014
@benedekfazekas
Copy link
Member

hi Aero,

which version are you using? If 0.12.0 (latest released) can you please retest with master head?

@AeroNotix
Copy link
Contributor Author

@benedekfazekas

xeno@xenocorp:~/.emacs.d% ls elpa/clj-refactor-20140330.651

So, from today?

@benedekfazekas
Copy link
Member

hm... that seems to be the latest. Can't really reproduce tho. I added some mock fns but just to be sure can you share your whole namespace pls?

@AeroNotix
Copy link
Contributor Author

That is the whole namespace.

@expez
Copy link
Member

expez commented Mar 30, 2014

Is it slow when you only have that ns in the file? I would expect it to be quite slow with that ns followed by a ton of code (as quite a bit of searching is done).

@benedekfazekas
Copy link
Member

when I run it it is practically instant. I get

(ns payments.schema_test
  (:require [clojure.test :refer :all]))

which makes sense.

@benedekfazekas
Copy link
Member

@expez does it slow down in your environment as well with only the ns declaration in the file?

@AeroNotix
Copy link
Contributor Author

@expez no, it's fast with just that ns in a file. The file is "only" 359 lines long.

@expez
Copy link
Member

expez commented Mar 30, 2014

@benedekfazekas I suspect this only occurs when such an ns declaration precedes a few hundred lines of code. Which is why you cannot reproduce the problem.

Slowness in such a situation is to be expected, given how much searching is involved in this particular refactoring.

@AeroNotix
Copy link
Contributor Author

Closing, then. If it's related to the number of forms there's not much that can be done (assuming the core search algo is efficient.)

@benedekfazekas
Copy link
Member

@expez agreed. although there could be something funky in the actual file which the search (regexp) chokes on... I just want to rule this out.

so @AeroNotix any chance you can send/attach the whole file?

@AeroNotix
Copy link
Contributor Author

@benedekfazekas Unfortunately, no, I can't really send the whole file. It's gonna be hard to anonymise it.

@expez
Copy link
Member

expez commented Mar 30, 2014

@AeroNotix If cljr isn't already bytecompiled doing that might get you a ~2-5x speedup.

@AeroNotix
Copy link
Contributor Author

@expez s I tend to avoid byte compilation, but it's certainly worth a try! Thanks.

@benedekfazekas
Copy link
Member

good call @expez, thx ;)

also diff approach to clj source mentioned in #11 (eg build an AST) can change this land. but only wild guessing here...

@benedekfazekas
Copy link
Member

there is a performance tweak now in the latest version if u use refactor-nrepl with it. search is done in an AST by clojure instead of the buffer by elisp. enjoy

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

No branches or pull requests

3 participants