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

ClojureScript get's really slow #516

Closed
wilkerlucio opened this issue Sep 26, 2014 · 12 comments
Closed

ClojureScript get's really slow #516

wilkerlucio opened this issue Sep 26, 2014 · 12 comments
Milestone

Comments

@wilkerlucio
Copy link

Hi,

I'm noticing here that everything I work on ClojureScript stuff the IDE get's really slow... Specially after I cmd+tab and get back... Every time I cmd+tab back on IntelliJ it takes about 3 ~ 4 seconds to the IDE get responsive again... This is very annoying specially for web development where you are alternating between the IDE and the browser constantly...

When working on pure Clojure projects this doesn't happens at all, but on ClojureScript any small project (here I'm talking about only 1 source file, plus the dependencies that usually are: core.async and Om).

Until this gets improved, there is a way for me to disable something that you would make my cljs development faster?

Thanks.

@cursive-ide
Copy link
Owner

If you turn on Settings->Appearance->Show memory indicator are you seeing the IDE use a lot of memory?

One other thing to check - do you have your CLJS compile target directory (where the generated JS gets output) in your project, or is it excluded? If you exclude that directory (right click->Mark as...->Excluded), does that help? What might be happening is when you switch back to IntelliJ it indexes all the new generated JS.

@wilkerlucio
Copy link
Author

I was checking the memory, it goes really high (from 102 to 500 in a few seconds, just after tab back).

After you said, I excluded the "out" folder, but it still have the slow after switching the app. I also noticed the slowdown only occurs if I a recompilation happens (if I just keep alternating without nothing new compiled, it doesn't have the slowdown).

I also noticed that I got a lot of errors like this (like 100+):

null keys not supported: null keys not supported
java.lang.NullPointerException: null keys not supported
    at gnu.trove.THashMap.put(THashMap.java:162)
    at com.intellij.util.indexing.ValueContainerImpl.a(ValueContainerImpl.java:72)
    at com.intellij.util.indexing.ValueContainerImpl.addValue(ValueContainerImpl.java:55)
    at com.intellij.util.indexing.ValueContainerMap$ValueContainerExternalizer.read(ValueContainerMap.java:130)
    at com.intellij.util.indexing.ValueContainerMap$ValueContainerExternalizer.read(ValueContainerMap.java:80)
    at com.intellij.util.io.PersistentHashMap.doGet(PersistentHashMap.java:427)
    at com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:398)
    at com.intellij.util.indexing.MapIndexStorage$2$1.compute(MapIndexStorage.java:121)
    at com.intellij.util.indexing.MapIndexStorage$2$1.compute(MapIndexStorage.java:109)
    at com.intellij.util.indexing.ChangeTrackingValueContainer.a(ChangeTrackingValueContainer.java:121)
    at com.intellij.util.indexing.ChangeTrackingValueContainer.getValueIterator(ChangeTrackingValueContainer.java:78)
    at com.intellij.util.indexing.FileBasedIndexImpl$15.convert(FileBasedIndexImpl.java:986)
    at com.intellij.util.indexing.FileBasedIndexImpl$15.convert(FileBasedIndexImpl.java:961)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:934)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1007)
    at com.intellij.util.indexing.FileBasedIndexImpl.processValues(FileBasedIndexImpl.java:915)
    at com.intellij.util.indexing.FileBasedIndexImpl.processValues(FileBasedIndexImpl.java:905)
    at plugin.index.js$root_object_map_by_name.invoke(js.clj:218)
    at plugin.index.js$root_js_object$reify__2195.compute(js.clj:263)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:921)
    at plugin.index.js$root_js_object.invoke(js.clj:260)
    at plugin.index.js$root_js_objects_by_prefix$fn__2210.invoke(js.clj:280)
    at clojure.core$map$fn__4207.invoke(core.clj:2487)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$filter$fn__4226.invoke(core.clj:2523)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4207.invoke(core.clj:2479)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$concat$fn__3923.invoke(core.clj:678)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4207.invoke(core.clj:2479)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.length(RT.java:1646)
    at clojure.lang.RT.seqToTypedArray(RT.java:1615)
    at clojure.core$into_array.invoke(core.clj:3097)
    at plugin.resolve.symbol.editor.cljs$editor_resolver$reify__3946.qualified_variants(cljs.clj:299)
    at plugin.resolve.symbol$variants.invoke(symbol.clj:64)
    at clojure.lang.Var.invoke(Var.java:415)
    at cursive.psi.impl.symbols.SymbolReference.getVariants(SymbolReference.java:157)
    at cursive.psi.resolve.completion.ClojureCompletionContributor.fillCompletionVariants(ClojureCompletionContributor.java:35)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:75)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:115)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:769)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$900(CompletionProgressIndicator.java:84)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:751)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1$1.run(CompletionThreading.java:93)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:911)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1.run(CompletionThreading.java:88)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at com.intellij.codeInsight.completion.AsyncCompletion$1.run(CompletionThreading.java:84)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)



java.lang.NullPointerException: null keys not supported
    at gnu.trove.THashMap.put(THashMap.java:162)
    at com.intellij.util.indexing.ValueContainerImpl.a(ValueContainerImpl.java:72)
    at com.intellij.util.indexing.ValueContainerImpl.addValue(ValueContainerImpl.java:55)
    at com.intellij.util.indexing.ValueContainerMap$ValueContainerExternalizer.read(ValueContainerMap.java:130)
    at com.intellij.util.indexing.ValueContainerMap$ValueContainerExternalizer.read(ValueContainerMap.java:80)
    at com.intellij.util.io.PersistentHashMap.doGet(PersistentHashMap.java:427)
    at com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:398)
    at com.intellij.util.indexing.MapIndexStorage$2$1.compute(MapIndexStorage.java:121)
    at com.intellij.util.indexing.MapIndexStorage$2$1.compute(MapIndexStorage.java:109)
    at com.intellij.util.indexing.ChangeTrackingValueContainer.a(ChangeTrackingValueContainer.java:121)
    at com.intellij.util.indexing.ChangeTrackingValueContainer.getValueIterator(ChangeTrackingValueContainer.java:78)
    at com.intellij.util.indexing.FileBasedIndexImpl$15.convert(FileBasedIndexImpl.java:986)
    at com.intellij.util.indexing.FileBasedIndexImpl$15.convert(FileBasedIndexImpl.java:961)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:934)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1007)
    at com.intellij.util.indexing.FileBasedIndexImpl.processValues(FileBasedIndexImpl.java:915)
    at com.intellij.util.indexing.FileBasedIndexImpl.processValues(FileBasedIndexImpl.java:905)
    at plugin.index.js$root_object_map_by_name.invoke(js.clj:218)
    at plugin.index.js$root_js_object$reify__2195.compute(js.clj:263)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:921)
    at plugin.index.js$root_js_object.invoke(js.clj:260)
    at plugin.index.js$root_js_objects_by_prefix$fn__2210.invoke(js.clj:280)
    at clojure.core$map$fn__4207.invoke(core.clj:2487)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$filter$fn__4226.invoke(core.clj:2523)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4207.invoke(core.clj:2479)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$concat$fn__3923.invoke(core.clj:678)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$concat$fn__3923.invoke(core.clj:678)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4207.invoke(core.clj:2479)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.length(RT.java:1646)
    at clojure.lang.RT.seqToTypedArray(RT.java:1615)
    at clojure.core$into_array.invoke(core.clj:3097)
    at plugin.resolve.symbol.editor.cljs$editor_resolver$reify__3946.qualified_variants(cljs.clj:299)
    at plugin.resolve.symbol$variants.invoke(symbol.clj:64)
    at clojure.lang.Var.invoke(Var.java:415)
    at cursive.psi.impl.symbols.SymbolReference.getVariants(SymbolReference.java:157)
    at cursive.psi.resolve.completion.ClojureCompletionContributor.fillCompletionVariants(ClojureCompletionContributor.java:35)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:75)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:115)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:769)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$900(CompletionProgressIndicator.java:84)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:751)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1$1.run(CompletionThreading.java:93)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:911)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1.run(CompletionThreading.java:88)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at com.intellij.codeInsight.completion.AsyncCompletion$1.run(CompletionThreading.java:84)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)

@cursive-ide
Copy link
Owner

Hmm, there's definitely a bug there. However that stack trace shows that it's indexing javascript. Is your JS definitely being generated under out, or is it perhaps under target?

@wilkerlucio
Copy link
Author

Yes, I made the pre-compiled files go into resources/out and the final at resources/compiled/main.js, and I removed both folders from the project (marked as excluded), the compilations are going into the right place, so it's kind weird it's still trying to index.

@cursive-ide
Copy link
Owner

That is weird. I'll try to reproduce this by working through the Om tutorial and see if I see the same problem.

@wilkerlucio
Copy link
Author

Ups, sorry, I did forgot to comment the compiled folder, now that I did the slowdown is gone :)

Thanks very much for the quick support, I think at some point you should put this info about JS so other people remember to do it to avoid this slowdown.

@cursive-ide
Copy link
Owner

Oh, ok, awesome. Can you share the part of your project.clj that determines where your CLJS output goes? I thought those folders were automatically excluded.

@wilkerlucio
Copy link
Author

Sure, here it is:

(defproject captioneer-editor "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0-alpha2"]
                 [org.clojure/clojurescript "0.0-2322"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                 [om "0.7.3"]]

  :plugins [[lein-cljsbuild "1.0.3"]]

  :source-paths ["src/cljs"]

  :cljsbuild {
   :builds {
             :dev {
                    :source-paths ["src/cljs"]
                    :compiler {
                                :output-dir "resources/out"
                                :output-to "resources/compiled/main.js"
                                :optimizations :whitespace}}}})

@cursive-ide
Copy link
Owner

That looks pretty straightforward. Ok, I'll double check how the exclusion works there. In the meantime I'll close this issue.

@wilkerlucio
Copy link
Author

Just one detail that worth noticing, in my project it actually generated the precompiled on 2 different places, out and resources/out, I guess the first one was generated by Piggieback when I launched the console there, so, even if you point into resources, this is some external thing that the user must consider.

@cursive-ide
Copy link
Owner

Hmm, interesting. And Piggieback has no configuration in the project.clj, right? That's a little annoying - I'll see if I can detect that automatically and fix that.

One thing - you'll probably find that Cursive un-excludes your directories next time you sync your project. I just checked, and I'm not actually excluding those directories - I'm excluding whatever you have in your top-level :target-path entry. This won't help you, though, since that's not a collection, it's a single item so you can't add two elements to it. I'll re-open this and fix it.

@cursive-ide cursive-ide reopened this Sep 26, 2014
@wilkerlucio
Copy link
Author

Yeah, I have Piggieback setup on my Lein profile.

Thanks.

@cursive-ide cursive-ide added this to the 0.1.37 milestone Oct 3, 2014
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

2 participants