计算机工程与应用 ›› 2008, Vol. 44 ›› Issue (3): 108-109.

• 学术探讨 • 上一篇    下一篇

基于素数序列的Java哈希表性能优化

廖名学,范植华   

  1. 中国科学院 软件研究所,北京 100080
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2008-01-21 发布日期:2008-01-21
  • 通讯作者: 廖名学

Prime number sequence based performance improvement in Java Hashtable

LIAO Ming-xue,FAN Zhi-hua   

  1. Institute of Software,the Chinese Academy of Sciences,Beijing 100080,China
  • Received:1900-01-01 Revised:1900-01-01 Online:2008-01-21 Published:2008-01-21
  • Contact: LIAO Ming-xue

摘要: 分析了Java哈希表的实现特点并给出了导致其性能恶化的一种数据模式。针对这种数据模式的特点,提出了基于素数序列的哈希表优化方法,从而几乎完全避免了该模式下哈希表的性能恶化。实验与理论结果表明: 对提出的模式数据,优化方法产生的Hash碰撞比JDK中的方法下降接近100%,而且对随机数据下的Java哈希表性能也有改善。

关键词: Java, 哈希表, 素数

Abstract: The method of implementing Java Hashtable is analyzed and a model of data that can seriously worsen the performance of the Hashtable is given.A method based on prime number sequence is presented to nearly completely avoid this performance deterioration under such model.Both experiments and theory proof show that the new method not only reduces the number of hash conflicts by nearly 100% than the old one in JDK for presented data model but also can improve performance of Java Hashtable for ordinary data.

Key words: Java, Hashtable, prime number