Re: Which one is a preferrable method storing a value in registry?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Jack" <replyto@it> wrote in message
news:uXUSmi7nHHA.1216@xxxxxxxxxxxxxxxxxxxxxxx
Storing numeric value in the Windows registry:
Is it better to store it as DWORD or as a string?
What are the advantages or disadventages of doing so?
Jack


Once upon a time, we actually measured this. It was a large suite running on
a dedicated box that abused the Registry to the nth degree. (Using C++)

When comparing total clicks using an artificial test. DWords measureably
beat out strings when it comes to an insert and retrival. However, in the
real world, other factors often out-weighted the paltry differences.

For example, while first retrival of a string is a couple of clicks, due to
the way the Registry is 'cached', subsquent retrivals were just as quick as
a DWord. The particular Registry Class/Routines in use and how the Apps
performed a read and write took up most of the 'clicks'. (This is where
programmer optimization will have the greatest effect, if you are worried.)

IMHO. Don't waste much time on it. Save values in the format best used by
your program. Trust me, there are always other places in any program worthy
of more attention. <g>

-ralph






.



Relevant Pages

  • Re: Reading names of comports [COM1, COM2 etc]
    ... There might be also the possibility that a commport exists, but is not in the registry. ... if Reg.GetDataType= rdString then ... Driver, PortName: String; ... dwOSVersionInfoSize: DWORD; ...
    (alt.comp.lang.borland-delphi)
  • Recursive function
    ... DWORD cbSecurityDescriptor; ... // Given a HKEY and value name returns a string from the registry. ... // Check result and make sure the registry value is a string... ... Maybe using recursion is causing performance to be not so good as expected. ...
    (microsoft.public.dotnet.framework)
  • Re: Latest updates crash explorer.exe
    ... The performance counter name string value in the registry is incorrectly ... The bogus string is 4586, the bogus index value is the first DWORD ...
    (microsoft.public.windowsupdate)
  • Re: creating registry entry
    ... It puts data OF ANY TYPE AT ALL into the registry. ... allow DWORD values less than 255 so you can pass the value as a byte? ... You pass a pointer to a DWORD, the call looks at the regType ... The call sees that you've told it that a string is coming ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Unable to retrieve the complete description string of the event log record
    ... events in the Registry, under HKEY_LOCAL_MACHINE (which requires elevated privileges to ... "Description" message string of the event log record. ... below but still I'm not able to retrieve the complete description. ...
    (microsoft.public.vc.mfc)