As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

C# Slowdown with Windows reinstallation

WastedwombatWastedwombat Registered User regular
So I have a batch process which I need to run a lot (so every second counts!), to process about 40 million records. I wrote a threaded C# application to do this, and every thing worked great. Initially I was running the system on an Intel Core 2 Duo E4600 and it would complete the processing in roughly 70 seconds.

We then built a new system using an Intel Core 2 Quad Q6600 and under testing, this time went down to about 45 seconds - roughly what i expected from a threaded application running on more cores.


This was all fine and dandy, untill we tried to merge the two systems. We took the hard-drive (containing months of data) from the Core 2 Duo, wiped the C partition (all the data was stored on a separate partition), inserted it into the Quad system and reinstalled windows. Upon rerunning the application, running time had gone up to 150 seconds!

The only major differences are that the quad system was initially just for testing so we chucked in an old graphics card and IDE hard-drive. These were then replaced with a better graphics card, the SATA hard-drive and the memory from the Duo System. Since the process doesn't use the graphics card at all, and only reads and writes from the hard-drive before and after its run (all done in memory) - i would have thought they'd have almost no impact.

To summarise:
Intel Core 2 Duo E4600 + SATA drive + Radeon X1950 Pro + 2 gig ram = 70 seconds
Intel Core 2 Quad Q6600 + IDE hard-drive + old graphics card + 1gig ram= 45 seconds.

Intel Core 2 Quad Q6600 + SATA drive + Radeon X1950 Pro + 2 gig ram = 150 seconds

So... does anyone have any idea why a re-installation of windows and better components would make my system run 3 times slower?

Wastedwombat on

Posts

  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2008
    Could be a few things:
    - Did you previously run the image(s) through ngen?
    - Did you go from a 32-bit to a 64-bit OS?
    - Are you running a debug/checked build of the app, or are you running a release build?

    iTunesIsEvil on
  • Options
    RandomEngyRandomEngy Registered User regular
    edited March 2008
    What's the CPU usage on each run?

    RandomEngy on
    Profile -> Signature Settings -> Hide signatures always. Then you don't have to read this worthless text anymore.
  • Options
    WastedwombatWastedwombat Registered User regular
    edited March 2008
    I'm running windows XP with SP2 (32-bit). The application was written in visual studio express, never run through ngen and I'm using the release version - same version on all 3 machines.

    CPU usage never drops below 99% whilst its running.

    As far as I can tell, all 4 cores are working correctly - i just don't know if the application is using them all. From what I've read about it, theres no way to guarantee that window will utilize all 4 cores for the threads. The previous results indicated that it was, but the only reason I can think of for the slow-down, is that its only using 1 now.

    Thanks for the help guys, this is driving me crazy!

    Wastedwombat on
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2008
    If you really want to make sure that your threads are working on all available cores/processors you can force them to with the Win32 SetThreadAffinityMask. That'll let you assign a thread to a specific processor or core. Note that it is Win32, so you'll be making a call into unmanaged land. If you need/want some help calling that let me know.

    iTunesIsEvil on
  • Options
    RandomEngyRandomEngy Registered User regular
    edited March 2008
    If you're seeing 99% CPU use while it's running, that means it's using all cores. If the problem was it using only one core, you'd see ~25% or ~50% CPU use, depending on if it was a quad or dual core. At this point I would use a profiling application to figure out what's happening to all your CPU power, however the one I like to use is Microsoft internal. :/

    RandomEngy on
    Profile -> Signature Settings -> Hide signatures always. Then you don't have to read this worthless text anymore.
  • Options
    WastedwombatWastedwombat Registered User regular
    edited March 2008
    Actually, scratch my last post, I checked again and the application is only using 60 - 80% of the CPU. I'm guessing from this that its only using 3 of the cores. Besides feeling like a bit of a wally, I'm guessing that this at least partially explains the problem.

    Now I just need to try that suggestion of using Win32 SetThreadAffinityMask and I'll see how much of a difference it makes with all 4. Although, I still can't see how a 1/4 reduction in processing power would cause that sort of time difference.

    Wastedwombat on
  • Options
    RandomEngyRandomEngy Registered User regular
    edited March 2008
    Well your application looks to be CPU bound, so the next step would be to profile the application on both systems and compare them. At least that's what I would do. There might be some function whose execution time drastically increased.

    RandomEngy on
    Profile -> Signature Settings -> Hide signatures always. Then you don't have to read this worthless text anymore.
Sign In or Register to comment.