我的代码是否正确测量速度? [英] is my code measuring speed correctly?

查看:62
本文介绍了我的代码是否正确测量速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用clock()来测量代码的速度(测试值的传递速度与函数调用中的引用传递速度)。问题是,我的代码返回的速度总是0.0000000


你能检查我是否正确使用clock()函数吗?


函数是在数组中找到最接近用户给出的数字的数字。这是传递值函数的代码。


感谢您的帮助!


相关代码:

I''m using clock() to measure the speed of my code (testing the speed of passing by value vs passing by reference in function calls). The problem is, the speed returned by my code is always 0.0000000

Can you check if I''m using the clock() function correctly?

the function is finding the number in the array that is closest to a number given by the user. Here is the code for the pass by value function.

Thanks for the help!

relevant code:

展开 | 选择 | Wrap | 行号

推荐答案

这是我第一次听说时钟功能。

我做了一个谷歌搜索并查看出现的内容。
转到这里


我希望这会有所帮助。
This is the first time i heard of the clock function.
I did a google search and look at what came up.
Go here

I hope this helps.


感谢您的回复,是的,我也看到了那个页面。 clock()来自ctime类。


我从这里得到了我的代码的想法:

http://forums.macrumors.com/ showthread.php?t = 360028
thanks for the reply, yah, I saw that page also. clock() is from the ctime class.

I kinda got the idea for my code from here:
http://forums.macrumors.com/showthread.php?t=360028


你见过这个线程?


Savage
Have you seen this thread?

Savage


这篇关于我的代码是否正确测量速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆