Search:

Type: Posts; User: mtekk; Keyword(s):

Search: Search took 0.00 seconds.

  1. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Without devolving into assembly, I'm not exactly sure how to make things any faster. I have implemented Trace's method in C++, which takes 0ms for any number to complete for reasons discussed...
  2. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    You mean every instruction, characters are 'free', the number of instructions is what is important.

    Trace,

    Using a for statement is no faster than using any other loop, the condition to keep...
  3. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Helix, you realize that writing directly to that file is going to really slow things down right? ;) A semi-faster way is to use a stream buffer, dump the numbers into it, and then at the end dump it...
  4. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Looks like VB6's arrays are faster on small numbers than C++ vectors (vector<T> class objects) and C dynamically allocated arrays (using malloc()). That is interesting.:think:
  5. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    If that's the one you entered (the one in the count object, not the count2 object), then doing a similar thing in C++ results in times under the resolution of my timer, for all lengths. :think:

    Ok...
  6. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Err, that second one isn't actually storing the count. ;) Unless I'm missing something :?
  7. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Just for fun I opened up Mathematica and did some plots of the times. For the following plots, orange is Trace, blue is me (mtekk), red is Silverdemon, and green is Prince.

    Here's Trace's Time vs....
  8. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    In all reality, there are much faster ways of doing this in C++, but mine was the quickest to write, and kept with the STL. I wrote it in the middle of two weeks filled with midterms. Prince probably...
  9. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Good find, its hard to believe Google would change from a superior screening process to a "stupider" one. :think:
  10. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Doesn't work with gmail, they actually check the file structure ;), ran into that problem/figure that out a long time ago. You actually have to send them in a compression format that they (google)...
  11. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Can you send confirmation e-mail to those who sent you stuff? I only ask this because gmail does not like sending binaries:mad:, so I sent it in a 7zip archive last night.
  12. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    You do have to prove that your code doesn't just do a 1, 2, skip a few... 9,999,999... 10 million kinda thing. :rolleyes:
  13. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Um, not quite, few are doing that, I can tell by the times (unless some one is running a raid array with some super fast SAS drives or those ramdisks, at least for those times under 1sec for 1M). The...
  14. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    You can manually manage rollovers and store it in two longs (slow, ugly, and what we do for the PIC18F452 in microcontroller land), or go to 64bit where longs are 16bytes long.
  15. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    There are Open Source tools that do generate windows executables on a Unix like system. Look at MinGW, it supposedly will allow you to cross compile for Windows in Linux.
  16. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    I assume you have 2GB of memory too :). I run out somewhere around 200M :(, well not really run out, but it's close enough.
  17. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    I think the 1Billion one should be replaced by 100Million as unless you have about 4GB of memory you won't have linear results.

    What we really need is a way to compare the different systems...
  18. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Well not exactly true. It's too fast for the resolution of the timer that you are using, so in theory there are some digits that are less than 10^-3 in cumulative value.

    I wonder if the x86...
  19. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    It's not doing anything in the loop so the java compiler does it's optimizing duty. ;)
  20. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    So what was your assignment?

    Anyways I know my code was a little slower than what's possible, but it will give just about the shortest total application run time (if that even matters). I have a...
  21. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    Same code as before but on my Laptop (C2D x9000 (2.8Ghz :D)) on vista, still no major optimizations.
    1M: 1.198sec
    2M: 2.276sec
    5M: 5.763sec
    10M: 11.539sec
    1000M: 349.184sec

    Still seems to be...
  22. Thread: Counting

    by mtekk
    Replies
    112
    Views
    83,387

    Re: Counting

    So we're incrementing here correct? I'm not sure if multi-threading will help at all ... Also for timing, are we just benchmarking how long it takes to count from 0 to upper bound specified (1...
Results 1 to 22 of 22