How do you determine the speed of a for loop?

This is a discussion on How do you determine the speed of a for loop? within the C++ Programming forums, part of the General Programming Boards category; How do I manipulate the speed of a for loop?...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    106

    How do you determine the speed of a for loop?

    How do I manipulate the speed of a for loop?

  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Base it on time.

  3. #3
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Or place a call to Sleep() in the body.

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    That would be basing it on time

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    umm......an example would be nice. I never dreamed of placing a loop inside of a Sleep(); function. Thats un-heard of

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    Um... Not a loop in a Sleep() function, but the other way around.

    for (int a=0; a<10; a++)
    {
    Dosomething();
    Sleep(1); // I don't quite know the syntax of sleep, this could be wrong.
    }

    But I don't think you could find much use for a slowed down for-loop (unless you're fading the screen to black or something)

  7. #7
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Sleep(numofmiliseconds);

  8. #8
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Are you trying to find out the speed of a for loop? That depends on the code in the loop.

  9. #9
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    yeah!! thats it

  10. #10
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    D/l this header, it reads time at a certain line, then can tell you how long it took after the loop is finished.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    ok, I downloaded it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-19-2006, 11:40 PM
  2. Replies: 6
    Last Post: 01-08-2006, 01:49 PM
  3. How to Determine LAN Speed and Duplex Setting
    By deadpoet in forum Networking/Device Communication
    Replies: 0
    Last Post: 04-21-2004, 08:38 AM
  4. Determine speed of code
    By Unregistered in forum C Programming
    Replies: 11
    Last Post: 02-05-2002, 10:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21