Flipkart Search Bar

Flipkart.com

Tuesday, April 10, 2007

Optimization Myths 1

Also known as "Bad Tweaks" these are frequently recommended and included in various tweaking programs claiming to improve performance. In each case they either do absolutely nothing or even worse, actually hurt performance. For Tweaks that work use the Optimize XP guide.

1. Always Unload DLL (Disable DLL Caching)

[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer] "AlwaysUnloadDLL"

Myth - "Enabling AlwaysUnloadDLL frees up more memory and improves performance."

Reality - "Adding this Registry Key in Windows 2000 or XP has no effect since this registry key is no longer supported in Microsoft Windows 2000 or later. The Shell automatically unloads a DLL when its usage count is zero, but only after the DLL has not been used for a period of time. This inactive period might be unacceptably long at times, especially when a Shell extension DLL is being debugged. For operating systems prior to Windows 2000, you can shorten the inactive period by adding this registry key."

2. /Prefetch:1 Switch

Myth - "Adding the /Prefetch:1 Switch to the startup path of a program's shortcut will decrease the program's startup time."

Reality - All it does is change your hash number - the OS is doing exactly the same thing it did before, and just saving the prefetch pages to a different file. It does not improve performance in any way. Ryan Myers of Microsoft's Windows Client Performance Team writes: "The /prefetch:# flag is looked at by the OS when we create the process - however, it has one (and only one) purpose. We add the passed number to the hash. Why? WMP is a multipurpose application and may do many different things. The DLLs and code that it touches will be very different when playing a WMV than when playing a DVD, or when ripping a CD, or when listening to a Shoutcast stream, or any of the other things that WMP can do. If we only had one hash for WMP, then the prefetch would only be correct for one such use having incorrect prefetch data would not be a fatal error - it'd just load pages into memory that'd never get used, and then get swapped back out to disk as soon as possible. Still, it's counterproductive. By specifying a /prefetch:# flag with a different number for each "mode" that WMP can do, each mode gets its own separate hash file, and thus we properly prefetch. (This behavior isn't specific to WMP - it does the same for any app.) This flag is looked at when we create the first thread in the process, but it is not removed by CreateProcess from the command line, so any app that chokes on unrecognized command line parameters will not work with it. This is why so many people notice that Kazaa and other apps crash or otherwise refuse to start when it's added. Of course, WMP knows that it may be there, and just silently ignores its existence. I suspect that the "add /prefetch:1 to make rocket go now" urban legend will never die, though."


3. Cleaning the Prefetch Folder

Myth - "Deleting the contents of the Prefetch folder improves performance."

Reality - "Every time you delete an application's Prefetch (.PF) file you will cripple that application's load time the next time you go to launch it. This can temporarily increase load times by as much as 100%. For one thing, XP will just re-create the Prefetch (.PF) trace files anyway; secondly, it trims the files if there's ever more than 128 of them so that it doesn't needlessly consume space. However you do not regain optimal application load times back until after the second time you launch the same application due to the Prefetch (.PF) trace file being re-created. Prefetch (.PF) trace files are not a cache and are not preloaded into memory upon windows startup. They are never even accessed until you launch an application. Only one Prefetch (.PF) trace file per application is created. There is never ANY reason to delete these files. Cleaning the Prefetch folder is actually a temporary self-inflicted unoptimization. Why you would want to deliberately hurt your PC's performance I have no idea." - Source - Source 2 - Source 3 - Source 4

Malware/Viruses - Some people irresponsibly recommend cleaning this folder due to possible Malware/Virus infection. Malware/Viruses can place an infected file(s) in any folder and the Prefetch folder is no different. Do these same people recommend deleting the contents of the Windows folder because it is a popular location to find an infected file(s)? Of course not, you simply clean or delete the infected file(s) not the contents of the folder. This Myth got started due to the indiscriminate nature of the Windows Prefetcher, which will Prefetch any executable file that you load or loads during Windows start up. Thus it is quite common on an infected machine to find a Prefetch (.PF) trace file in the Prefetch folder with the same name as an infected executable. These files are NOT Malware/Viruses. They are there to improve the load time, in this case ironically, of the Malware/Virus but do not contain any infected code. Once the associated infected executable is deleted, these Prefetch (.PF) trace files do nothing and will eventually automatically be cleaned by Windows.

Corrupted Files - Some people claim that Prefetch (.PF) trace files can get randomly "corrupted" and thus they need to be periodically deleted. Files do not get "corrupted" unless something is wrong with your computer. Any file corruption is a warning sign something is wrong with your system. Overclocking, using defective components like Memory and Harddrives and using FAT32 instead of the superior NTFS file system are common causes of file corruption. NTFS is very resilient to file corruption as compared to FAT32. When storing data to disk, NTFS records file I/O events to a special transaction log. If the system crashes or encounters an interruption, NTFS can use this log to restore the volume and prevent corruption from an abnormal program termination or system shutdown. NTFS doesn't commit an action to disk until it verifies the successful completion of the action. This precaution helps prevent corruption of an NTFS volume. NTFS also supports hot-fixing disk sectors, where the OS automatically blocks out bad disk sectors and relocates data from these sectors. This housecleaning happens in the background. An application attempting to read or write data on a hot-fixed area will never know the disk had a problem. Thus the solution is fixing the cause of the file corruption.

CCleaner - Finally the useless, performance slowing cleaning option "Old Prefetch data" was moved to the advanced section and is now not selected by default. Never select this option for cleaning as it will increase application and Windows load times. This option removes Prefetch files that are a few weeks old based on the NTFS last access date. Since Windows XP already cleans this folder at 128 entries, this is a useless option that will only reduce system performance. You should never delete a Prefetch file for any installed application since that would cripple it's load times. Just because a program was not used in a few weeks does not mean you want it to load as slow as possible when you do decide to use it. If you disable the NTFS last access date stamp then this option will delete the whole contents of the Prefetch folder after a few weeks, which will cripple Windows Boot and all application load times. The Prefetch folder is also ridiculously small so cleaning Prefetch files before the 128 limit will reclaim next to no disk space. This option clearly needs a warning to prevent people from unknowingly hurting their system performance. Anyone who claims this should be cleaned for ANY reason does not understand how Windows Prefetching works. - Source

Bad Advice - This bad advice to clean the prefetch folder is posted frequently on the Internet by people who do not understand how the Windows XP Prefetcher works. Their explanations are 100% inaccurate. - Bad Advice 1 - Bad Advice 2 - Bad Advice 3 - Bad Advice 4


4. EnablePrefetcher

[HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\MemoryManagement\PrefetchParameters] "EnablePrefetcher"

Myth - "Setting any value higher then 3 to EnablePrefetcher will improve performance."

Reality - The Prefetcher component in Windows XP is part of the Memory Manager, and helps to shorten the amount of time it takes to start Windows and programs. This is a new feature in Windows XP which improves application load times and Windows boot times automatically. The slower your system and the larger an application, the more Prefetching helps. Even high end systems benefit from prefetching with large, slow loading applications, such as large games. By default Prefetching is enabled in Windows XP and already configured optimally. The following list describes the different possible values for the EnablePrefetcher registry key.

0 = Disabled
1 = Application launch prefetching enabled
2 = Boot prefetching enabled
3 = Applaunch and Boot enabled (Optimal and Default)

By default the Prefetcher is set to a value of 3 in Windows XP. Values such as 4, 5, 6 ect... do not exist and are thus useless. Leave this at the default value of 3 which is already optimal for maximum performance on both Windows XP Boot and initial application launches. - Source

Low Memory Systems - Recommendations to disable Prefetching on low memory systems (128 MB - 512 MB) is based on the fallacy that portions of application code are preloaded into memory before the application load is initiated during Windows startup. This is completely false and is spread by people who do not understand how Windows XP Prefetching works. The slower the system the more it will benefit from Prefetching. 64 MB systems will suffer due to insufficient RAM, reducing but not eliminating Window XP's prefetching benefits. 128 MB is the recommended minimum for optimal prefetching performance.

Boot Performance - Recommendations to set the EnablePrefetcher value to 2 to improve boot performance is based on the fallacy that portions of application code are preloaded into memory before the application load is initiated during Windows XP startup. This is completely false and is spread by people who do not understand how Windows XP Prefetching works. Only the files used during boot will be Prefetched. The Prefetch folder is not a cache. Windows XP will boot in the exact same amount of time with either value 2 or 3, the only difference with 2 is that now all of your initial application launches will not be Prefetched and thus load slower. The default value of 3 in no way negatively affects Windows XP boot times. Leave the value at 3 for optimal Windows XP boot and initial application launch times.


5. Enable Superfetch

[HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\MemoryManagement\PrefetchParameters] "EnableSuperfetch"

Myth - "Adding EnableSuperfetch to the registry improves performance in Windows XP as it does in Windows Vista."

Reality - "This myth was started when the Inquirer irresponsibly ran a bogus letter without doing any fact checking. Windows internals guru Mark Russinovich said this won't work, the "Superfetch" string isn't even in the Windows XP kernel. You can confirm this yourself by checking with the strings.exe utility. This makes it impossible for it to do anything since no "Superfetch" command exists. Windows cannot execute a nonexistent command and will simply ignore it. Anyone who says this works is not only lying but a fool." - Source


6. Conservative Swapfile

Myth - "Adding ConservativeSwapfileUsage=1 to the System.ini file improves performance."

Reality - "The System.ini and Win.ini files are provided in Windows XP for backward compatibility with 16-bit applications. They have no effect on the Windows XP paging file settings which are stored in the Registry. This setting only effects Windows 95/98 operating systems. The default setting for ConservativeSwapfileUsage is 1 for Windows 95, and 0 (zero) for Windows 98. On Windows 98 systems you can set ConservativeSwapfileUsage=1 under the [386Enh] heading of the System.ini file causing the system to behave as Windows 95 does, at some cost in overall system performance." - Source


7. Deleting Temp Files

Myth - "Deleting Temp Files improves performance."

Reality - Deleting temporary files does not improve application, gaming or system performance. All it does is increase your available disk space. While AntiVirus and AntiSpyware scan times and general disk search times can be reduced, these are not what people associate with improved performance. Deleting the contents of your browser cache actually reduces performance for previously visited webpages since they must be reloaded into the cache.

Notes - Modern disk search engines such a Windows Desktop Search take the location of temporary files into account and does not waste time indexing these files. Versions are available for download for Windows 2000, XP, 2003 and it is included in Vista.


8. Disable Dr. Watson

[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]

Myth - "Disabling Dr. Watson improves performance since it is always running."

Reality - "If a program error occurs, Dr. Watson will start automatically but not before unless you manually start it. Which means disabling Dr. Watson has no effect on system performance. Dr. Watson (Drwtsn32.exe) for Windows is a program error debugger that gathers information about your computer when an error (or user-mode fault) occurs with a program. Technical support groups can use the information that Dr. Watson obtains and logs to diagnose a program error. When an error is detected, Dr. Watson creates a text file (Drwtsn32.log) that can be delivered to support personnel by the method they prefer. You also have the option of creating a crash dump file, which is a binary file that a programmer can load into a debugger. This is valuable information to help troubleshoot a system problem, thus it makes no sense to disable Dr. Watson." - Source - Source 2 - Source 3

Notes - Programs errors should be addressed and not ignored by making sure you are using the latest non-Beta version of the application that crashed and apply all patches that are available from the developer of the application. This can also be a warning sign something is wrong or misconfigured with your system. Use the Diagnose XP Guide to help troubleshoot the most common causes of system problems.


9. Clearing the Paging File

[HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\MemoryManagement] "ClearPageFileAtShutdown"

Myth - "Clearing the Paging File at Shutdown improves performance."

Reality - "Enabling this will clear the Window's paging file (Pagefile.sys) during the shutdown process, so that no unsecured data is contained in the paging file when the shutdown process is complete. If you enable this feature, the shutdown time will be increased. Some third-party programs can temporarily store unencrypted (plain-text) passwords or other sensitive information in memory. Because of the Windows virtual memory architecture, this information can be present in the paging file. Although clearing the paging file is not a suitable substitute for physical security of a computer, you might want to do this to increase the security of data on a computer while Windows is not running." - Source


10. Disable the Paging File

Myth - "Disabling the Paging File improves performance."

Reality - "You gain no performance improvement by turning off the Paging File. When certain applications start, they allocate a huge amount of memory (hundreds of megabytes typically set aside in virtual memory) even though they might not use it. If no paging file (pagefile.sys) is present, a memory-hogging application can quickly use a large chunk of RAM. Even worse, just a few such programs can bring a machine loaded with memory to a halt. Some applications (e.g., Adobe Photoshop) will display warnings on startup if no paging file is present." - Source

"In modern operating systems, including Windows, application programs and many system processes always reference memory using virtual memory addresses which are automatically translated to real (RAM) addresses by the hardware. Only core parts of the operating system kernel bypass this address translation and use real memory addresses directly. All processes (e.g. application executables) running under 32 bit Windows gets virtual memory addresses (a Virtual Address Space) going from 0 to 4,294,967,295 (2*32-1 = 4 GB), no matter how much RAM is actually installed on the computer. In the default Windows OS configuration, 2 GB of this virtual address space are designated for each process' private use and the other 2 GB are shared between all processes and the operating system. RAM is a limited resource, whereas virtual memory is, for most practical purposes, unlimited. There can be a large number of processes each with its own 2 GB of private virtual address space. When the memory in use by all the existing processes exceeds the amount of RAM available, the operating system will move pages (4 KB pieces) of one or more virtual address spaces to the computer's hard disk, thus freeing that RAM frame for other uses. In Windows systems, these "paged out" pages are stored in one or more files called pagefile.sys in the root of a partition. Virtual Memory is always in use, even when the memory required by all running processes does not exceed the amount of RAM installed on the system." - Source


11. Moving the Paging File

Myth - "Moving the Paging File to a different partition on the same drive improves performance."

Reality - "Moving the Paging File (pagefile.sys) to a different partition on the same physical hard disk drive does not improve performance. Simply using a different partition on the same drive will result in lots more head-seeking activity, as the drive jumps between the Windows and paging file partitions. Even though moving the paging file in this case can have the positive effect of defragmenting it, the loss in I/O performance out weighs any gains. It is better to simply defragment the paging file using PageDefrag and keep maximum I/O performance by leaving the paging file where it is with a single drive setup. - Source

Notes - However you can enhance performance by putting the paging file on a different partition and on a different physical hard disk drive. That way, Windows can handle multiple I/O requests more quickly. When the paging file is on the boot partition, Windows must perform disk reading and writing requests on both the system folder and the paging file. When the paging file is moved to a different partition and a different physical hard disk drive, there is less competition between reading and writing requests."


12. Paging File RAMdisk

Myth - "Putting the Paging File on a RAMdisk improves performance."

Reality - "Putting a Paging File in a RAM drive is a ridiculous idea in theory, and almost always a performance hit when tested under real-world workloads. You can't do this unless you have plenty of RAM and if you have plenty of RAM, you aren't hitting your paging file very often in the first place! Conversely, if you don't have plenty of RAM, dedicating some of it to a RAM drive will only increase your page fault rate. Now you might say "yeah, but those additional page faults will go faster than they otherwise would because they're satisfied in RAM." True, but it is still better to not incur them in the first place. And, you will also be increasing the page faults that have to be resolved to exe's and dll's, and the paging file in RAM won't do diddly to speed those up. But thanks to the paging file in RAM, you'll have more of them. Also: the system is ALREADY caching pages in memory. Pages lost from working sets are not written out to disk immediately (or at all if they weren't modified), and even after being written out to disk, are not assigned to another process immediately. They're kept on the modified and standby page lists, respectively. The memory access behavior of most apps being what it is, you tend to access the same sets of pages over time... so if you access a page you lost from your working set recently, odds are its contents are still in memory, on one of those lists. So you don't have to go to disk for it. Committing RAM to a RAMdisk and putting a paging file on it makes fewer pages available for those lists, making that mechanism much less effective. And even for those page faults resolved to the RAMdisk paging file, you are still having to go through the disk drivers. You don't have to for page faults resolved on the standby or modified lists. Putting a paging file on a RAMdisk is a self-evidently absurd idea in theory, and actual measurement proves it to be a terrible idea in practice. Forget about it." - Source - Source 2


13. Disable Certain Services

Myth - "Disabling these Services improves performance."

Reality - "Disabling these Services actually reduces performance."

DNS Client Service - "The overall performance of the client computer decreases and the network traffic for DNS queries increases if the DNS resolver cache is deactivated. This effectively reduces Internet Performance for sites you have previously visited and puts an unnecessary load on your ISP's DNS server." - Source

Task Scheduler Service - "Disabling the Task Scheduler completely cripples Windows XP's Boot and Application Load times by preventing Prefetch (.PF) trace files and the Layout.ini file from being created or updated." - Source

Notes - Disabling other unnecessary services in general has only one affect on performance and that is reduced Windows XP boot times. - Source


14. Disable Paging Executive Low Memory Systems or High Memory Systems

[HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] "DisablePagingExecutive"

Myth - "Setting DisablePagingExecutive to 1 improves performance by preventing the kernel from paging to disk."

Reality - "DisablePagingExecutive applies only to ntoskrnl.exe. It does not apply to win32k.sys (much larger than ntoskrnl.exe!), the pageable portions of other drivers, the paged pool and of course the file system cache. All of which live in kernel address space and are paged to disk. On low memory systems this can force application code to be needlessly paged and reduce performance. If you have more than enough RAM for your workload, yes, this won't hurt, but then again, if you have more than enough RAM for your workload, the system isn't paging very much of that stuff anyway. This setting is useful when debugging drivers and generally recommended for use only on servers running a limited well-known set of applications."

No comments :

 

Blogger news

Blogroll

About