Intellij gradle project sync takes long time - intellij-idea

Gradle build command from terminal finishes in less than a minute but doing a refresh/sync on Intellij IDE taken 15 to 30 minutes. Tried to change the memory (-Xmx) to different levels 1g, 2g,3g upto 8g, still the time taken is in same range. Out project uses around 50 jars from maven/artifactory repo.
I profiled gradle process using YourKit Profiler, but not able to pin point and solve why it is taking so long. Never used YourKit before. Attached screenshots from YourKit below.
.
Event Timeline shows most of the time is spent on "socket.Read" events (attached below), other events have very negligible time spent.
UPDATE: Using Gradle version 4.1

YourKit has special product to profile Grable builds https://www.yourkit.com/projectx/eap/ It is available in EAP and it might help to understand what Gragle does under the hood.

Related

Build process taking forever with kotlin on intellij

I am trying to run kotlin on IntelliJ.However, the build process is taking forever and nothing appears as an output. I spent several days without solving the problem enter image description here

Intellij IDEA 2016.2 high CPU usage

I have only one project (an ordinary SpringFramework project) opened. And the IDE is crazy using CPU:
JVisualVM CPU sample:
Note this happened just recently
Any idea?
The correct answer was posted by #matt-helliwell if you're coming from a version older than 2016.2.
File -> Invalidate Caches and Restart
If the above doesn't fix your problem, track this issue:
https://youtrack.jetbrains.com/issue/IDEA-157837
I invalidated the caches and it solved the problem for some time. But after a couple days Idea (my version is 2017.1.3) started to work slow with some freezing delays again. Finally I increased maximum available memory to 2 Gb (parameter -Xmx in idea.exe.vmoptions/idea64.exe.vmoptions file) and now it works perfect
I solved the problem by running idea64 bits :
JetBrains\IntelliJ IDEA 2016.2.4\bin\idea64.exe
Another possible solution, my IDEA was very slow because of a huge sql file open which was consuming all my CPU.
It took me a long time to notice this was happening only when opening a specific utility class with more than 1000 lines of code.
This class had maybe 50 public static methods (the reason why it is a utility class...), all pure.
At first, I thought it was stuck on a loop of "Performing code analysis" because that was the thing running heavily on the background as shown when hovering the mouse above a green check on top of the window of the offending class:
, but in reality, it was slowly scanning each instance in which the code was being executed in the entire source code.
It took like 45 minutes to scan the entirety of the class, the entire time the CPU usage at max (100%).
Once the class is closed the usage stops.
The issue (at least with AS Dolphin 2022-23) is that the analysis is never memorized, so if the window is closed, and opened later, the analysis begins from 0. So, it never gets cached...

IntelliJ memory issues

I have been using IntelliJ IDEA 12 for developing a Java Applications. I have the best experience for an IDE. It was working fine until recently. It started to show the heap size memory issue recommending to increase the Xmx and ask me to ignore or shutdown. The behaviour is weird as the IDE starts at 300 MB then it starts to take more memory until it reaches 750+ MB that's when it shows the problem.
I switched back to eclipse and the memory foot print is stable at 300 MB and doesn't increase by time like IntelliJ
Is IntelliJ doing some background process related to my code causing this increase? or is it a memory leakage problem with the IDE?
I've used IDEA for 10 years (and used IDEA 12 for a year before switching to IDEA 13 EAP builds) and have never had a memory issue. And I do not see any consistent mention of memory issues in the IDEA forums.
That said, a memory leak was just fixed (as in released today) in the IDEA 13 EAP. The VcsLogGraphTable class had a leak. The ticket does not give any indication if the leak was/is present in IDEA 12. Based on the name of the class, it should only come into play for Git or Hg graphs (but Hg graphs were added in 13). Based on my experience with how they do tickets, I interpret this as an IDEA 13 issue.
First, make sure you are using the latest version 12.1.6.
Often times memory issues are a result of a poorly written third party plug-in. You can try to disable any third party plug-ins and see if the issue is resolved.
The other thing you can do is follow the instructions in the document How to report IntelliJ IDEA performance problems and take CPU snapshots and report the issue to JetBrains. That way they can confirm a leak in IDEA 12, or tell you what plug-in is the culprit.

Speeding up the Dojo Build

We are running a build of our application using Dojo 1.9 and the build itself is taking an inordinate amount of time to complete. Somewhere along the lines of 10-15 minutes.
Our application is not huge by any means. Maybe 150K LOC. Nothing fancy. Furthermore, when running this build locally using Node, it takes less than a minute.
However, we run the build on a RHEL server with plenty of space and memory, using Rhino. In addition, the tasks are invoked through Ant.
We also use Shrinksafe as the compression mechanism, which could also be the problem. It seems like Shrinksafe is compressing the entire Dojo library (which is enormous) each time the build runs, which seems silly.
Is there anything we can do to speed this up? Or anything we're doing wrong?
Yes, that is inordinate. I have never seen a build take so long, even on an Atom CPU.
In addition to the prior suggestion to use Node.js and not Rhino (by far the biggest killer of build performance), if all of your code has been correctly bundled into layers, you can set optimize to empty string (don’t optimize) and layerOptimize to "closure" (Closure Compiler) in your build profile so only the layers will be run through the optimizer.
Other than that, you should make sure that there isn’t something wrong with the system you are running the build on. (Build files are on NAS with a slow link? Busted CPU fan forcing CPUs to underclock? Ancient CPU with only a single core? Insufficient/bad RAM? Someone else decided to install a TF2 server on it and didn’t tell you?)

IntelliJ IDEA 12.1 eat 100% CPU from time to time

I've just updated my IntelliJ IDEA to latest 12.1 version and I found my laptop CPU usage become 100% from time to time, monitor the progress manager I found IDEA fork an new Java process regularly and it runs for several tens of seconds and shutdown. During that time the CPU usage is close to 100%:
Chances are the external build mentionned by #CrazyCoder compiles your project automatically when you make changes to your source files. If it annoys you too much, you can disable automatic compilation in File > Settings > Compiler > Make project automatically (uncheck the box).
I had the IDEA 12 process itself (not a forked Java) occupy 100%, and respond very slowly to keypresses, navigation, etc.
Eventually I resolved this by cleaning out the cache, prefs, Application Support dir, etc and uninstalling/reinstalling IDEA 12. You have to reinstate your preferences and let Idea reindex your projects (due to removing its cache) - but this shouldn't take long.
Here's a list of some places to clean on OS X (slightly out of date for IDEA 12, but a useful starting point).
I am using IntelliJ 13 Community Edition and have found this problem on Linux.
It my case it is the Intelli JBehave plugin causing these issues.
When opening a dialog the CPU usage of the Java process drops right back to 5 to 10% percent.
When disabling the plugin the same is true.
Goto Home Folder then Navigate to .IntelliJIdea13\config\options
Edit the file "project.default.xml" Change the VM_PARAMETERS Xmx and Xms as follows
It decreased the CPU usage to 50%