Sign in to follow this  
Followers 0
bf2forlife

Timer

9 posts in this topic

So i want to know how many milliseconds it will take to complete an function, how i could do that?

Share this post


Link to post
Share on other sites



So i want to know how many milliseconds it will take to complete an function, how i could do that?

You call TimerInit before you call your function. Then after you call your function call TimerDiff.

$timer = TimerInit()
; do your code here
$time_it_took = TimerDiff($timer)

Share this post


Link to post
Share on other sites

Thanks, but someone said that C++ would be faster than autoit with same function, is it true? (dont understand c++)

Share this post


Link to post
Share on other sites

Thanks, but someone said that C++ would be faster than autoit with same function, is it true? (dont understand c++)

Yes, C++ will be faster (depending on the function).

Share this post


Link to post
Share on other sites

Will this script be faster?

$timer = TimerInit()
    FilewriteLine("Output.txt","test")
    $time_it_took = TimerDiff($timer)
    Msgbox(0,"lol",$time_it_took)

And can you also convert this to c++ so i could test it by myself

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Generally speaking, no matter what you do, C++ will be faster simply because it doesn't have to interpret your code.

__int64 start, finish, freq;
    QueryPerformanceFrequency((LARGE_INTEGER *)&freq);
    QueryPerformanceCounter((LARGE_INTEGER *)&start);
    // start time
        
    // I didn't feel like using the windows api, it may be faster - it's too much work
    std::fstream file("output.txt", std::ios::out);
    file << "test";
    file.close();

    // end time
    QueryPerformanceCounter((LARGE_INTEGER *)&finish);
    float diff = (((float)finish - start) / (float)freq * 1000.0f);

    std::cout << diff << "ms";
    std::cin.get();

EDIT

Yes, I agree with monoceres. Take his advice. :)

Edited by cppman

Share this post


Link to post
Share on other sites

Will this script be faster?

$timer = TimerInit()
     FilewriteLine("Output.txt","test")
     $time_it_took = TimerDiff($timer)
     Msgbox(0,"lol",$time_it_took)

And can you also convert this to c++ so i could test it by myself

I strongly suggest that you learn some c++ before digging into this.

Because I seriously doubt that you will be able to understand the process of modifying c++ code -> setting up a compiler environment -> compiling the code into a usable dll file -> calling the dll in autoit with data types, when you don't even know what c++ is :)

And if you don't even know what you are doing then the process is totally useless as you will need assistance for every step you take.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ive heard that when u put some autoit files in the project, then u can use AU3_ to use autoit in the c++ script, will it be faster then? And are there any autoIT > c++ conveters? Thanks

Edited by bf2forlife

Share this post


Link to post
Share on other sites

ive heard that when u put some autoit files in the project, then u can use AU3_ to use autoit in the c++ script, will it be faster then? And are there any autoIT > c++ conveters? Thanks

You can use the AutoIt ActiveX object, but that seems rather pointless to me. And no, there aren't any AutoIt to C++ converters.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0