Lazy loading

From Green software

Revision as of 13:51, 15 September 2010 by Green (Talk | contribs)
Jump to: navigation, search

Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used.

The opposite of lazy loading is Eager Loading.

This best practices was recognized as such in Energy efficient software.



Especially on systems with limited RAM memory, when objects are not loaded into memory unnecessarily this allows for an increase in performance. Even on systems with a lot of RAM memory, having more RAM memory available for other tasks can relieve use of virtual memory. Use of virtual memory, especially on systems with a hard-disk drive, can be very energy inefficient.


Lazy loading can also be energy inefficient, because it disallows the use of batched I/O. Keeping the storage device from turning idle, can be very energy consuming.

Decrease module granularity

A high level design decision to support lazy loading, involves splitting a software system up in small modules. Splitting up a software system in smaller modules however does often introduce some overhead when compared to a monolithic version of the same software.


Lazy loading has been judged by professionals as common practice among experienced software programmers. Lazy loading is done to increase performance.

See Also

Personal tools