什么情况下应该使用对象池(ObjectPool)
2013-01-07 09:33
148 查看
象池很多时候是很有用的模式,有时甚至是必须。但凡事过犹不及,对象池也只有在一些场景下才适合。
引用自:
http://en.wikipedia.org/wiki/Object_pool_pattern
转自:http://vaporz.blog.51cto.com/3142258/706945
Object pooling 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 object 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. |
http://en.wikipedia.org/wiki/Object_pool_pattern
References
http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html转自:http://vaporz.blog.51cto.com/3142258/706945
相关文章推荐
- 什么情况下应该使用对象池(ObjectPool)?
- 应该在什么情况下使用JavaScript框架
- [转]Web service到底是什么?在什么情况下,你应该使用web service
- Web service到底是什么;在什么情况下你应该使用Web service。
- [转]Web service到底是什么?在什么情况下,你应该使用web service
- Web service到底是什么?在什么情况下你应该使用Web service
- 【转】在什么情况下应该使用adLockOptimistic,什么情况下应该使用adLockPessimistic....
- AbandonedObjectPool is used什么情况?
- 在什么情况下应该使用adLockOptimistic,什么情况下应该使用adLockPessimistic....
- Web service到底是什么;在什么情况下你应该使用Web service。
- 什么时候应该使用Autorelease Pool
- 谈一谈对象池SafeObjectPool能干什么
- 在重构的过程中,什么情况下应该使用设计模式?应该用哪种模式?
- 使用对象池(ObjectPool)方式处理子弹的发射逻辑
- 什么情况下应该使用Web Service?
- 什么情况下应该使用Web Service?
- $apply() 应该在什么情况下使用?
- 什么情况下不应该使用深度学习?
- 什么情况下应该使用Web Service?
- 什么时候应该使用Autorelease Pool