ligasgr / intellij-xquery

Plugin to support XQuery in Intellij Idea
Apache License 2.0
35 stars 23 forks source link

Increased CPU usage #196

Open sofiageo opened 8 years ago

sofiageo commented 8 years ago

I'm not certain if this has to do with IntelliJ or with the plugin, but when I'm editing xquery files in the editor, I have constant CPU usage of about 30%. It only goes to 0% if I close the xquery file tab, then it goes back up again when I reopen the file.

OS: Windows 10 64bit IntelliJ IDEA 2016.1.2

ligasgr commented 8 years ago

Hi, Is this issue affecting every file or only specific ones? Is it a really long file? How complex is the code in it? Is it only happening when you edit the file or when you just open it? Can you please also share the specs of your machine?

sofiageo commented 8 years ago

Hi and thanks. I've recently started using the plugin more so I've noticed this happening with many files in the same project. I haven't tested another project. The files are about 2000 rows each. The code consists of many functions, some comments, and has some module imports as well, but I don't think these imports affect the parsing.

This happens when I open the file, before I start editing the file. I've tested this in two different systems on Windows 10 64bit using latest IntelliJ and latest XQuery plugin. The one system has an AMD FX 4300 CPU and the other one an Intel 2500k.

I also have noticed that it stops after a while (maybe about 20-30 minutes later), but when I start editing the file again it resumes the constant CPU usage. Do you want me to send you a link of the file by email? Or is there any easy way to debug this myself?

sofiageo commented 8 years ago

I don't know if this helps to narrow it down: xquery-plugin-2

Inspections stuck at 99%

ligasgr commented 8 years ago

Can you please try to narrow down the inspections that are slow by enabling/disabling them in the settings? This aside you could potentially run the plugin in IntelliJ in profiler and see if you can identify anything. If possible please send the link to the file if it's available publicly. This should help. Another question is if this is the only big file in this project, how many files are there in the project and to how many files this file is connected to via imports.

sofiageo commented 8 years ago

It's definitely the unused variable inspection. After I disable it the inspections finish in seconds. Since I don't really need this inspection I can safely disable it and "save" my CPU at the moment :+1:

Here is one of the files: https://my.pcloud.com/publink/show?code=XZ7fPbZD4gVo9u42CRNQJssy5h4njSmGtHV

p.s I removed all imports before running the inspections so I don't think they matter.

ligasgr commented 8 years ago

I've never had any experience with xquery files of that size so I didn't have any reason/chance to optimise anything in the plugin for that kind of performance issues. I suspect that in order to deal with (apart from some obvious problem which I'll try to find and eliminate) I will have to implement stub indexes. If you have any other examples of files like this publicly available please send the links via mail. Thanks!