Solved

what is faster: ini-Files or Registry?

Posted on 2001-09-02
14
480 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:delphiheaven
  • 3
  • 2
  • 2
  • +7
14 Comments
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
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
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
and this link too to explore teh windows registry
http://www.billssite.com/tu1420.001.html
0
 
LVL 7

Expert Comment

by:Motaz
Comment Utility
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
 

Author Comment

by:delphiheaven
Comment Utility
Hmmm....

But what about the Speed??

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

delphiheaven
0
 
LVL 14

Expert Comment

by:AvonWyss
Comment Utility
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
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
there's also a limit for the ini files, that the size can't exceed 64kb
0
 
LVL 1

Expert Comment

by:jellison
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Accepted Solution

by:
edey earned 50 total points
Comment Utility
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
 
LVL 5

Expert Comment

by:Gwena
Comment Utility
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
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
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
 
LVL 3

Expert Comment

by:rondi
Comment Utility
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
 
LVL 5

Expert Comment

by:Gwena
Comment Utility
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
 

Author Comment

by:delphiheaven
Comment Utility
Hmm..Okay!

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

And: who gets the points now? :-)

delphiheaven
0
 

Expert Comment

by:amp072397
Comment Utility
delphiheaven:

Just a friendly reminder to return to your open questions.

thanks!
amp
community support moderator

2/8
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now