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.

Bug 50440 - CRC32 checksums computed too often
Summary: CRC32 checksums computed too often
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: PC Linux
: P4 blocker (vote)
Assignee: Jesse Glick
Depends on:
Blocks: 41535 49990
  Show dependency tree
Reported: 2004-10-14 16:35 UTC by _ rkubacki
Modified: 2006-03-24 09:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2004-10-14 16:35:16 UTC
dev build from Oct 13, JDK 1.5.0

J2SEProject.ProjectOpenedHookImpl asks for
computing of CRC32 checksums for project build
files. Unfortunately we do it more times than
neceseary for some files.

stylesheets for generating of build.xml and
build-impl.xml files are generated with each
project.  Maybe we do not need to compute this at
all and just maintain some version numbers for
stylesheet as it evolves.

nbproject/project.xml is checked twice for each
project - once with nbproject/build-impl.xml and
then with build.xml file ( lines
342 and 345).
Comment 1 Jesse Glick 2004-10-14 17:20:51 UTC
Could avoid double-checking CRC for project.xml, probably.

Re. version numbers for stylesheets - I initially planned that, but
figured that in practice developers would forget to update them. The
current approach seems safer.

Lowering to P4 in lieu of evidence that CRC calculation is a major
contribution to project opening time relative to other factors. When
profiling the project open sequence I have never seen it as a major
Comment 2 Jesse Glick 2004-10-14 17:22:58 UTC
Not specific to j2seproject's, but to GeneratedFilesHelper.
Comment 3 Jesse Glick 2004-10-14 17:24:21 UTC
Re. stylesheet CRC computation: if necessary, may be feasible to cache
the CRC within a session for a given jar: URL. Needs to be subtle to
handle module reloading - has to check the timestamp of the JAR file.
Comment 4 _ rkubacki 2004-10-15 10:02:33 UTC
P4 is OK. You could see it if you tested on Ultra60 with sampling
every 1ms ;-). Computing CRC for XML files is not a long operation
(the first I/O is important but we need to read them anyway).
Stylesheet check always takes 10
(/org/netbeans/modules/java/j2seproject/resources/build.xsl) - 25ms
(/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl)  on
my Dell notebook.
Comment 5 Jesse Glick 2004-10-15 20:01:28 UTC
Well 25ms is significant, esp. if it is repeated. I will see if some
caching is feasible.
Comment 6 Jesse Glick 2004-10-29 00:33:21 UTC
Wrote an in-memory CRC32 cache. It is keyed off of URL but only
considered a cache hit if the timestamp and size of the requested file
(or containing JAR) match those of the previous computation. So cache
should be correct so long as either timestamp is changed or size is
Comment 7 Jesse Glick 2004-10-29 15:05:58 UTC
Radim could you check if that helps a little?

added       * Up-To-Date  1.1        
committed   * Up-To-Date  1.10       
Comment 8 _ rkubacki 2004-11-01 12:39:34 UTC
I tested it with two projects open and the changed saved >20% of time
spent in GeneratedFilesHelper$ (time decreased from 250ms to
190ms on my Solaris). It should be more beneficial with more projects.