Various optimization questions

This is a discussion on Various optimization questions within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by anon If you are supposed to print the primes within the 20 seconds, then the competition is ...

  1. #46
    </3 Segfaults
    Join Date
    Jul 2007
    Posts
    27
    Quote Originally Posted by anon View Post
    If you are supposed to print the primes within the 20 seconds, then the competition is slightly pointless: I/O is the main bottle-neck for which micro-optimisations such as using arrays of bools (are you sure it even has a positive impact) don't help much. All in all it comes to how fast the display scrolls which might eventually make any implementation practically equal.

    I think I suggested it before, but you'll get a more meaningful comparison if you change the rules, remove output requirement and time how long it takes to find N primes. You may only then be required to output them somehow (probably to file) to be able to see that the algorithm is correct in the first place.
    Which is exactly what happened. Everybody in the top 4 filled in at around 3 mil.

    As for the half-size array, I did that to conserve memory, not to make it run faster.

    Everybody else was way behind. (one person's program didn't even run)

    Anyways, how did you declare a group of bits?
    Last edited by Differ; 08-01-2007 at 04:59 PM.

Page 4 of 4 FirstFirst 1234
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 09:47 AM
  2. Turn Off Optimization?
    By danlee58 in forum C Programming
    Replies: 6
    Last Post: 12-10-2008, 03:52 AM
  3. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 06:36 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 08:22 AM

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