what is faster: ini-Files or Registry?

Hi!

What is really the better and FASTER solution to store the settings of a program:
.ini-files or the registry..?

I thought it is the registry, but now I heard from someone else that ini-files can be much more faster..???

delphiheaven
delphiheavenAsked:
Who is Participating?
 
edeyCommented:
Some other notes about ini/reg:

-An ini file is more like a standard, that there just happens to be an implementation for.  If you need to extend it, you can roll your own.  Fix/Improve/Extended the reg? forget it.

-An ini is only used when an app needs that info (on startup usually), the _ENTIRE_ reg gets parsed on startup.  After a couple of months of installing stuff, ever wonder why windows takes all day to get from "login" to usable?

-Ini files are prtable you just need to be sure your target platform has a parser for them. Registry? heck you can't even get that under dos or win 3.x. Take it a step further & drop the in i in favour of confirming XML and you don't even have to write the parser.

-The reg is _one_ file, so if some dumb @%#$# app corrupts it, the system looses _all_ of it's settings.  With an ini-ish (see above comment) solution your settings belong to you.

-Even if speed were an issue, and it shouldn't be or your storing too much - even with the fastest parser, what do you think is going to be faster.  A nice elegant routine to parse a simple, small text file, or a gargantuan bloated pice of ... that needs to be thread safe while searching for your info in an undocumented structure amid thousands of other entries?

-If you take care of your own settings you have revision control.  You can ensure that you'll never have to rewrite that code if you don't want to.  Who's gonna stand up & say that M$ if never going to remove/restrict/change the registry?

- as far as tis earlier comment goes:

"Microsoft replaced the ini files from windows 95 and used the registry insead of them, so it's better
to use the registry"

I'm afraid that's just not correct.  in win95 M$ _added_ the registry thereby offering an _alternative_ to application implemented ini files.  As illustrated above I don't belive the registry is a better solution.

GL
Mike
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hello

   Microsoft replaced the ini files from windows 95 and used the registry insead of them, so it's better to use the registry

Look at this for some info
(Look at the "INI Files Versus Windows Registry and BIF Files" section)
http://gmccomb.com/vault/edge/ini.html
0
 
Mohammed NasmanSoftware DeveloperCommented:
and this link too to explore teh windows registry
http://www.billssite.com/tu1420.001.html
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
MotazCommented:
Advantage of INI files:

- it can be located with your application in the same directory, so that you can have multiple copies of the same application reside in different directories and has different settings, but the registry is centerelized.

- I think that you can use INI in Linux, (If there is no interface to it, then you can do it your self, it is very simple) but Registry is Windows specific

Advantages of Registry

- Centeralized data (Settings) storage
- Windows make a backup for registry and maintain it, so that it is very safe and no data lost can be happened, if so an automated recovery will occure.
0
 
delphiheavenAuthor Commented:
Hmmm....

But what about the Speed??

What is faster: Read/Write in ini-file or in the registry?

delphiheaven
0
 
AvonWyssCommented:
I think that speed is not so much of an issue for storing application settings. The registry is like a database, and it also allows to store binary values etc., plus it allows settings to be per-user and per-machine! This is something you just cannot do with an INI file: having every user have it's own set of settings without knowing where the user has his private profile data. INI files stored in the application (or even windows) directory have the uge drawback that they will modify the settings for all users.
0
 
Mohammed NasmanSoftware DeveloperCommented:
there's also a limit for the ini files, that the size can't exceed 64kb
0
 
jellisonCommented:
I agree that speed is less of an issue - both are fast in my experience. Personally I use ini files for almost everything because they are easy to manage, read, and understand. If you are involved in support then it's easy to get users to send ini files to you and for you to send them back or give instructions on modifying settings.
The only time I tend to use the registry is for things like protection keys and other "hidden" values that you don't want users to see. Just because Microsoft says we should all use the registry doesn't mean we must!

Not sure about the binary value argument - it's all binary in the end. Yes you can store different values by user  but you can do that with ini files as well. You don't have to use the same ini file every time the app runs.

I think there is a size limitation in the standard Delphi ini file unit (I think it's 32k but not certain) but there are other free components out there which remove this limit.

Regards,

John
0
 
GwenaCommented:
I personally dislike messing with the registry..It's scary!
I'm always afraid that I will do something that will corrupt a users registry file :-(
So I use ini files ..or lately I have just been modifying the exe while it runs and adding ini type data to the end of the exe or inside useable bytes near the dos stub... the data stuck into the PE can be read from the ram at runtime and the stuff added to the end of the exe can be quickly read using streams...you can put the data into the exe at runtime by modifying the disk sectors directly..or just rebuild and restart the exe... that takes about 1/2 second and if you do it right the user never knows the program shut down and restarted :-)
0
 
MadshiCommented:
I agree with the others, the speed is normally not so important, both registry and ini-files are quite fast. But to answer your original question:

The registry is faster.

Regards, Madshi.
0
 
rondiCommented:
Hey Gwena,

That's sounds really neat. Please show me how you do that.

With regard to the INI/registry debate, I find that
the choice depends on the kinds of settings I need to store.

For string/text data, especially string lists, I use INI files - not necessarily for performance, but for faster
development. (the commatext prop's really cool, too)

For other data types eg. records & hex values, I find the
registry better to work with.

Sometimes I find that neither will achieve what I want,
so I wind up writing my own custom settings classes/routines eg. for component streaming.

I also think INIs are cool for smallish apps, but for bigger apps the Registry's way better coz it's far better
suited to structured/heirarchial storage.

rondi
0
 
GwenaCommented:
Hi Rondi :-)

  Send me your email and I will send you the ExeMod.pas unit I'm finishing up... it makes it easy to store stuff in your exe.
0
 
delphiheavenAuthor Commented:
Hmm..Okay!

Maybe I should close this discussion..? What do you think?

And: who gets the points now? :-)

delphiheaven
0
 
amp072397Commented:
delphiheaven:

Just a friendly reminder to return to your open questions.

thanks!
amp
community support moderator

2/8
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.