作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
<分区>
我正在使用“Perf”(Linux、gcc)进行基准测试。
分配内存时:
point_1 = calloc (100000000, 16); //this takes nearly 1 second and perf find 27M transfers from RAM->CACHE and 1M from CACHE->RAM
没关系。
但是当尝试分配两个数组时:
point_1 = calloc (100000000, 16);
point_2 = calloc (100000000, 16);
//again, program takes nearly 1 second, 27M transfers RAM-CACAHE, 1M CACHE->RAM
看起来,第二个“calloc”(以及所有后续)的行为类似于“malloc”。我正在使用“gcc 版本 4.9.2 (Ubuntu 4.9.2-0ubuntu1~12.04)”。否则程序工作正常。
这样可以吗?
这里有更多的测试和结果:
Time for allocating of data structure 1: 0.976468
Perf: R:27M, W:1M
Time for allocating of data structure 1: 0.975402
Time for initialization of data structure 1 to value of 7: 0.296787
Perf: R: 52M, W: 26M
Time for allocating of data structure 1: 0.976034
Time for initialization of data structure 1 to value of 7: 0.313554
Time for allocating of data structure 2: 0.000031 <-- misbehaving
Perf: R: 52M, W:26M
Time for allocating of data structure 1: 0.975403
Time for initialization of data structure 1 to value of 7: 0.313710
Time for allocating of data structure 2: 0.000031 <-- misbehaving
Time for initialization of data structure 2 to value of 7: 0.809855
Perf: R:79M, W: 53M
不知道这是不是一个正确的问题,但出于好奇,我想知道哪个会被快速搜索。例如- John 或 我已经存储了数百万个文本作为属性值,尽管字符大小不够大。以上只是为了更好地理解这个问题的一个
我有一张表,里面有大约 500,000 个用户。当我使用我的 Rails 3.0 控制台并输入 User.first 我立即得到结果。但是当我输入 User.first(1) 需要几秒钟。可能是什么原
我是一名优秀的程序员,十分优秀!