The scope of a package
instance makes a difference. Package instances that are created in
the global scope typically are created and deleted (allocated and
freed) once and used over and over again. Package instances that are
created in a local scope are created and deleted each time the scope
is entered and exited. For example, a package instance that is created
in a method's scope is created and deleted each time a method is called.
The creation and deletion time can be costly for some packages.
The following examples
use the hash package. This technique can be used for all packages.