(imported topic written by brolly3391)
I have made an interesting observation while tinkering with the relevance debugger today.
q: value “system” of key “DocFolderPaths” of key “Explorer” of key “CurrentVersion” of key “Windows” of key “Microsoft” of key “Software” of key “HKEY_LOCAL_MACHINE” of registry
A: C:\Documents and Settings\LocalService\My Documents
T: 0.390 ms
I: singular registry key value
q: value “system” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths” of registry
A: C:\Documents and Settings\LocalService\My Documents
T: 0.220 ms
I: singular registry key value
The second example is consistently almost twice as fast, even though we are ultimately querying the same key. I tried switching their order in the debugger in case the first statement was getting an advantage from some sort of caching effect but I got similar results.
Brolly