File IO Speed on different locations on the same Hard Disk

I am using C# (VS2005) on an XP machine. I noticed a rather baffling thing, I am storing a lot of data on my application close event. I use the Current User -> Local Settings path to store the data (typically C:\Documents and Settings\Arif\Local Settings\Application Data). It takes around 50 Seconds to store the entire data. By chance I happened to change the storage path to Bin folder of my Application, now it took only 10 seconds to store the same data. Could not understand why, has anyone noticed this before? Is there any logical reason why this would happen.
Could it be that it requires the piece of code to security validations before accessing the Local Settings folder while Bin is immediately accessibl.  How can I improve the performance here in case I want to store it in the Local Settings folder only?

Thanks
LVL 19
arif_eqbalAsked:
Who is Participating?
 
doraiswamyCommented:
a) Try some folders other than bin or Documents and Settings and see what impact there is on performance.

b) Copy your project exe file to the docs and settings folder and see if running it from there makes a difference.

c) It may be possible that if both your exe and data files are in the same physical area of disk, there may be fewer seeks for the drive to make - this is true if your application is large enough that all of it is not loaded into memory at the same time, and page faults are generated.
0
 
imitchieCommented:
it is possible that your disk writes have just moved to an area on your disk that is on the far outer ring. defragging your hd regularly should make the times more consistent no matter where you place it. the NTFS system is agnostic to where you put it, a file in C:\Documents and Settings.... could be right next to one in C:\Program Files.... or some fragments may be together and others as far away as you can imagine.  if anything, local settings would be far more relaxed in security than program files
0
 
imitchieCommented:
i guess the unasked question was, if you now switch it back to Local Settings, does it go back to 50s? if not, then it's got nothing to do with location
0
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

 
arif_eqbalAuthor Commented:
Well imitchie,
it does take 50s again if I switch back to the old location, this is pretty consistent, Bin takes less time and Local Storage more.
Also, to confirm your earlier comment I tried the same on a different machine (AMD 64 Bit, with XP) and again the same mismatch.
Just wanted to mention here I am using the IsolatedStorage, however, I feel the basic question remains unchaged, because all isolatedStorage does is give me a stream with a file on the path of Local Settings, and I have tested it that getting the stream does not take any time at all, its after that while writing that it takes 50 seconds. I feel there's a scope of improvement here since, if instead of opening the file in the IsolatedStorage location I open it on Bin folder I get 5 times better performance.
0
 
imitchieCommented:
are you able to do other timings, time taken from start of streaming to end of streaming - raw disk access after all security checks? i've never heard of it taking 40s to check access. given these are both your machines, would you have configured them exactly the same way? is the setup 1 disk per machine, or do you have raid 0/1?
0
 
imitchieCommented:
another thing to check is, have you configured the path to the app\bin folder as an exception in antivirus software?
0
 
imitchieCommented:
are you on a domain with roaming set up? it could be mirroring the profile to make it inheritable from other machines.
0
 
imitchieCommented:
try scrolling to the 3rd and 2nd last comments on this page:
http://episteme.arstechnica.com/eve/forums/a/tpc/f/99609816/m/801002212831
30 second wait sound similar to your 40s lag
0
 
arif_eqbalAuthor Commented:
doraiswamy - I have tried different machines now, and different locations on the same machine/disk. In fact I checked the exact location used by IsolatedStorage and hardcoded that path its 5 times faster if I use any path compared to IsolatedStorage.

imitchie - went through the IsolatedStorage concepts on MSDN in some detail it might be slightly slower but not as drastically as I am experiencing. No I am not on a roaming set up, and I have tested it on 3 normal single disk machines so far. Don't intend to test on a Raid because that's not going to be the case at client anyway.
Just went through the link you sent, would read it minutely again, though different problem but yes it might be due to the same reason.
I can just dump this idea of IsloatedStorage altogether but not before giving it a good try. Could not digest the fact that it can degrade performance to this extent by using such a simple thing. IsolatedStorage does not do anything more than give me access to a secured and rather unknown location on the disk, must be something somewhere which would be pulling it down.

Thanks
0
 
arif_eqbalAuthor Commented:
Didn't get a very convincing reason for the time lag on the Net, in fact there are only very basic information about the isolated Storage on the Net. Looks like a less explored feature.
Also, I ran into some issues when I strong Named my application, some version colnflicts. It seems the List<T> does not go very well with the isolated storage when the version (just minor version) has changed for your app.
Putting it here just for information.
Thanks
0
 
doraiswamyCommented:
Arif, thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.