Jump to content

Pool (computer science): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Cleanups and layout / language improvements; Fixed a rotten inline reference
Line 3: Line 3:
Pooling of resources can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled resource is obtained in predictable time when creation of the new objects (especially over network) may take variable time.
Pooling of resources can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled resource is obtained in predictable time when creation of the new objects (especially over network) may take variable time.


However these benefits are mostly true for objects which are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (which hold no external resources, but only occupy memory) may not be efficient and could decrease performance.<ref>{{cite web
However these benefits are mostly true for objects which are expensive with respect to time, such as [[database connection]]s, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (which hold no external resources, but only occupy memory) may not be efficient and could decrease performance.<ref>{{cite web
| url = http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-jw22JavaUrbanLegends
| url = http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-jw22JavaUrbanLegends
| archiveurl = http://web.archive.org/web/20111229023158/http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html
| archiveurl = http://web.archive.org/web/20111229023158/http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html

Revision as of 15:01, 25 June 2014

A pool in computer science is a set of initialised resources that are kept ready to use, rather than allocated and destroyed on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished with an object (or resource), it returns it to the pool, rather than destroying it.

Pooling of resources can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled resource is obtained in predictable time when creation of the new objects (especially over network) may take variable time.

However these benefits are mostly true for objects which are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (which hold no external resources, but only occupy memory) may not be efficient and could decrease performance.[1]

Special cases are:

Pool can also refer to a design pattern for implementing them in object-oriented languages, such as the object pool pattern.

References

  1. ^ "Java theory and practice: Urban performance legends, revisited". ibm.com. 2005-09-27. Archived from the original on 2011-12-29. Retrieved 2013-10-31.