作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2011, Vol. 37 ›› Issue (20): 255-257. doi: 10.3969/j.issn.1000-3428.2011.20.087

• 工程应用技术与实现 • 上一篇    下一篇

排序算法在龙芯3A上的优化实现

翁玉萍,顾乃杰,李 恺,陈 强   

  1. (中国科学技术大学计算机科学与技术学院安徽省计算与通讯软件重点实验室,合肥 230027)
  • 收稿日期:2010-04-14 出版日期:2011-10-20 发布日期:2011-10-20
  • 作者简介:翁玉萍(1985-),女,硕士研究生,主研方向:算法优化;顾乃杰,教授、博士生导师;李 恺、陈 强,硕士研究生
  • 基金资助:

    国家“863”计划基金资助项目(2008AA010902);国家自然科学基金资助项目(60803066)

Optimized Implementation of Sorting Algorithm on Loongson 3A

WENG Yu-ping, GU Nai-jie, LI Kai, CHEN Qiang   

  1. (Anhui Province Key Laboratory of Computing and Communication Software, School of Computer Science and Technology, University of Science and Technology of China, Hefei 230027, China)
  • Received:2010-04-14 Online:2011-10-20 Published:2011-10-20

摘要: 分析归并排序算法和快速排序算法,根据国产CPU龙芯3A的体系结构特性,提出2种优化算法并进行实现。综合利用访存特性,引入拷贝优化、循环展开、交换操作优化和不同基本排序混用等优化技术。测试结果表明,在不影响排序稳定性的前提下,与Glibc 2.11库中的排序函数相比,2种优化算法均能提升16.9%~90.5%的排序性能。

关键词: 龙芯3A, 归并排序, 快速排序, 优化算法, 循环展开

Abstract: Through analysis of the characteristics of merging sorting and quick sorting, this paper presents two optimized algorithms specially for Loongson 3A CPU’s features. To boost the performance, it adapts various optimizing techniques including utilize the characteristic of memory access, copy optimization, loop unrolling, operation exchanging and compounding different basic sorting algorithms. Without losing the robustness, sorting performance on Loongson 3A is improved by about 16.9% to 90.5% in different situations, compared to the sorting function in Glibc 2.11.

Key words: Loongson 3A, merging sorting, quick sorting, optimization algorithm, loop unrolling

中图分类号: