Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Registry Theory Question

Registry Theory Question

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++windows-admintutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soup
    wrote on last edited by
    #1

    Hi, I have recently been working on my first big C++ application, and it has quite a lot of persistent Registry entries. Anyway, when I want to know an app setting, I am doing AfxGetApp()->GetProfileXXX... to get the setting. My question is this: is it slower to keep calling that function or to hive off the settings and keep updating that hive if the settings are changed? Example #1: A loop 10,000 times with a Registry call each loop is probably slower than reading the value out and then looping 10,000 times. Example #2: An event fires (such as WM_CHAR) that reads a setting and uses it once before the end of the handler. Is this slower than having the external hive? Input, ideas and peep's programming practices in this field greatly appreciated. Thanks in advance, Si

    N 1 Reply Last reply
    0
    • S soup

      Hi, I have recently been working on my first big C++ application, and it has quite a lot of persistent Registry entries. Anyway, when I want to know an app setting, I am doing AfxGetApp()->GetProfileXXX... to get the setting. My question is this: is it slower to keep calling that function or to hive off the settings and keep updating that hive if the settings are changed? Example #1: A loop 10,000 times with a Registry call each loop is probably slower than reading the value out and then looping 10,000 times. Example #2: An event fires (such as WM_CHAR) that reads a setting and uses it once before the end of the handler. Is this slower than having the external hive? Input, ideas and peep's programming practices in this field greatly appreciated. Thanks in advance, Si

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      I recommend that you read the config settings at program startup and store them somewhere instead of re-querying the registry every time you need a value.


      Author of the romantic comedy Summer Love and Some more Cricket [New Win]

      S 1 Reply Last reply
      0
      • N Nish Nishant

        I recommend that you read the config settings at program startup and store them somewhere instead of re-querying the registry every time you need a value.


        Author of the romantic comedy Summer Love and Some more Cricket [New Win]

        S Offline
        S Offline
        soup
        wrote on last edited by
        #3

        This is what I thought. ;) I was just wondering whether AfxGetApp() within MFC did some smart cacheing of values. I would have thought not, but here's hoping.

        M 1 Reply Last reply
        0
        • S soup

          This is what I thought. ;) I was just wondering whether AfxGetApp() within MFC did some smart cacheing of values. I would have thought not, but here's hoping.

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          It's not AfxGetApp() that's slow (trace into it and see), but doing thousands of registry calls is. The registry is a database, and access won't be lightning-quick. As Nish said, read your config into variables at startup, then save it on exit. --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups