Code Monkey home page Code Monkey logo

objectpooltree's Introduction

ObjectPoolTree

对象池化技术研究

Java对象生命周期:

      Java对象的生命周期大致包括三个阶段:对象的创建,对象的使用,对象的清除。
      因此,对象的生命周期长度可用如下的表达式表示:T = T1 + T2 +T3。其中T1表示对象的创建
      时间,T2表示对象的使用时间,而T3则表示其清除时间。由此,我们可以看出,只有T2是真正有
      效的时间,而T1、T3则是对象本身的开销
使用:

      //创建对象池工厂
      ObjectPoolFactory poolFactory = ObjectPoolFactory. getInstance ();
    恰当地使用对象池技术,能有效地改善应用程序的性能。目前,对象池技术已得到广泛的应用,如对
    于网络和数据库连接这类重量级的对象,一般都会采用对象池技术。但在使用对象池技术时也要注意
    如下问题: 

          ·并非任何情况下都适合采用对象池技术。基本上,只在重复生成某种对象的操作成为影响
            性能的关键因素的时候,才适合采用对象池技术。而如果进行池化所能带来的性能提高并
            不重要的话,还是不采用对象池化技术为佳,以保持代码的简明。

          ·要根据具体情况正确选择对象池的实现方式。如果是创建一个公用的对象池技术实现包,
            或需要在程序中动态指定所池化对象的Class类型时,才选择通用对象池。而大部分情况
            下,采用专用对象池就可以了。

objectpooltree's People

Contributors

qiuqiuxiaomaomi avatar

Stargazers

lintiancong avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.