Previous Page

CHAPTER  13

Optimizing Your Application

When your application performs at its best, your users get more work done with less frustration. As you create larger and more sophisticated applications, the amount of memory your applications use and the speed with which they run become more significant. You may decide you need to optimize your application by making it smaller and by speeding up calculations and displays. This chapter presents optimization techniques you can use to make your application smaller and faster.

See Also   For more information on improving performance, search the Help index for "optimization." For information on the performance of client/server applications, see Chapter 19, "Developing Client/Server Applications."

Optimizing Your Microsoft Access Environment

The faster Microsoft Access runs, the faster your application runs, too. You can significantly improve your application's performance by making sure that Microsoft Access has the memory it requires and that it uses memory efficiently for the types of operations your application performs. This is true whether your application runs under full Microsoft Access or as a Microsoft Access run-time application.

This section suggests ways to configure your computer and Microsoft Access for best use of memory. If you don't control the configuration of your application users' computers, you may want to pass some of these suggestions on to them when you deliver your application.

Increase RAM

Because database operations are faster when Microsoft Access can perform them in random-access memory (RAM), the performance of Microsoft Access depends largely on the amount of RAM available. To run by itself, Microsoft Access requires a minimum of 12 megabytes (MB) of RAM for Windows, or 16 MB of RAM for Windows NT Workstation. The amount of memory Microsoft Access needs to run at top speed depends on a variety of factors, such as how many other applications are running at the same time and what types of operations your application performs. When other applications are competing for memory, you can usually improve performance significantly by running with more than the required amount. Similarly, if your Microsoft Access application uses Automation to work with another application's objects, you can improve the performance of your application by running with more RAM. When running with 32 MB or more of RAM, you may be able to increase performance by adjusting the MaxBufferSize setting in the Windows Registry. Make sure that you aren't using any of your RAM for a RAM drive.

See Also   For more information on the MaxBufferSize setting, see "MaxBufferSize" later in this chapter.

Optimize Virtual Memory Use

With virtual memory, an application sees a large, continuous block of primary memory (RAM) that, in reality, is a much smaller block of primary memory supplemented by secondary memory (such as a hard disk). To temporarily free up space in RAM, blocks of data (called pages) are moved between RAM and a swap file located on the hard disk.

By default, the Windows 95 swap file is dynamic, so it can shrink or grow based on available disk space and the operations performed on the system. Also, the swap file can occupy a fragmented region of the hard disk with no substantial performance penalty. A dynamic swap file is usually the most efficient use of resources. The simplest way to ensure high virtual memory performance is to make sure that the disk containing the swap file has ample free space so that the swap file size can shrink and grow as needed.

In Windows 3.x, enhancing performance by changing virtual memory settings is quite common. Because the Windows 95 swap file is dynamic, the need to change virtual memory settings is less common. However, in some situations adjusting virtual memory settings can improve performance. If you've already tried deleting unnecessary files, and you still have a performance problem, try changing the Windows 95 default virtual memory settings.

If you have more than one drive available, you may get better performance if you specify that Windows locate the swap file on a drive other than the default in the following cases:

 If the default drive doesn't have much free disk space, and another local drive has space available.

 If another local drive is available that is faster than the current drive (unless that disk is already heavily used).

You also may get better performance if you specify the minimum disk space available for virtual memory to be at least 25 MB minus available RAM. For example, if your computer has 12 MB of RAM, you should specify at least 13 MB of virtual memory. You may want to specify more if you are running several large applications.

See Also   For information on changing Windows 95 virtual memory settings, search the Windows 95 Help index for "virtual memory settings."

Compact Your Database and Defragment Your Hard Disk

Each time you add or update data, your database grows. But when you delete data, the database doesn't automatically get smaller. Microsoft Access makes empty data pages available for reuse after you close a database, so the next time you open the database they are available to be filled with new records. If left unused, empty data pages remain in the database until you compact it. Compacting the database frees unused disk space, makes all data pages contiguous, and, if a primary key is defined for a table, saves its records in primary key order. For databases in which records are frequently added, deleted, and updated, you should compact frequently.

Note   If your database is a replica, you must compact it twice to reclaim all available space. Additionally, if your database is the Design Master in a replica set, you must take certain precautions when compacting it to prevent it from losing its Design Master status. For more information on replication, see Chapter 20, "Using Replication in Your Application."

See Also   For more information on compacting databases, see "Compacting a Database" in Chapter 15, "Delivering Your Application."

In addition, you should occasionally use a utility such as the Windows Disk Defragmenter to defragment the hard disk after you compact it. This increases efficiency by making your database file contiguous on the hard disk.

Don't Use Wallpaper on a Low-Memory Computer

If you have a wallpaper (full-screen background) bitmap on your Windows desktop and don't have memory to spare, replace your wallpaper with a solid color or pattern bitmap, or don't use a bitmap.

© 1996 Microsoft Corporation. All rights reserved.

Next Page


Casa de Bender