huyang_a 2016-06-20 15:38 采纳率: 0%
浏览 2329

STL中map和hashmap的性能比较为什么查询15000个数据集只用了0个clock?

图片说明

我在做一个map和hashmap的性能比较,使用的数据集是类型的map和hashmap,测试了15000个数据,结果如上图所示。
不知道为什么遍历和查询会只用0clock,是不是我的程序哪里错了?
源程序参见
源程序

  • 写回答

2条回答

  • threenewbee 2016-06-20 15:48
    关注

    start_hash = clock();
    for(i = begin;i<end;++i)
    {
    testSearchInHashMap(s[i]);
    }
    stop_hash = clock();
    hashmap_t = stop - start; //这里应该是 stop_hash - start_hash

    评论

报告相同问题?