I have the latest Java and JDK. I have a PHP project (CodeIgniter). When I open it in NetBeans 7.2 I can't get rid of "Background scanning of projects". What is this? How can I accelerate it? How can I disable it?
[current solution] This happens only once when you open a new project in NetBeans. Later "Background scanning of projets" works 10-15 seconds.
I found a solution, however it has slight drawbacks. Use the Scan on Demand plugin. After restarting Netbeans, background scanning should be disabled by default. Use the Update Center installation method, and disable the repository after installation (otherwise you might end up installing unstable updates by mistake).
Drawback: Chances are that indexes are out of date which makes working with Netbeans a little bit less comfortable (as stated on the plugin page).
Scan On Demand - Download and installation instructions
Edit: The bug persists, however using the following makes the perfomance dip a lesser problem. Add this string to netbeans_default_options
in your netbeans.conf:
-J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
Works for me on a Win7, 64b machine, NB 7.2, JDK 1.703
Go to the source folder and delete 'nbproject' folder. But this doesn't allow the project to be displayed in NetBeans anyways it is the best solution.
Background scanning may take too long for projects with large number of files. Instead of investing valuable time getting netbeans to stop scanning your files, why not moving some files outside the project's root directory. That way netbeans wont see them, thus, wont scan them :)
In addition, to ease further netbeans' background scanning, you may want to tell netbeans to ignore (right click > Git > ignore) some directories if you are using versioning control such as git. That way netbeans wont check for external changes on those directories.
Even with netbeans_default_options recommended by @Mateng, that I already used, Netbeans 7.2.1 and later (at least up to Netbeans 8 release) (did not try an earlier version) was getting very slow on "big" projects, because of very long background scans. Code completion was done in 10s of secondes, etc.
So, I took a close look at the logs and noticed that there were a lot of warning related to "code cache" exhaustion.
So, I increased the code cache size using
-J-XX:ReservedCodeCacheSize=<big value>
and all slowness disappeared.
Hope this helps !
You might want to simply disable it in Tools > Options > Miscellanous > Files by unticking "Enable auto-scanning of sources" like mentionned in this answer.
来源:https://stackoverflow.com/questions/12003822/background-scanning-of-projects-slows-down-netbeans-7-2