This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Description
ceklock
2011-10-08 08:20:26 UTC
This only happens when "Compile on Save" is enabled. The HD keeps working for a long time, like it was recompiling everything (but hey, I have just done 'Clean and Build'). My current NetBeans version: Product Version: NetBeans IDE 7.1 Beta (Build 201109252201) Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06 System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb) This also happens in NetBeans 7.0.1. Can you please, use 'Profile Me Now' <http://wiki.netbeans.org/FitnessViaPartnership> and attach the snapshot to this bug. thanks. Please attache the nps(s) file. http://wiki.netbeans.org/FitnessViaPartnership Thanks I will attach everything you need. Created attachment 111819 [details]
Profile
There are two parts: 1st) The BAM.copyResources which copies the class files from cache to the build/classes which is OK if the run is done after clean. There was no build/classes/.netbeans_automatic_build file so the files were copied. But any other build should not do resource copying. Can you verify that after run the build/classes/.netbeans_automatic_build exists? 2nd) Index refresh as the index is marked as dirty, this can be caused by issue #202832. Can you try it in some newer dev build? Thanks for the reply. I will check everything because I am very interested about this issue. It happens all the time for me. Now I am using the nightly build of NetBeans [ NetBeans IDE Dev (Build 201110110600) ]. At build/classes/ there are .netbeans_automatic_build and .netbeans_update_resources Product Version: NetBeans IDE Dev (Build 201110110600) Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06 System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb) The nightly build is a little faster considering this issue, but is not as fast as it should be. At the first time that I run an application after 'clean and build' it is much slower than the second time (at the second time is almost instantly without all the HD usage). Product Version: NetBeans IDE Dev (Build 201110110600) Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06 System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb) Created attachment 111956 [details]
Profile after clean and build - 1st run of application
Created attachment 111957 [details]
Profile after clean and build - 1st run of application - calltree
Created attachment 111958 [details]
Profile after clean and build - 1st run of application - combined
Created attachment 111959 [details]
Profile after clean and build - 1st run of application - html
Created attachment 111960 [details]
Profile after clean and build - 1st run of application - html - combined
Created attachment 111961 [details]
Profile after clean and build - 1st run of application - html - combined
Created attachment 111962 [details]
Profile after clean and build - 2nd run of application
Created attachment 111963 [details]
Profile after clean and build - 2nd run of application - calltree
Created attachment 111964 [details]
Profile after clean and build - 2nd run of application - combined
Created attachment 111965 [details]
Profile after clean and build - 2nd run of application - html - combined
Attached more snapshots above: 1st run (slow) and 2nd run (fast). Sorry, but you should not be using Clean&Build with compile on save enabled, except when you actually need the distribution jar. The first run after build will clean all previous compilation results, and will use whatever IDE has in its caches. This is to prevent possible problems with incompatible compilations and other stale data. What is the reason to use Clean&Build? Really? :O Main reason is to update resources, because I can't use the 'Build' feature when compile on save is enabled. You should not need to do anything to get resources updated (unless your build script contains a custom filtering for them, or creates new resources, neither of which is supported by compile on save andthe CoS should be disabled in such a case). 7.0 and 7.1 differ slightly in this respect: 7.0 placed the "src" folder on the classpath, which effectively made all resources in the source folder accessible through ClassLoader.getResource. In 7.1 (done about a month ago, IIRC), the resources should be copied automatically to the build/classes and updated each time the resource in the src folder is updated. I did a quick test, and this seems to work. What exactly is your usecase? Thanks. Take a look at this: http://netbeans.org/bugzilla/show_bug.cgi?id=203618 In my environment no copying is done as well. Can you add the status or the build/classes/.netbeans_automatic_build file (does it exists after you do run)? is the next run slow again? Thanks Did Clean&Build again, at first run it was slow, second was fast. .netbeans_automatic_build and .netbeans_update_resources were created at build/classes/ after the first run. The two files are empty. Product Version: NetBeans IDE Dev (Build 201110110600) Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06 System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb) * With 'first run' I mean the first run of my application. First run of the application was slow, second fast. .netbeans_automatic_build and .netbeans_update_resources were created only after the first run. It might be related to the "Compile on Save" feature which is enabled by default. I think this option is useless with Maven projects. Turning it off improves the launch speed of processes. The first build is slow as the CoS needs to synchronize the caches with the build folder. After the synchronization the .netbeans_automatic_build and .netbeans_update_resources are created. The IDE knows that the build/classes is in sync with cache (all other changes done in the IDE) are tracked by incremental sync and the other runs are fast. When you delete the .netbeans_automatic_build or the .netbeans_update_resources (for example by clean) the full sync is done again. > You should not need to do anything to get resources updated.
I checked this now and you are right. If I create a file and try to access it using class.getResource() I don't have the problems I had times ago.
The following code works ok for a newly created file called 'resource.txt' (FileIO is an utility class that I created).
URL resource = ResourceAccessTest.class.getResource("resource.txt");
FileIO fileIO = new FileIO(resource.toURI());
String loadedString = fileIO.loadString();
System.out.println("loaded string: ");
System.out.println(loadedString);
So, the resources are being copied properly.
Product Version: NetBeans IDE Dev (Build 201110110600)
Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb)
> The first build is slow as the CoS needs to synchronize the caches with the
> build folder.
> After the synchronization the .netbeans_automatic_build and
> .netbeans_update_resources are created.
> The IDE knows that the build/classes is in sync with cache (all other changes
> done in the IDE) are tracked by incremental sync and the other runs are fast.
> When you delete the .netbeans_automatic_build or the .netbeans_update_resources
> (for example by clean) the full sync is done again.
The current issue that is annoying me is that when I do "CVS Update" I get this same slowness when I run something...
* after I do "CVS Update" Steps to reproduce: - Open a big project with many packages and classes; - Make sure "Compile on Save" is enabled; - Do "CVS Update" or "Clean and Build"; - Run a class. Related bugs: http://netbeans.org/bugzilla/show_bug.cgi?id=203618 http://netbeans.org/bugzilla/show_bug.cgi?id=203858 http://netbeans.org/bugzilla/show_bug.cgi?id=204074 Bug still present in NetBeans 7.2.1. The steps to reproduce are the same: - Open a big project (this project has 8.547 files, 1.247 folders); - Make sure compile on save is enabled; - Do "Clean and Build"; - Run some class; - Wait until it starts to run... (why do I have to wait so much time if I just compiled everything with Clean and Build??) Product Version: NetBeans IDE 7.2.1 (Build 201210100934) Java: 1.7.0_09; Java HotSpot(TM) Server VM 23.5-b02 System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb) (In reply to comment #36) > The steps to reproduce are the same: > > - Open a big project (this project has 8.547 files, 1.247 folders); > - Make sure compile on save is enabled; > - Do "Clean and Build"; > - Run some class; > - Wait until it starts to run... (why do I have to wait so much time if I just > compiled everything with Clean and Build??) Sorry, but I do not think this is going to be fixed, unless there is a compelling reason to combine regular running of Clean and Build and compile on save. Currently, it is expected that Clean&Build is run only rarely to produce final project artifacts (i.e. jar). |