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 132508 - Repeated masterfs FileObject.getMIMEType() touches disk
Summary: Repeated masterfs FileObject.getMIMEType() touches disk
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2008-04-10 12:06 UTC by Jaroslav Tulach
Modified: 2008-12-22 14:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test that counts file access. OK for LocalFileSystemTest, not OK for MasterFileSystemTest (15.02 KB, patch)
2008-04-10 12:07 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2008-04-10 12:06:33 UTC
The FileObject.getMIMEType() method is essencial for speed of DataObject.find(...) recognition. There is hundreds of 
loaders and each of them asks for mimetype of the same FileObject. That is why the method needs to be optimized, to 
quickly return the result in subsequent calls. This is not the case for current implementation of masterfs. It always 
touches a disk, which can be quite time consuming, especially on network drives.

Surprisingly plain LocalFS is ok. Please fix masterfs as well.
Comment 1 Jaroslav Tulach 2008-04-10 12:07:23 UTC
Created attachment 59964 [details]
Test that counts file access. OK for LocalFileSystemTest, not OK for MasterFileSystemTest
Comment 2 Antonin Nebuzelsky 2008-04-15 17:14:00 UTC
Reassigning to new module owner jskrivanek.
Comment 3 Petr Nejedly 2008-05-14 11:07:03 UTC
There always was a single-entry cache in the filesystems, but unfortunately it always checked the timestamp of the file,
at least. Maybe the problem is only in the timestamp check...
Comment 4 Petr Nejedly 2008-05-14 12:54:57 UTC
Oh yes, it is indeed caused mostly by the lastModified calls according to the stack traces from:
http://wiki.netbeans.org/attach/FitnessAgainstForgetfulness/disk-touches.txt
Comment 5 Jiri Skrivanek 2008-06-17 13:30:51 UTC
As Petr Nejedly pointed out it is not necessary to check lastModified for cached FileObject because it listens to file
changes and discards cached data when file is changed. I also added test inspired by Jarda and removed obsolete test cases.

http://hg.netbeans.org/core-main/rev/b66e3b3d3817