References to java programs coded using primitives only

后端 未结 6 2088
刺人心
刺人心 2020-12-28 09:48

I\'ve heard of Java programs with strict latency requirements where \"new\" instructions are never -or very rarely- used (because no new=>no objects->no GC=>improved latency

6条回答
  •  暖寄归人
    2020-12-28 09:59

    I've used this technique in game programming, where too many long GC delays can degrade the user experience. In practice it's not necessary to eliminate all "new" instructions, just keep them to a sensible level.

    A good example of a library that uses a lot of these techniques is Javolution - well worth a look if you are either interested in how it is coded or want to use ready-built data structures and algorithms that support operation with minimal allocations.

提交回复
热议问题