cincyreds Posted April 21, 2005 Posted April 21, 2005 (edited) (NOTE - I just realized I was in the wrong forum when I posted this. If a mod could move this to the I/O section that would probably be more appropriate- thanks). I'm writing an app which currently uses the registry for storing program data. Unfortunately the amount of data which needs to be stored can easily exceed the limits for keys, values, etc. so I need to go with a file based system for storage. In keeping with the .NET "mindset" I originally planned to use XML config files, etc., but after looking at some of the overhead and hoops that need to be jumped through just to save/retrieve simple settings, I now think that INI files would offer a better solution (the app is time sensitive so I want data retrieval to be as quick as possible). I plan on writing a 100% managed code class for INI file manipulation. I've found only one on the web, but it was quite basic and not very well written. All the others use API calls which I'd like to avoid. Does anyone have a robust 100% managed code INI file class? If so, could you post a link? If not, is there anyone interested in a managed code INI file class? If so, I'll post it here when complete. BTW, this would be written in VB.NET. Cheers, Dean Edited April 21, 2005 by cincyreds Quote
PWNettle Posted April 21, 2005 Posted April 21, 2005 In keeping with the .NET "mindset" I originally planned to use XML config files' date=' etc., but after looking at some of the overhead and hoops that need to be jumped through just to save/retrieve simple settings, I now think that INI files would offer a better solution (the app is time sensitive so I want data retrieval to be as quick as possible).[/quote'] If you change your mind about xml you might want to check out this. I haven't used (because I deal with XML a lot and write my own routines) it but it's a good read. With the .Net classes for dealing with XML I think it'd be easier to do this in XML than to completely invent an INI handler, but that's just my opinion. Microsoft has produced a number of "Application Blocks" for a number of topics, including saving and loading application data. You might want to check out their Configuration Application Block for use or inspiration. It's too bloated for my tastes but it does deal with a variety of ways of handling settings and their application block code can be interesting to review. Cheers, Paul Quote
cincyreds Posted April 21, 2005 Author Posted April 21, 2005 Thanks for the quick reply and link. Seeing as you deal with XML a lot, what's your opinion about the following: My app is a task scheduler that runs in the system tray. When it comes time to check for any events that need to be fired, it parses the list of scheduled events and retrieves the pertinent info for each event. This involves accessing anywhere from 5 to 20 individual settings for each event depending on its status, etc. My concern is speed and overhead. I want the loop that checks these events to be as tight as possible. If I have to access the hard drive a few hundred times then this can become critical - especially in a timing application where it's critical not to miss events. Memory consumption is also a concern. I've taken great pains to make this app as memory efficient as possible and right now when idling it runs on a low priority thread in only 800k of memory. I don't want to keep large chunks of data cached, etc. Currently the program pulls in what it needs to only when it needs to, then releases it immediately after. No extra classes, references, strings, etc. hanging around. It just ***seemed*** that XML involved more overhead which might result in slow performance especially in cases where I might only need to read one value. That being said, how do you find the performance of XML in terms of speed, overhead and memory consumption? For my situation, the RETRIEVAL speed is more critical than the WRITING speed. Most major writing is done only when the user manually saves or updates a new task. Any other writing is only 2 or 3 values to update its status, etc. As well, there are LOTS of places where I code reading and writing. I'd hate to have to specify overly long function calls with long parameter lists just to write a single value. I wrote a registry class wrapper that optimizes everything so function calls are short and sweet without having to re-specify sections and keys that are being reused. Thanks for your time! :) Dean Quote
PWNettle Posted April 22, 2005 Posted April 22, 2005 I deal with quite a bit of Xml but I'm not Xml efficiency expert. I have had similar thoughts regarding the efficiency of xml objects compared to other I/O but in my experience the stuff seems ridiculously fast. I often deal with 20,000+ characters at a time from webservice feeds or files and I never notice any kind of load lag. So, I imagine with a relatively small file you really wouldn't notice any speed or memory issues. I'd imagine the experts here could provide better info and/or you might find some performance stats online somewhere. Good luck, Paul Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.